Closed Bug 1401511 Opened 8 years ago Closed 8 years ago

WebExtension's proxy API mutates the array return value of FindProxyForURL

Categories

(WebExtensions :: Request Handling, defect, P1)

57 Branch
defect

Tracking

(firefox56 unaffected, firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox56 --- unaffected
firefox57 --- fixed

People

(Reporter: crownofdesign, Assigned: robwu)

References

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36 Steps to reproduce: I used this attached example Actual results: It gives many proxy errors. If I will comment this line: let allow = [{"host":"149.255.154.4","type":"proxy","port":8080}]; and will change this line return allow; to return [{"host":"149.255.154.4","type":"proxy","port":8080}]; all is working Expected results: This example must work
Win 7 x64. 57.0a1 (2017-09-19) (64-bit)
I see: Proxy error: FindProxyForURL: Return type must be a string or array of objects I debugged as follows: 0. Unzip the attached extension, start Firefox 57 with an empty profile, load the directory with the unzipped files. 1. Enable debugging via about:debugging 2. Launch the browser toolbox (Ctrl-Alt-Shift-I). 3. Search in the Debugger for ProxyScriptContext.jsm, and put a breakpoint at the line that emits the above error. 4. Trigger a request, e.g. by starting to type in the location bar. 5. Observe that the input "proxyData" is an empty array. 6. Walk up the stack trace, go to the applyFilter function and put a breakpoint at the ret = this.FindProxyForURL line. 7. Trigger a request. 8. Observe that the breakpoint is triggered, and that the "allowed" array from the provided sample extension is empty. Mutated by: https://searchfox.org/mozilla-central/rev/d08b24e613cac8c9c5a4131452459241010701e0/toolkit/components/extensions/ProxyScriptContext.jsm#132
Status: UNCONFIRMED → NEW
Component: General → WebExtensions: Request Handling
Depends on: 1381290
Ever confirmed: true
Summary: Webextension: Proxy API. Using variables in new object-based syntax does not work → WebExtension's proxy API mutates the array return value of FindProxyForURL
Assignee: nobody → rob
Status: NEW → ASSIGNED
Comment on attachment 8910254 [details] Bug 1401511 - Don't mutate return value of FindProxyForURL https://reviewboard.mozilla.org/r/181750/#review187152 ah, that's why I originaly had a .sice() in the initial call to createProxyInfoFromData, but I later removed it. This will need to be in 57.
Attachment #8910254 - Flags: review?(mixedpuppy) → review+
Priority: -- → P1
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/d0e11356fe9c Don't mutate return value of FindProxyForURL r=mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Verified as fixed using Build identifier: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0 and I can see the differences after the fix was landed in 57(no proxy errors). Please see attached screenshots. Please let me know if any other testing is needed.
Flags: needinfo?(rob)
Attached image Postfix screenshot
Flags: needinfo?(rob) → qe-verify-
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: