Closed Bug 1758568 Opened 2 years ago Closed 1 year ago

JS Minifier fails on Extension.jsm

Categories

(Firefox Build System :: General, defect, P3)

defect

Tracking

(firefox-esr91 unaffected, firefox-esr102 wontfix, firefox98 unaffected, firefox99 wontfix, firefox100 wontfix, firefox110 wontfix, firefox111 wontfix, firefox112 fixed)

RESOLVED FIXED
112 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox-esr102 --- wontfix
firefox98 --- unaffected
firefox99 --- wontfix
firefox100 --- wontfix
firefox110 --- wontfix
firefox111 --- wontfix
firefox112 --- fixed

People

(Reporter: fabrice, Assigned: nalexander)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [fidedi-ope])

Attachments

(1 file)

The classifyOriginPermissions function at https://searchfox.org/mozilla-central/rev/9ca193b4233957439583f2eadabbd3cfb4cd9fed/toolkit/components/extensions/Extension.jsm#1662 triggers a bug in the minifier: here's the minified version:

static classifyOriginPermissions(origins=[]){let allUrls=null,wildcards=new Set(),sites=new Set();for(let permission of origins){if(permission=="<all_urls>"){allUrls=permission;break;}

let match=/^[a-z*]+:\/\/([^/]*)\/|^about:/.exec(permission);      if (!match) {        throw new Error(`Unparseable host permission ${permission}`);      }//
Note:the scheme is ignored in the permission warnings.If this ever

if(!match[1]||match[1]=="*"){allUrls=permission;}else if(match[1].startsWith("*.")){wildcards.add(match[1].slice(2));}else{sites.add(match[1]);}}
return{allUrls,wildcards,sites};}

This is causing a SyntaxError: unexpected token: identifier parsing error which was kind of hard to track in the long chain of promises / async functions and only appeared as a failure to download a corrupt extension...

Hmm, interesting. Can you directions to reproduce this issue?

Flags: needinfo?(fabrice)

(In reply to Mitchell Hentges [:mhentges] 🦀 from comment #1)

Hmm, interesting. Can you directions to reproduce this issue?

It looks like the js minifier is enabled on b2g gonk builds. My local fix is to add ac_add_options --enable-minify=properties in my mozconfig, so I guess you can repro with ac_add_options --enable-minify=properties,js

Flags: needinfo?(fabrice)

fabrice: are you saying that Bug 1752968 enabled JS minification in a place that it was not enabled before? If so, that wasn't intended: I tried pretty hard to keep the conditions identical.

Flags: needinfo?(fabrice)

Minification was not enabled before on Gonk builds, but that changed because of the enable_minify_default() rules. I can believe you that nothing changed for official Geckoview builds.

However that's the first time I see the minifier failing, and that's the real issue.

Flags: needinfo?(fabrice)

(In reply to [:fabrice] Fabrice Desré from comment #4)

Minification was not enabled before on Gonk builds, but that changed because of the enable_minify_default() rules. I can believe you that nothing changed for official Geckoview builds.

Ah, you are correct: I changed a thing to is_android where before it was only for mobile/android. I'm surprised we don't see the same issue for GeckoView, but perhaps we are seeing it and we just aren't looking for it.

NI to me to get back to this.

Assignee: nobody → nalexander
Severity: -- → S3
Status: NEW → ASSIGNED
Flags: needinfo?(nalexander)
Priority: -- → P3
Whiteboard: [fidedi-ope]

Set release status flags based on info from the regressing bug 1752968

Has Regression Range: --- → yes

AIUI this isn't an issue for Firefox, and as such we don't need to get or uplift a patch for 99?

Hi,
I have noticed that an old version (2.1.0) of jsmin is versioned, and updating to the latest one solves this problem.

Does anyone know the process to update jsmin?

Update third_party/python/requirements.in and run mach vendor python. I think there are ongoing issues with mach vendor python, though.

Attachment #9316242 - Flags: review?(mh+mozilla)

What needs to happen to get that landed since glandium accepted the change in phabricator?

(In reply to [:fabrice] Fabrice Desré from comment #12)

What needs to happen to get that landed since glandium accepted the change in phabricator?

I landed it. You could also set checkin-needed, I think.

Flags: needinfo?(nalexander)

Thanks Nick!

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch

Just for information.

The latest version seems to be 3.0.1.
We do not have to update it because it only updates test.py.

Attachment #9316242 - Flags: review?(mh+mozilla)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: