Closed
Bug 1197507
Opened 9 years ago
Closed 9 years ago
Mochitest support for WebExtensions
Categories
(WebExtensions :: Untriaged, defect)
WebExtensions
Untriaged
Tracking
(firefox43 fixed)
RESOLVED
FIXED
mozilla43
Tracking | Status | |
---|---|---|
firefox43 | --- | fixed |
People
(Reporter: billm, Assigned: billm)
References
Details
Attachments
(5 files, 3 obsolete files)
2.20 KB,
patch
|
gkrizsanits
:
review+
|
Details | Diff | Splinter Review |
4.75 KB,
patch
|
gkrizsanits
:
review+
|
Details | Diff | Splinter Review |
10.95 KB,
patch
|
gkrizsanits
:
review+
|
Details | Diff | Splinter Review |
5.87 KB,
patch
|
gkrizsanits
:
review+
|
Details | Diff | Splinter Review |
5.54 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
I wanted to get be able to use xpcshell tests for WebExtensions, but that turned out to be a lot of work. It's probably best to start with Mochitests since these run on all platforms including mobile. These will test code that currently lives in toolkit/. For the stuff in browser/, we'll probably want to use browser-chrome tests. The code here could perhaps be adapted for that.
Assignee | ||
Comment 1•9 years ago
|
||
I don't want to have to use chrome.* APIs in our tests, so I made this alias.
Attachment #8651396 -
Flags: review?(gkrizsanits)
Assignee | ||
Comment 2•9 years ago
|
||
I would like to be able to load extensions off HTTP for testing, since all Mochitest files are loaded through HTTP as far as I know. I don't think adding HTTP here should be a problem since it doesn't grant any special privileges to the resource. We won't use this in production code.
Attachment #8651397 -
Flags: review?(bobbyholley)
Assignee | ||
Comment 3•9 years ago
|
||
This API is similar to an internal one that Chrome has. It allows extensions to communicate with test harness code. I used an event emitter to take care of the actual communication. The other endpoint is in a later patch.
Attachment #8651398 -
Flags: review?(gkrizsanits)
Assignee | ||
Comment 4•9 years ago
|
||
This does what it says.
Attachment #8651399 -
Flags: review?(gkrizsanits)
Assignee | ||
Comment 5•9 years ago
|
||
This patch has some test examples. I'm going to post a more substantial test in bug 1190330.
Attachment #8651400 -
Flags: review?(gkrizsanits)
Comment 6•9 years ago
|
||
Comment on attachment 8651397 [details] [diff] [review]
allow HTTP resources in moz-extension: substitutions
These URIs claim URI_IS_LOCAL_FILE - isn't that a problem?
We could probably use nsIProtocolHandlerWithDynamicFlags to solve this, but this patch doesn't do that...
Attachment #8651397 -
Flags: review?(bobbyholley)
Assignee | ||
Comment 7•9 years ago
|
||
OK. I assume you meant URI_IS_LOCAL_RESOURCE since these handlers don't claim URI_IS_LOCAL_FILE. I hope I didn't go overboard here. It's a bit hard to understand all the things this flag is used for.
If you're worried about EnsureFile, I think we're covered there:
http://mxr.mozilla.org/mozilla-central/source/netwerk/base/nsStandardURL.cpp#1823
Attachment #8651397 -
Attachment is obsolete: true
Attachment #8651438 -
Flags: review?(bobbyholley)
Assignee | ||
Comment 8•9 years ago
|
||
This makes the default be to not allow the chrome: scheme.
Attachment #8651438 -
Attachment is obsolete: true
Attachment #8651438 -
Flags: review?(bobbyholley)
Attachment #8651455 -
Flags: review?(bobbyholley)
Updated•9 years ago
|
Attachment #8651396 -
Flags: review?(gkrizsanits) → review+
Updated•9 years ago
|
Attachment #8651398 -
Flags: review?(gkrizsanits) → review+
Comment 9•9 years ago
|
||
Comment on attachment 8651399 [details] [diff] [review]
allow mochitests to load WebExtensions via special powers
Review of attachment 8651399 [details] [diff] [review]:
-----------------------------------------------------------------
If loading the extension fails, will the reason for the failure be visible somewhere (console, try log)? I guess it will be but I have seen some swallowed up exceptions over the years, so I was wondering. Another thing is that I'm missing some kind of load/startup failed hook, in case something goes wrong to avoid test hangs. I don't want to hold up landing this patch it's already great as it is, we can do a follow-up for that hook if you agree with it or let me know if there is a good reason why such additional hook is not needed.
Attachment #8651399 -
Flags: review?(gkrizsanits) → review+
Comment 10•9 years ago
|
||
Comment on attachment 8651400 [details] [diff] [review]
simple tests
Review of attachment 8651400 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/components/extensions/test/mochitest/mochitest.ini
@@ +16,5 @@
> + file_script_redirect.js
> + file_script_xhr.js
> +
> +[test_simple_extensions.html]
> +[test_extension_webrequest.html]
this should go to the other patch
Attachment #8651400 -
Flags: review?(gkrizsanits) → review+
Comment 11•9 years ago
|
||
Comment on attachment 8651455 [details] [diff] [review]
allow HTTP resources in moz-extension: substitutions v3
Review of attachment 8651455 [details] [diff] [review]:
-----------------------------------------------------------------
Per discussion, I think we should find a way to solve this problem in the test infrastructure.
Attachment #8651455 -
Flags: review?(bobbyholley) → review-
Assignee | ||
Comment 12•9 years ago
|
||
Attachment #8651455 -
Attachment is obsolete: true
Attachment #8652431 -
Flags: review?(bobbyholley)
Updated•9 years ago
|
Attachment #8652431 -
Flags: review?(bobbyholley) → review+
Comment 13•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/faa9493e9372
https://hg.mozilla.org/integration/mozilla-inbound/rev/1706813276e7
https://hg.mozilla.org/integration/mozilla-inbound/rev/e31c9124bd22
https://hg.mozilla.org/integration/mozilla-inbound/rev/2b875b229533
https://hg.mozilla.org/integration/mozilla-inbound/rev/91e5acc46643
Assignee | ||
Comment 14•9 years ago
|
||
Oops. The last patch landed with the wrong bug number. 91e5acc46643 is actually bug 1190330.
Comment 15•9 years ago
|
||
Comment 16•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/faa9493e9372
https://hg.mozilla.org/mozilla-central/rev/1706813276e7
https://hg.mozilla.org/mozilla-central/rev/e31c9124bd22
https://hg.mozilla.org/mozilla-central/rev/2b875b229533
https://hg.mozilla.org/mozilla-central/rev/91e5acc46643
https://hg.mozilla.org/mozilla-central/rev/7d17c55a8323
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox43:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•