Closed
Bug 1182486
Opened 9 years ago
Closed 9 years ago
Execute all the mochitests into a serviceWorker
Categories
(Core :: DOM: Service Workers, defect)
Core
DOM: Service Workers
Tracking
()
RESOLVED
INVALID
Tracking | Status | |
---|---|---|
firefox42 | --- | affected |
People
(Reporter: baku, Assigned: baku)
Details
Attachments
(1 file, 1 obsolete file)
8.74 KB,
patch
|
ehsan.akhgari
:
feedback+
|
Details | Diff | Splinter Review |
this is a prototype... maybe it works.
Attachment #8632106 -
Flags: review?(ehsan)
Comment 1•9 years ago
|
||
Is there a particular thing you're trying to test with this change?
Comment 2•9 years ago
|
||
Comment on attachment 8632106 [details] [diff] [review]
test.patch
Review of attachment 8632106 [details] [diff] [review]:
-----------------------------------------------------------------
Note that you should probably ask Ted to review the test harness changes.
::: dom/workers/ServiceWorkerManager.cpp
@@ +1038,5 @@
> }
> }
>
> + if (!Preferences::GetBool("dom.serviceWorkers.testing.enabled") &&
> + !StringBeginsWith(mRegistration->mScope, maxPrefix)) {
Please don't do this! The right way to get a SW loaded from /static/serviceworker.js to control / is to send a Service-Worker-Allowed header. See the examples in the existing tests in the tree that I have added.
::: testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ +1560,5 @@
> SimpleTest.executeSoon(SimpleTest.finish);
> }
> };
> +
> +var forcedServiceWorkers = SpecialPowers.getBoolPref("dom.serviceworkers.mochitest");
I think you want to do this work once in TestRunner.js when the test framework starts.
Attachment #8632106 -
Flags: review?(ehsan) → review-
Comment 3•9 years ago
|
||
(In reply to Ben Kelly [:bkelly] from comment #1)
> Is there a particular thing you're trying to test with this change?
Making it possible to run all mochitests using a transparent proxy service worker through ./mach mochitest --serviceworker or some such.
We're hoping to use this to do some mass testing on what happens in all of our existing tests in the presence of a service worker.
Updated•9 years ago
|
Component: DOM → DOM: Service Workers
Assignee | ||
Comment 4•9 years ago
|
||
Attachment #8632106 -
Attachment is obsolete: true
Attachment #8632177 -
Flags: review?(ehsan)
Updated•9 years ago
|
Assignee: nobody → amarchesini
Comment 5•9 years ago
|
||
Comment on attachment 8632177 [details] [diff] [review]
test.patch
Review of attachment 8632177 [details] [diff] [review]:
-----------------------------------------------------------------
::: testing/mochitest/server.js
@@ +368,5 @@
> +function serverServiceWorker(metadata, response)
> +{
> + response.setStatusLine("1.1", 200, "OK");
> + response.setHeader("Content-type", "application/javascript;charset=utf-8", false);
> + response.setHeader("Service-Worker-Allowed", "/", false);
Hmm, I wonder if you could use a ^headers^ file to not have to do this manually...
Attachment #8632177 -
Flags: review?(ted)
Attachment #8632177 -
Flags: review?(ehsan)
Attachment #8632177 -
Flags: feedback+
Comment 6•9 years ago
|
||
Comment on attachment 8632177 [details] [diff] [review]
test.patch
Review of attachment 8632177 [details] [diff] [review]:
-----------------------------------------------------------------
::: testing/mochitest/server.js
@@ +368,5 @@
> +function serverServiceWorker(metadata, response)
> +{
> + response.setStatusLine("1.1", 200, "OK");
> + response.setHeader("Content-type", "application/javascript;charset=utf-8", false);
> + response.setHeader("Service-Worker-Allowed", "/", false);
Yeah, I think you can do that. That would be a lot nicer.
::: testing/mochitest/serviceworkers/sw.js
@@ +1,2 @@
> +onfetch = function(e) {
> + dump("*** Request received! " + e.request.url + "\n\n");
Are these dumps going to wind up in the log? That seems like it'd be really spammy.
::: testing/mochitest/tests/SimpleTest/TestRunner.js
@@ +554,5 @@
> +
> + SpecialPowers.pushPrefEnv({"set": [
> + ["dom.serviceWorkers.enabled", true],
> + ["dom.serviceWorkers.testing.enabled", true],
> + ["dom.serviceWorkers.interception.enabled", true]
Could we just always enable these in the mochitest profile? Would they hurt anything for normal mochitest runs? That would simplify this a bit.
Attachment #8632177 -
Flags: review?(ted)
Comment 7•9 years ago
|
||
(In reply to (on vacation July 18- 25) Ted Mielczarek [:ted.mielczarek] from comment #6)
> ::: testing/mochitest/tests/SimpleTest/TestRunner.js
> @@ +554,5 @@
> > +
> > + SpecialPowers.pushPrefEnv({"set": [
> > + ["dom.serviceWorkers.enabled", true],
> > + ["dom.serviceWorkers.testing.enabled", true],
> > + ["dom.serviceWorkers.interception.enabled", true]
>
> Could we just always enable these in the mochitest profile? Would they hurt
> anything for normal mochitest runs? That would simplify this a bit.
I think that will affect default mochitest runs, no? That seems undesirable.
Comment 8•9 years ago
|
||
That's why I asked, I don't actually know what those prefs do. Do they have an effect if you aren't actively using ServiceWorkers?
Comment 9•9 years ago
|
||
(In reply to (on vacation July 18- 25) Ted Mielczarek [:ted.mielczarek] from comment #8)
> That's why I asked, I don't actually know what those prefs do. Do they have
> an effect if you aren't actively using ServiceWorkers?
They do expose the service worker APIs that are currently only enabled on non-release builds unconditionally for one thing!
Assignee | ||
Comment 10•9 years ago
|
||
We don't want to have this anymore.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•