Closed Bug 1457976 Opened 6 years ago Closed 6 years ago

proxy.settings.clear may not be working

Categories

(WebExtensions :: Untriaged, defect)

58 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mixedpuppy, Unassigned)

References

Details

Followup bug on settings.clear.


from erosman in bug 1455755 comment 43:

Testing 61.0a1 (2018-04-28) (64-bit) Win

I was going to test clear() but the clear() doesn't seem to be working properly with PAC, unless clear({}) is not the correct method.
I was going according to:
https://dxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/test/xpcshell/test_ext_proxy_config.js#278

I set the PAC with browser.proxy.settings.set(..);

browser.proxy.settings.clear({}); doesn't clear it. The PAC is still active, the PAC URL filled and "Do not prompt for authentication if password is saved" ticked.

However, it clears the Extension Info showing "An extension, FoxyPAC, is controlling how Nightly connects to the internet."

browser.proxy.settings.set({value: { proxyType: 'system' }}); works fine though.


erosman: some questions

- Is this tested with a fresh profile?
- is this behaving different than browserSettings.proxyConfig in 59?
- what is the return value of the call to clear?  
   let success = await browser.proxy.settings.clear({});
Flags: needinfo?(eros_uk)
I will do some extensive testing and post the result here.

Note: I wasn't using clear() method before. This was the first time I tried it. Previously I was using set({value: { proxyType: 'system' }}) which worked/works fine with both browserSettings.proxyConfig & proxy.settings
Flags: needinfo?(eros_uk)
OK.. here it is:


  let conf = await browser.proxy.settings.get({});
  console.log(conf);
  {
    "levelOfControl": "controlled_by_this_extension",
    "value": {
      "proxyType": "autoConfig",
      "autoConfigUrl": "data:text/plain;base64,Ly8gLS0tLS0gRm94eVBBQyBj...=",
      "autoLogin": true,
      "proxyDNS": false,
      "httpProxyAll": false,
      "socksVersion": 5,
      "passthrough": "localhost, 127.0.0.1",
      "http": "",
      "ftp": "",
      "ssl": "",
      "socks": ""
    }
  }
  
  let success = await browser.proxy.settings.clear({});
  console.log(success);
  true
  
  conf = await browser.proxy.settings.get({});
  console.log(conf);
  {
    "levelOfControl": "controllable_by_this_extension",
    "value": {
      "proxyType": "autoConfig",
      "autoConfigUrl": "data:text/plain;base64,ZnVuY3Rpb24gRmluZFByb3h...==",
      "autoLogin": true,
      "proxyDNS": false,
      "httpProxyAll": false,
      "socksVersion": 5,
      "passthrough": "localhost, 127.0.0.1",
      "http": "",
      "ftp": "",
      "ssl": "",
      "socks": ""
    }
  }

  browser.proxy.settings.set({value: { proxyType: 'system' }});
  conf = await browser.proxy.settings.get({});
  console.log(conf);
  {
    "levelOfControl": "controlled_by_this_extension",
    "value": {
      "proxyType": "system",
      "autoConfigUrl": "",
      "autoLogin": false,
      "proxyDNS": false,
      "httpProxyAll": false,
      "socksVersion": 5,
      "passthrough": "localhost, 127.0.0.1",
      "http": "",
      "ftp": "",
      "ssl": "",
      "socks": ""
    }
  }  

Note:
1- It did not clear
2- It sets the autoConfigUrl that was set previously from somewhere/cache (the 2 are NOT the same)

It feels like on clear(), it resets to the previously cached (by Firefox) values and does not clears/resets to defaults.
(In reply to erosman from comment #2)

> It feels like on clear(), it resets to the previously cached (by Firefox)
> values and does not clears/resets to defaults.

That is what is supposed to happen with any of the settings APIs.  It's by design.  If your intention is to actually "clear' the settings, you do need to call set({...})

I would be concerned if clear did not clear the settings if ONLY one extension modified the settings.

IOW:


extension_a calls proxy.settings.set({...})
extension_a calls proxy.settings.clear({...})

expected: proxy.settings has the default values that firefox has on a new profile


extension_a calls proxy.settings.set({...})
extension_b calls proxy.settings.set({...})
extension_b calls proxy.settings.clear({...})

expected: proxy.settings now has the values that extension_a set
I see... well, since that is the expected behaviour, then this issue can be closed.

> I would be concerned if clear did not clear the settings if ONLY one extension modified the settings.
It works as expected.
I had manually set a DATA:URI to PAC in Firefox Network settings for testing, before installing the new version of the add-on and that contributed to my confusion (as it was reverting to that one).
Ok, glad to know that wasn't misbehaving.  Thanks for all the testing on this.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.