FoxyProxy doesn't work in Nightly, due to use of no-longer-supported "for each" statement

VERIFIED FIXED

Status

VERIFIED FIXED
2 years ago
2 years ago

People

(Reporter: dholbert, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
STR:
 1. Install FoxyProxy Basic from:
    https://addons.mozilla.org/en-US/firefox/addon/foxyproxy-basic/
 2. Restart to complete installation.
 3. Open "Tools" menu & try to click FoxyProxy Basic entry.  (Or alternately, drag its icon onto the toolbar from the "Customize" option in hamburger menu, & try to click its toolbar icon.)

EXPECTED RESULTS:
FoxyProxy dialog or menu should appear.

ACTUAL RESULTS:
Nothing happens - no FoxyProxy UI appears. Also, this shows up in the Browser Console at startup:
> SyntaxError: missing ( after for     foxyproxy.js:1876:10

...and this shows up when I try to click the Tools menu-entry or the toolbar icon:
> TypeError: foxyproxy is undefined    browser.xul:1:1

This worked in old Firefox builds, but it broke in the last few weeks. Regression range:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=2c773b97167252cedcba0be0c7af9d4cab192ef5&tochange=8103c612b79c2587ea4ca1b0a9f9f82db4b185b8

The startup Browser Console error links to this line of FoxyProxy JS code:
>       for each (let i in ["foxyproxy-mode-change", "http-on-modify-request"])

That's a solid hint that this regressed from the following change in the regression range linked above:
> 	63ec09d6484c	Tooru Fujisawa — Bug 1293305 - Part 1: Disable non-standard for-each on Nightly and add testing function to enable/disable it. r=evilpie

So I guess this line of FoxyProxy source (& perhaps other similar code) needs to be rewritten to not use this non-standard [and now unsupported] "for each" construct.
(Reporter)

Comment 1

2 years ago
For reference, here's a patch that fixed this in some other code: attachment 8808980 [details] [diff] [review]

Basically, it looks like we should replace code like this...
> for each (let k in [...])
...with code like this:
> for (let k of [...])
Flags: needinfo?(grimholtz)
Thanks, Daniel. I've already fixed it using traditional array iteration. 
`
  let tmp = ["these", "are", "array", "elements"];
  for (let i=0, sz=tmp.length; i<sz; i++) {
    // Do something with tmp[i]
  }
`
That way, I know it works with any version of Firefox. Code isn't released yet.
By the way, such code was in more than one place in the codebase.
(Reporter)

Comment 4

2 years ago
Thanks, Eric!
Fixed in FoxyProxy Standard 4.6.1 and FoxyProxy Basic 3.6.1 and FoxyProxy Plus 5.6.1. Please close ticket.
(Reporter)

Comment 6

2 years ago
Thanks! I tried out the latest version at https://addons.mozilla.org/en-US/firefox/addon/foxyproxy-basic/ (3.6.2) in a fresh Nightly profile, and I confirmed that it's fixed.

Resolving.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Flags: needinfo?(grimholtz)
Resolution: --- → FIXED
(Reporter)

Updated

2 years ago
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.