Closed Bug 1343583 Opened 7 years ago Closed 7 years ago

Adapt test framework to function toString revision (Bug 1317400)

Categories

(WebExtensions :: General, enhancement, P1)

enhancement

Tracking

(firefox54 fixed)

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: zombie, Assigned: zombie)

References

Details

Attachments

(2 files)

See bug 1317400, in short:

object methods' toString produces code that can't be evaluated directly.  So instead of changing all of our tests [1], we should just adapt our test framework.

1) https://bugzilla.mozilla.org/attachment.cgi?id=8841177&action=diff
Assignee: nobody → tomica
Blocks: 1317400
Status: NEW → ASSIGNED
Priority: -- → P1
Comment on attachment 8842627 [details]
Bug 1343583 - Adapt test framework to function toString revision

https://reviewboard.mozilla.org/r/116400/#review118028

::: toolkit/components/extensions/ExtensionTestCommon.jsm:283
(Diff revision 1)
>            zipW.addEntryDirectory(path, time, false);
>          }
>        }
>      }
>  
> +    function serialize(code) {

I'm guessing we don't have an easy way to share this between the test frameworks, or otherwise we wouldn't be duplicating all this?
Comment on attachment 8842645 [details]
Bug 1343583 - Fix individual tests for function toString revision

https://reviewboard.mozilla.org/r/116408/#review118046

::: browser/components/extensions/test/browser/browser_ext_browserAction_context.js:178
(Diff revision 1)
>        "default-2.png": imageBuffer,
>        "1.png": imageBuffer,
>        "2.png": imageBuffer,
>      },
>  
> -    getTests(tabs, expectDefaults) {
> +    getTests: function(tabs, expectDefaults) {

All these don't go though the test framework, so need to be fixed by hand.
Attachment #8842627 - Flags: review?(aswan)
Attachment #8842645 - Flags: review?(aswan)
Comment on attachment 8842627 [details]
Bug 1343583 - Adapt test framework to function toString revision

https://reviewboard.mozilla.org/r/116400/#review118080

::: testing/mochitest/tests/SimpleTest/ExtensionTestUtils.js:90
(Diff revision 1)
>  
>    // Mimic serialization of functions as done in `Extension.generateXPI` and
>    // `Extension.generateZipFile` because functions are dropped when `ext` object
>    // is sent to the main process via the message manager.
> +
> +  function serialize(code) {

nit: can you name this serializeScript or something just to be clear what it does
Attachment #8842627 - Flags: review?(aswan) → review+
Comment on attachment 8842645 [details]
Bug 1343583 - Fix individual tests for function toString revision

https://reviewboard.mozilla.org/r/116408/#review118084
Attachment #8842645 - Flags: review?(aswan) → review+
Comment on attachment 8842627 [details]
Bug 1343583 - Adapt test framework to function toString revision

https://reviewboard.mozilla.org/r/116400/#review118028

> I'm guessing we don't have an easy way to share this between the test frameworks, or otherwise we wouldn't be duplicating all this?

We do. Just add it to ExtensionTestCommon and import that from the other places you need to use it.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/3b9e06e3d9b8
Adapt test framework to function toString revision r=aswan
https://hg.mozilla.org/integration/autoland/rev/10fccfc11db1
Fix individual tests for function toString revision r=aswan
Keywords: checkin-needed
Flags: needinfo?(tomica)
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/b93c92e29ed6
Adapt test framework to function toString revision r=aswan
https://hg.mozilla.org/integration/autoland/rev/b46002a33c2c
Fix individual tests for function toString revision r=aswan
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/b93c92e29ed6
https://hg.mozilla.org/mozilla-central/rev/b46002a33c2c
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.