Closed Bug 1182486 Opened 9 years ago Closed 9 years ago

Execute all the mochitests into a serviceWorker

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID
Tracking Status
firefox42 --- affected

People

(Reporter: baku, Assigned: baku)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch test.patch (obsolete) — Splinter Review
this is a prototype... maybe it works.
Attachment #8632106 - Flags: review?(ehsan)
Is there a particular thing you're trying to test with this change?
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-
(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.
Component: DOM → DOM: Service Workers
Attached patch test.patchSplinter Review
Attachment #8632106 - Attachment is obsolete: true
Attachment #8632177 - Flags: review?(ehsan)
Assignee: nobody → amarchesini
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 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)
(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.
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?
(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!
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.

Attachment

General

Created:
Updated:
Size: