Autofill Issues

Copper Contributor

Hi there,

 

While developing an extension (using the chromium examples), I wanted to disable the passwords autofilling and saving by the extension.

 

The code is the following : 

// background.js
chrome.privacy.services.autofillEnabled.get({}, function(details) {
  if (details.levelOfControl === "controllable_by_this_extension") {
    chrome.privacy.services.autofillEnabled.set({ value: false }, function() {
      if (chrome.runtime.lastError === undefined)
        console.log("Hooray, it worked!");
      else console.log("Sadness!", chrome.runtime.lastError);
    });
  }
});

chrome.privacy.services.autofillAddressEnabled.get({}, function(details) {
  if (details.levelOfControl === "controllable_by_this_extension") {
    chrome.privacy.services.autofillAddressEnabled.set(
      { value: false },
      function() {
        if (chrome.runtime.lastError === undefined)
          console.log("Hooray, it worked for Address!");
        else console.log("Sadness!", chrome.runtime.lastError);
      }
    );
  }
});

chrome.privacy.services.autofillCreditCardEnabled.get({}, function(details) {
  if (details.levelOfControl === "controllable_by_this_extension") {
    chrome.privacy.services.autofillCreditCardEnabled.set(
      { value: false },
      function() {
        if (chrome.runtime.lastError === undefined)
          console.log("Hooray, it worked for Credit Card!");
        else console.log("Sadness!", chrome.runtime.lastError);
      }
    );
  }
});

chrome.privacy.services.passwordSavingEnabled.get({}, function(details) {
  if (details.levelOfControl === "controllable_by_this_extension") {
    chrome.privacy.services.passwordSavingEnabled.set(
      { value: false },
      function() {
        if (chrome.runtime.lastError === undefined)
          console.log("Hooray, it worked for Credit Card!");
        else console.log("Sadness!", chrome.runtime.lastError);
      }
    );
  }
});

 

 And here is the manifest.json :

{
  "name": "Getting Started Example",
  "version": "1.0",
  "description": "Build an Extension!",
  "permissions": ["storage", "privacy"],
  "background": {
    "scripts": ["background.js"],
    "persistent": false
  },
  "manifest_version": 2
}

 

After loading the extension unpacked into the Edge Beta I just downloaded, the console logs my success callbacks but upon navigating websites for which I had a saved password, it kept autofilling and showing the account selection popup.

 

I can't find a solution to this issue, knowing that this extension on the latest build of Chromium does work and prevents Chromium from autofilling.

 

Does any of you have something similar or knows how to completely disable the autofill / autosave settings ?

 

Regards

0 Replies