Closed Bug 618101 Opened 14 years ago Closed 14 years ago

SyntaxError ("let" doesn't work) when loading bootstrap.js to call uninstall() from a disabled add-on

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla2.0b10
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: Mardak, Assigned: asaf)

Details

(Whiteboard: [hardblocker])

Attachments

(2 files, 3 obsolete files)

If you install the attached add-on then disable it then install it again, you'll get the following warning and uninstall() doesn't run. Warning: WARN addons.xpi: Error loading bootstrap.js for restartless@agadak.net: SyntaxError: missing ; before statement Source File: resource://gre/modules/XPIProvider.jsm -> jar:file://../extensions/restartless@agadak.net.xpi!/bootstrap.js Line: 1 bootstrap.js: let x = 0; function startup() {} function shutdown() {} function install() {} function uninstall() {} It seems like whatever is creating the sandbox happens to be using an older version of js somehow.
This only happens if the add-on is disabled when installing it again. If I disable, uninstall (+ reload about:addons), the bootstrap.js loads fine and calls uninstall(). So it seems like there's only a problem when bootstrap.js needs to be loaded for a disabled add-on to call uninstall.
Edward, please always post the build id you are using. That gives us really helpful information. So let me ask it from you. If you don't use one of the latest minefield builds, please update. Bug 596580 got fixed lately, which could be a symptom. If not, which JS version are we using for bootstrapped add-ons?
Build identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b8pre) Gecko/20101209 Firefox/4.0b8pre
blocking2.0: --- → betaN+
This is probably to do with the creation of the sandbox happening either from an XPCOM component's context (for the normal startup case) or the window context (for the uninstall while disabled case).
Wait no that is not it at all. This is a confusing one.
There is still the open bug 613383. Not sure if it could matter for this issue.
Assignee: nobody → dtownsend
Bug 595691 could certainly be related, though it's not clear why we'd ever _downgrade_ the version...
Mano was going to investigate this
Assignee: dtownsend → mano
Bug 604301 might also be related?
We don't run the code through eval or evalInSandbox.
Whiteboard: [hard blocker]
(In reply to comment #10) > We don't run the code through eval or evalInSandbox. What is the status here? Sounds like you have a good idea of how to fix it
Whiteboard: [hard blocker] → [hardblocker]
Whiteboard: [hardblocker] → [hardblocker][eta: 1/13]
Attached patch the quicker fix (obsolete) — Splinter Review
Here is a one-liner solution. I don't know the javascript-version-autodetect code very well (I used to think chrome just gets "latest"), but cleary the js version for the xpinstall-confirm-dialog is < 1.7 if not specified explicitly. Soon I'll post the evalInSandbox-based solution, which is somewhat ugly but much more correct IMO. While both solutions aren't risky IMO, I guess smaller is better this late in the game.
Attachment #505179 - Flags: review?(dtownsend)
Whiteboard: [hardblocker][eta: 1/13] → [hardblocker]
Attached patch the other option (obsolete) — Splinter Review
This patch fixes any potential caller, not just xpinstall. I like it more, you might not. Unfortunately, both options are bad in the same way: we'll have to update this number every once in a while. :-/
Attachment #505191 - Flags: review?(dtownsend)
Comment on attachment 505191 [details] [diff] [review] the other option Yeah I prefer this option, feels like it is more likely to cover all the bases, looks like you should use the version "ECMAv5" for now though as the latest version. I've filed bug 627196 on allowing us to just fix the string to something that means latest version here but I think this fix is good enough to ship with. Is there anyway to test this?
Attachment #505191 - Flags: review?(dtownsend) → review+
Attachment #505179 - Flags: review?(dtownsend) → review-
But it doesn't, and I have no idea why. I suppose we face some sandbox-mess here (maybe I should have created the install object within the sandbox context? I cannot tell how far this goes...). Anyhow, we shouldn't spent more time on this IMO.
(In reply to comment #15) > Created attachment 505237 [details] [diff] [review] > A test? something along these lines should have worked > > But it doesn't, and I have no idea why. I suppose we face some sandbox-mess > here (maybe I should have created the install object within the sandbox > context? I cannot tell how far this goes...). Anyhow, we shouldn't spent more > time on this IMO. Yeah you're probably right, let's get it landed
Whiteboard: [hardblocker] → [hardblocker][has patch][has review][can land]
Keywords: checkin-needed
Attachment #505179 - Attachment is obsolete: true
Attachment #505191 - Attachment is obsolete: true
Attachment #505237 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [hardblocker][has patch][has review][can land] → [hardblocker]
Edward, I'm sadly still not able to reproduce this bug in older builds. Would you have a minute to test if this issue is fixed for you now? Thanks.
I can reproduce in Firefox 4 Beta 9 using the STR in comment 0. (With the addition of extensions.checkCompatibility.4.0b = false as the original xpi I attached didn't have a maxver including b9.) Verified fixed on nightlies.
Status: RESOLVED → VERIFIED
Target Milestone: --- → mozilla2.0b10
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: