Closed Bug 1251412 Opened 7 years ago Closed 7 years ago

Fix the addon-sdk tests to pass with add-on signing

Categories

(Release Engineering :: General, defect)

defect
Not set
normal

Tracking

(firefox46 fixed, firefox47 fixed)

RESOLVED FIXED
Tracking Status
firefox46 --- fixed
firefox47 --- fixed

People

(Reporter: andy+bugzilla, Assigned: aswan)

References

Details

Attachments

(1 file)

Mossop: During the build process we use cfx to build these add-ons https://dxr.mozilla.org/mozilla-central/source/addon-sdk/source/test/addons
Mossop: Then they get loaded in the harness: https://dxr.mozilla.org/mozilla-central/source/testing/mochitest/jetpack-addon-harness.js#30
Mossop: Either checking in built versions that are signed or switching the harness to use loadTemporaryAddon would fix those tests

andym: cfx add-ons can't be signed through AMO, if we can use loadTemporaryAddon that's probably the easiest step
Comment on attachment 8723837 [details]
MozReview Request: Bug 1251412 - use installTemporaryAddon for jetpack-addons tests

This patch implements the basic mechanics but it causes several new failures and a noisy warning.
The failures are:
https://dxr.mozilla.org/mozilla-central/rev/d848a5628d801a460a7244cbcdea22d328d8b310/addon-sdk/source/test/addons/main/main.js#17
With the temporary install, the loadReason is "enable" instead of "install" as the test expects.

https://dxr.mozilla.org/mozilla-central/rev/d848a5628d801a460a7244cbcdea22d328d8b310/addon-sdk/source/test/addons/unpacked/main.js#10
With the temporary install, packed is true, instead of false as the test expects

https://dxr.mozilla.org/mozilla-central/rev/d848a5628d801a460a7244cbcdea22d328d8b310/addon-sdk/source/test/addons/unpacked/main.js#14
With the temporary install, toFilename now throws this error:
Error: cannot map to filename: resource://test-url-at-jetpack/unpacked/lib/main.js

I suspect the first is actually undesirable for temporary installs and should be fixed, that we should change the test expectation for the second, and I have no idea about the third.

In addition to those, we also get these warnings every time an addon is installed:
1456444058018	addons.manager	WARN	AddonListener threw exception when calling onInstalled: TypeError: that.sandboxes[sandboxName] is undefined (chrome://marionette/content/driver.js:1090:1) JS Stack trace: GeckoDriver.prototype.executeWithCallback/res</chromeAsyncReturnFunc@driver.js:1090:1 < __marionetteFunc/listener.onInstalled@addons.py:13:19 < AddonManagerInternal.callAddonListeners@AddonManager.jsm:1723:11 < this.AddonManagerPrivate.callAddonListeners@AddonManager.jsm:2832:5 < this.XPIProvider.installTemporaryAddon<@XPIProvider.jsm:3879:5

I got lost after a few minutes of trying to figure out what the marionette driver is, I can go back to it and spend more time if nothing jumps out as you.

But overall, looking for some guidance on how to handle each of those...
Flags: needinfo?(dtownsend)
(In reply to Andrew Swan [:aswan] from comment #2)
> Comment on attachment 8723837 [details]
> MozReview Request: Bug 1251412 - use installTemporaryAddon for
> jetpack-addons tests
> 
> This patch implements the basic mechanics but it causes several new failures
> and a noisy warning.
> The failures are:
> https://dxr.mozilla.org/mozilla-central/rev/
> d848a5628d801a460a7244cbcdea22d328d8b310/addon-sdk/source/test/addons/main/
> main.js#17
> With the temporary install, the loadReason is "enable" instead of "install"
> as the test expects.

Yeah this sounds like a bug we should fix. Can you file a follow-up? For now just comment out that check so we can get this landed.

> https://dxr.mozilla.org/mozilla-central/rev/
> d848a5628d801a460a7244cbcdea22d328d8b310/addon-sdk/source/test/addons/
> unpacked/main.js#10
> With the temporary install, packed is true, instead of false as the test
> expects
> 
> https://dxr.mozilla.org/mozilla-central/rev/
> d848a5628d801a460a7244cbcdea22d328d8b310/addon-sdk/source/test/addons/
> unpacked/main.js#14
> With the temporary install, toFilename now throws this error:
> Error: cannot map to filename:
> resource://test-url-at-jetpack/unpacked/lib/main.js

This test verifies that the add-on is unpacked on install and we don't do that for temporary add-ons. In fact we should probably do a follow-up bug that refuses to load an add-on temporarily if it is marked to be unpacked. Can you file that too please? Let's just disable this test, It is really verifying cfx's behaviour here not the SDK and we don't support cfx any more so I don't think it is worth trying to get this test working.
Flags: needinfo?(dtownsend)
(In reply to Andrew Swan [:aswan] from comment #2)
> In addition to those, we also get these warnings every time an addon is
> installed:
> 1456444058018	addons.manager	WARN	AddonListener threw exception when calling
> onInstalled: TypeError: that.sandboxes[sandboxName] is undefined
> (chrome://marionette/content/driver.js:1090:1) JS Stack trace:
> GeckoDriver.prototype.executeWithCallback/res</chromeAsyncReturnFunc@driver.
> js:1090:1 < __marionetteFunc/listener.onInstalled@addons.py:13:19 <
> AddonManagerInternal.callAddonListeners@AddonManager.jsm:1723:11 <
> this.AddonManagerPrivate.callAddonListeners@AddonManager.jsm:2832:5 <
> this.XPIProvider.installTemporaryAddon<@XPIProvider.jsm:3879:5

Andrew, do you know anything about this?
Flags: needinfo?(ahalberstadt)
Ah, I think we need to insert an "AddonManager.removeListener(listener);" call here:
https://dxr.mozilla.org/mozilla-central/source/testing/marionette/driver/marionette_driver/addons.py#68

Want me to file a bug and tackle it separately? Or want to just roll it into this patch?
Flags: needinfo?(ahalberstadt)
Andrew H, since the Marionette fix is really distinct from the changes for this bug and this bug isn't really blocked on the the Marionette fix, I'd vote for a separate bug and patch.
Comment on attachment 8723837 [details]
MozReview Request: Bug 1251412 - use installTemporaryAddon for jetpack-addons tests

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/36763/diff/1-2/
Attachment #8723837 - Flags: review?(dtownsend)
Comment on attachment 8723837 [details]
MozReview Request: Bug 1251412 - use installTemporaryAddon for jetpack-addons tests

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/36763/diff/2-3/
Alright, with the latest patch, "mach mochitest -f jetpack-addon addon-sdk/source/test" passes both with and without signing enabled.
Follow-up bugs are
Bug 1251664 - With temporary add-on installation, options.loadReason is "enable" instead of "install" 
Bug 1251673 - Don't allow temporary installation of add-ons that require unpacking
Depends on: 1251692
Comment on attachment 8723837 [details]
MozReview Request: Bug 1251412 - use installTemporaryAddon for jetpack-addons tests

https://reviewboard.mozilla.org/r/36763/#review33499

Nice, thanks
Attachment #8723837 - Flags: review?(dtownsend) → review+
https://hg.mozilla.org/mozilla-central/rev/304c2876b1a2
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Component: General Automation → General
You need to log in before you can comment on or make changes to this bug.