Closed Bug 970280 Opened 10 years ago Closed 7 years ago

Test that an add-on can be enabled after disabling them

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: zer0, Assigned: murph)

References

Details

Attachments

(1 file)

Enable an add-on after it was disable raises an exception that prevent the add-ons from be enabled again:

Bootstrap error: "prototype" is read-only
iced@resource://gre/modules/XPIProvider.jsm -> jar:file:///var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/tmp_d9L9a.mozrunner/extensions/my-test@jetpack.xpi!/bootstrap.js -> resource://extensions.modules.my-test-at-jetpack.commonjs.path/toolkit/loader.js:112
Loader@resource://gre/modules/XPIProvider.jsm -> jar:file:///var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/tmp_d9L9a.mozrunner/extensions/my-test@jetpack.xpi!/bootstrap.js -> resource://extensions.modules.my-test-at-jetpack.commonjs.path/toolkit/loader.js:132
@resource://gre/modules/XPIProvider.jsm -> jar:file:///var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/tmp_d9L9a.mozrunner/extensions/my-test@jetpack.xpi!/bootstrap.js -> resource://extensions.modules.my-test-at-jetpack.commonjs.path/toolkit/loader.js:9
@resource://gre/modules/XPIProvider.jsm -> jar:file:///var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/tmp_d9L9a.mozrunner/extensions/my-test@jetpack.xpi!/bootstrap.js -> resource://extensions.modules.my-test-at-jetpack.commonjs.path/toolkit/loader.js:26
loadSandbox@resource://gre/modules/XPIProvider.jsm -> jar:file:///var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/tmp_d9L9a.mozrunner/extensions/my-test@jetpack.xpi!/bootstrap.js:278
@resource://gre/modules/XPIProvider.jsm -> jar:file:///var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/tmp_d9L9a.mozrunner/extensions/my-test@jetpack.xpi!/bootstrap.js -> resource://extensions.modules.my-test-at-jetpack.commonjs.path/sdk/loader/cuddlefish.js:30
loadSandbox@resource://gre/modules/XPIProvider.jsm -> jar:file:///var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/tmp_d9L9a.mozrunner/extensions/my-test@jetpack.xpi!/bootstrap.js:278
startup@resource://gre/modules/XPIProvider.jsm -> jar:file:///var/folders/tx/91xwh51562l5_4xcqjst9bvw0000gn/T/tmp_d9L9a.mozrunner/extensions/my-test@jetpack.xpi!/bootstrap.js:192
XPI_callBootstrapMethod@resource://gre/modules/XPIProvider.jsm:4312
XPI_updateAddonDisabledState@resource://gre/modules/XPIProvider.jsm:4432
AddonWrapper_userDisabledSetter@resource://gre/modules/XPIProvider.jsm:6672
set_userDisabled@chrome://mozapps/content/extensions/extensions.xml:1060
oncommand@about:addons:1

Step to reproduce:
- Install a jetpack add-on, or run `cfx run` with a simple add-on
- from `about:addons`, press disable button
- from `about:addons`, press enable button

The exception is raised and the add-on won't be enabled.

Note:
- The same happens even if the browser start with the jetpack add-on already disabled, and then we try to enable it.
- Restartless add-on that doesn't use SDK seems work just fine.
I hit this same bug on Fennec. This fixes it.

There's probably a few places this could be changed, but this seemed reasonable to me.
Comment on attachment 8380813 [details] [diff] [review]
DontModifyFrozenFunctions.patch

Nit: We use two space indent. But I'll correct that when I apply it to github.
Attachment #8380813 - Flags: review+
i think there should be a test for this, as it seems like a thing that could easily be break again by some other patch..
Flags: needinfo?(dtownsend+bugmail)
Commit pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/b62a63735667a653ece26f10b5351b7f0560179a
Bug 970280: Don't attempt to clear the prototype on frozen functions. r=Mossop
(In reply to Tomislav Jovanovic [:zombie] from comment #3)
> i think there should be a test for this, as it seems like a thing that could
> easily be break again by some other patch..

I agree but I wanted to get the fix in quickly. Any ideas how to do a test for this?
Flags: needinfo?(dtownsend+bugmail)
i think we can generate a simpe xpi manually, stick it in /test/fixtures, and try to load, disable, re-enable it via the AddonManager.

although Erik might have a better idea?
Flags: needinfo?(evold)
(In reply to Tomislav Jovanovic [:zombie] from comment #6)
> i think we can generate a simpe xpi manually, stick it in /test/fixtures,
> and try to load, disable, re-enable it via the AddonManager.
> 
> although Erik might have a better idea?

Ya I was against using xpis at first, but we do this plenty in m-c and after we have native jetpacks it won't be as much of an issue going forward, plus we'll still have to use xpis to regression test the old school jetpacks.
Flags: needinfo?(evold)
Murph, Tomislav, does one of you want to put together a test here?
Flags: needinfo?(tomica+amo)
Flags: needinfo?(murph)
I'll do it if Tomislav doesn't want to, but it might take me a day or two and some prodding people on IRC. I've only tried to run the existing tests once, and they didn't work on my setup yet.
Flags: needinfo?(murph)
Murph: the bug is yours. take good care of it..
Assignee: nobody → murph
Status: NEW → ASSIGNED
Flags: needinfo?(tomica+amo)
OS: Mac OS X → All
Hardware: x86 → All
Matteo: Do you remember how you got this error? I've only reproduced it so far on mobile.

I tried with the nightly from 2/10 and a simple addon via cfx run and it doesn't reproduce. I'm not sure if you were using a different version/channel, or if your addon was doing something interesting?
Flags: needinfo?(zer0)
Murph, you can reproduce the bug with the steps I mentioned in the first comment. It is always reproducible. Be sure that you do not have the fix in your repo, and run cfx with `-o` flag.
Flags: needinfo?(zer0)
Priority: -- → P1
Summary: Add-on cannot be enabled after disabling them: Bootstrap error: "prototype" is read-only → Test that an add-on can be enabled after disabling them
Priority: P1 → --
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: