Commit Graph

2052 Commits

Author SHA1 Message Date
Andrea Marchesini
a995af775c Bug 1185640 - Passing a scope or scriptURL to register() with escaped '/' or '\' should fail, r=bkelly 2015-08-13 11:34:52 +01:00
Andrea Marchesini
2c3f840d0f Bug 1187470 - ServiceWorker scripts should not be treated parser warnings as errors, r=bkelly 2015-08-13 10:52:15 +01:00
Albert Crespell
6866b9f227 Bug 1182120 - Test XMLDocument.load() with fetch interception. r=bkelly 2015-08-12 06:43:27 +02:00
Andrea Marchesini
84edc33d6e Bug 1193414 - Telemetry for SharedWorker spawning. r=bkelly 2015-08-12 06:00:00 -04:00
Aryeh Gregor
2aab280bb3 Bug 874842 - Return Event instead of nsIDOMEvent 2015-08-12 14:39:31 +03:00
Seth Fowler
7222453f0e Bug 1193125 - Avoid corrupting image data in test_fetch_event.html. r=bkelly 2015-08-11 23:50:28 -07:00
Kyle Huey
0a62d4d460 Bug 1179909: Refactor stable state handling. r=smaug
This is motivated by three separate but related problems:

1. Our concept of recursion depth is broken for things that run from AfterProcessNextEvent observers (e.g. Promises). We decrement the recursionDepth counter before firing observers, so a Promise callback running at the lowest event loop depth has a recursion depth of 0 (whereas a regular nsIRunnable would be 1). This is a problem because it's impossible to distinguish a Promise running after a sync XHR's onreadystatechange handler from a top-level event (since the former runs with depth 2 - 1 = 1, and the latter runs with just 1).

2. The nsIThreadObserver mechanism that is used by a lot of code to run "after" the current event is a poor fit for anything that runs script. First, the order the observers fire in is the order they were added, not anything fixed by spec. Additionally, running script can cause the event loop to spin, which is a big source of pain here (bholley has some nasty bug caused by this).

3. We run Promises from different points in the code for workers and main thread. The latter runs from XPConnect's nsIThreadObserver callbacks, while the former runs from a hardcoded call to run Promises in the worker event loop. What workers do is particularly problematic because it means we can't get the right recursion depth no matter what we do to nsThread.

The solve this, this patch does the following:

1. Consolidate some handling of microtasks and all handling of stable state from appshell and WorkerPrivate into CycleCollectedJSRuntime.
2. Make the recursionDepth counter only available to CycleCollectedJSRuntime (and its consumers) and remove it from the nsIThreadInternal and nsIThreadObserver APIs.
3. Adjust the recursionDepth counter so that microtasks run with the recursionDepth of the task they are associated with.
4. Introduce the concept of metastable state to replace appshell's RunBeforeNextEvent. Metastable state is reached after every microtask or task is completed. This provides the semantics that bent and I want for IndexedDB, where transactions autocommit at the end of a microtask and do not "spill" from one microtask into a subsequent microtask. This differs from appshell's RunBeforeNextEvent in two ways:
a) It fires between microtasks, which was the motivation for starting this.
b) It no longer ensures that we're at the same event loop depth in the native event queue. bent decided we don't care about this.
5. Reorder stable state to happen after microtasks such as Promises, per HTML. Right now we call the regular thread observers, including appshell, before the main thread observer (XPConnect), so stable state tasks happen before microtasks.
2015-08-11 06:10:46 -07:00
Ben Kelly
63773e3e01 Bug 1192986 Also mark Cache/CacheStorage as release interfaces on workers. r=ehsan a=bustage 2015-08-10 19:49:22 -07:00
Andrea Marchesini
20e9fd146e Bug 1186307 - part 2 - Compilation failures fixed, CLOSED TREE 2015-08-10 17:28:43 +01:00
Andrea Marchesini
a45672d18c Bug 1186307 - part 1 - Unify the StructuredCloneCallbacks in WorkerPrivate.cpp, r=smaug 2015-08-10 16:33:23 +01:00
Ben Kelly
ab6a144621 Bug 983301 Add a test for FetchEvent.respondWith(5). r=bz 2015-08-06 18:12:14 -07:00
Nikhil Marathe
e07ab7e6b0 Bug 1153499 - Enable push and sw prefs. r=dougt,ehsan 2015-07-15 13:12:44 -07:00
Nikhil Marathe
65e018606b Bug 1144660 - client.focus() adds window interaction checks and directly uses DOMServiceWorkerFocusClient to focus window. r=ehsan,dao
client.focus() now directly uses the DOMServiceWorkerFocusClient event. The
platform popup checking is not available on service workers. Instead each
worker maintains a counter of if it is allowed to interact with windows. This
counter is currently only incremented by the notificationclick event and
dropped after the event has been dispatched.

Since acquiring a client is an async operation most service workers will
perform in notificationclick, an additional extension is granted after the event
during which the service worker may focus a client. This extension is only granted
if the script invokes NotificationEvent.waitUntil() at which point the timer begins.
The extension is terminated when the Promise passed to waitUntil() is fulfilled, or
the timer expires, whichever comes first.
2015-07-23 08:30:27 -07:00
Nikhil Marathe
002018a6ff Bug 1144660 - Make KeepAliveHandler threadsafe refcounted. r=ehsan
This works because KeepAliveHandler only holds nsMainThreadPtrHolder<> which is
itself thread safe.  It has assertions that the PromiseNativeHandler overrides
are only called on the worker and these assertions are satisfied.
2015-08-05 20:58:10 -07:00
Carsten "Tomcat" Book
1d153d6c6e Backed out 1 changesets (bug 1153499) for test failures in browser_force_refresh.js
Backed out changeset 252814d5e628 (bug 1153499)
2015-08-06 09:47:38 +02:00
Nikhil Marathe
457824590b Bug 1153499 - Enable push and sw prefs. r=dougt,ehsan 2015-07-15 13:12:44 -07:00
Wes Kocher
b0c434c39d Backed out 3 changesets (bug 1191495, bug 1153499, bug 1144660) for mochitest-push crashes
Backed out changeset 8917e7323399 (bug 1191495)
Backed out changeset 13ed6f60d3f9 (bug 1144660)
Backed out changeset 95bd6642e4b1 (bug 1153499)
2015-08-05 15:18:05 -07:00
Nikhil Marathe
6c8e7e2ae9 Bug 1190703 - Relax scope resolution assertion in ServiceWorkerContainer::Register. r=bkelly 2015-08-05 14:33:50 -07:00
Nikhil Marathe
f7800da93c Bug 1144660 - client.focus() adds window interaction checks and directly uses DOMServiceWorkerFocusClient to focus window. r=ehsan,dao
client.focus() now directly uses the DOMServiceWorkerFocusClient event. The
platform popup checking is not available on service workers. Instead each
worker maintains a counter of if it is allowed to interact with windows. This
counter is currently only incremented by the notificationclick event and
dropped after the event has been dispatched.

Since acquiring a client is an async operation most service workers will
perform in notificationclick, an additional extension is granted after the event
during which the service worker may focus a client. This extension is only granted
if the script invokes NotificationEvent.waitUntil() at which point the timer begins.
The extension is terminated when the Promise passed to waitUntil() is fulfilled, or
the timer expires, whichever comes first.
2015-07-23 08:30:27 -07:00
Nikhil Marathe
39493facc0 Bug 1153499 - Enable push and sw prefs. r=dougt,ehsan 2015-07-15 13:12:44 -07:00
Nikhil Marathe
cfbab4cece Bug 1190478 - Hide PushEvent.data until we ship message encryption. r=mt,jst 2015-08-03 11:04:41 -07:00
Fernando Jimenez
90ddd7ab23 Bug 1180148 - Clear service workers registered for a site when clearing the cookies and stored data is not working in b2g. r=baku 2015-08-03 22:51:07 +02:00
Nikhil Marathe
e9d71f7375 Bug 1183954 - Fix Notification.data structured cloning on workers. r=robertbindar,mccr8
Rather than store a non-thread-safe refcounted nsIStructuredCloneContainer, store the base64 representation.
Caches a jsval the first time an attempt to access data is made from content script.
2015-07-30 12:44:14 -07:00
Boris Zbarsky
2b193a0d99 Bug 983301 part 2. Change Promise to not be distinguishable from any other type. r=peterv 2015-07-31 13:30:55 -04:00
Kaku Kuo
6e4e851be6 Bug 1044102 - Part 3 - Support StructuredClone. r=baku 2015-07-30 20:50:00 +02:00
Kaku Kuo
fa3a35c345 Bug 1044102 - Part 1 - Implement ImageBitmap. r=roc, sr=smaug 2015-07-30 20:47:00 +02:00
Kaku Kuo
d304622253 Bug 1044102 - Part 0 - Test cases. r=smaug. 2015-07-30 20:45:00 +02:00
Andrea Marchesini
9941514a28 Bug 1188265 - No manual JS_ClearPendingException when StructuredCloneHelper is used, r=smaug 2015-07-31 01:38:00 +01:00
Wes Kocher
9b80d96625 Backed out changeset 2bdaed564656 (bug 1125961) for b2g emulator mochitest-21 failures starting in test_fetch_event_client_postmessage.html 2015-07-30 14:53:38 -07:00
Josh Matthews
8d12a449ea Bug 1125961 - Allow sending null PBrowser actors when there's a triggering principal which can be used for security checks. r=bkelly,ddamjano 2015-06-03 15:07:42 -04:00
Ehsan Akhgari
36fbc5405b Bug 1188062 - Unship Request.context; r=baku 2015-07-30 08:14:00 -04:00
Ehsan Akhgari
68342b6b61 Bug 1188091 - Fix the exposure of Push interfaces; r=dougt,bzbarsky,nsm
Currently we don't check the dom.push.enabled pref in some cases for
some of these interfaces.  This patch unifies how all of these
interfaces are exposed to Window, Worker, and ServiceWorker.
2015-07-30 01:06:38 -04:00
Andrea Marchesini
489b618a01 Bug 1185820 - XMLHttpRequest::Open() in worker should count the recursion using a uint32_t and not a boolean. r=khuey 2015-07-29 16:10:15 -04:00
Bobby Holley
59c4d9cf6c Bug 1188696 - Hoist nsRefPtr.h into MFBT. r=froydnj 2015-07-29 10:44:59 -07:00
Kyle Huey
b8b7f7f776 Bug 1158031: Don't return empty arrays from MultiPartBlobImpl::GetSubBlobImpls(). r=baku 2015-07-28 15:59:56 -07:00
Kyle Huey
7fe1fde596 Bug 1188141: Make Worker error events not bubble. r=baku 2015-07-28 15:59:55 -07:00
Kyle Huey
9f729a1eb8 Bug 1188115: Expose IDBCursorWithValue in workers. r=baku 2015-07-28 15:59:55 -07:00
Francisco Jordano
305daeee69 Bug 1186880 - Performance timing api in workers should output entries if preference is enabled. r=baku 2015-07-28 17:33:37 +01:00
Ryan VanderMeulen
50d519f161 Backed out changeset c88d1138bc38 (bug 1188091) for Mulet test_serviceworker_interfaces.html failures.
CLOSED TREE
2015-07-28 13:28:39 -04:00
Ehsan Akhgari
1ebf85a7c8 Bug 1188091 - Fix the exposure of Push interfaces; r=dougt,bzbarsky
Currently we don't check the dom.push.enabled pref in some cases for
some of these interfaces.  This patch unifies how all of these
interfaces are exposed to Window, Worker, and ServiceWorker.
2015-07-28 12:28:53 -04:00
Andrea Marchesini
d5fb31ae84 Bug 1184995 - StructuredCloneHelper for BroadcastChannel and DataStore, r=smaug 2015-07-28 08:38:16 +01:00
dimi
4d9c3f6026 Bug 1158735 - FetchEvent.client asserting in onFetch when there's no document. r=bkelly 2015-07-27 19:01:37 +08:00
Anup Kumar
f9d8ec04fb Bug 1171941 - Removed an incorrect URL prefix from fetch_tests.js. r=jdm 2015-07-25 08:44:00 +02:00
Eitan Isaacson
bb2cf399f8 Bug 1184626 - Add a per-process push message listener. r=smaug 2015-07-17 14:54:38 -07:00
Nikhil Marathe
ad3e15032d Bug 1184574 - Allow access to PushManager on ServiceWorker. r=kitcambridge,smaug,catalinb
Refactoring to allow access to PushManager in ServiceWorkerGlobalScope. See comment in PushManager.h for details.
2015-07-23 08:30:15 -07:00
Josh Matthews
09e7c40780 Bug 1186589 - Ensure CORS preflight requests are never intercepted. r=sicking 2015-07-23 10:25:12 -04:00
Boris Zbarsky
1d8dfc5c28 Bug 1186489. Apply the performance.now() resolution clamping in workers as well. r=froydnj 2015-07-22 13:22:16 -04:00
Andrew McCreight
a495d23e46 Bug 1176341 - De-holder nsIXPConnect::CreateSandbox. r=baku,gabor 2015-07-21 11:31:44 -07:00
Ryan VanderMeulen
13755b4c04 Backed out changeset 553a3e1e7b18 (bug 1176341) for bustage.
CLOSED TREE
2015-07-21 13:00:55 -04:00
Andrew McCreight
c38a7a94b3 Bug 1176341 - De-holder nsIXPConnect::CreateSandbox. r=baku,gabor 2015-07-21 09:44:37 -07:00
Ehsan Akhgari
a7a9cae381 Bug 1148030 - Correctly reflect object and embed RequestContext values; r=smaug
Note that these elements cannot be intercepted for now.  See bug
1168676 for the background.
2015-07-18 16:44:28 -04:00
Jan de Mooij
38d21aa34b Bug 1184564 part 2 - Use Value instead of jsval in dom/ and storage/. r=bz 2015-07-18 21:45:35 +02:00
Ehsan Akhgari
b5537d8000 Bug 1148044 - Correctly reflect frame and iframe RequestContext values; r=smaug 2015-07-18 13:18:06 -04:00
Olli Pettay
f304f3cc12 Bug 1183882, properly implement wrapper caching on PushMessageData, r=nsm 2015-07-18 01:17:14 +03:00
Kyle Huey
343f18704f Bug 1182316: Part 3 - Add assertions to most other WebIDL entry points, clean up nsIDOMJSWindow cruft. r=peterv 2015-07-16 22:10:35 -07:00
Jason Orendorff
a5a65b4e53 Bug 987514, part 3 - Make every global have a (usually empty) Reflect object; rename JS_InitReflect -> JS_InitReflectParse. r=Waldo.
The bit in MIRGenerator.h fixes a straight-up bug in the code, masked until now by unified builds (and unmasked because this patch adds a .cpp file, perturbing the unified build boundaries).
2014-11-04 21:41:43 -06:00
Ehsan Akhgari
3c071b865e Bug 1180275 - Part 2: Disable test_app_protocol.html in release builds; r=ferjm 2015-07-16 14:47:53 -04:00
Ryan VanderMeulen
22d77db0ae Backed out changesets 9a048b598b1e and 56e9597b1257 (bug 1180275) for OSX test_android_eclipse.py failures.
CLOSED TREE
2015-07-15 23:40:06 -04:00
Ehsan Akhgari
808a631e23 Bug 1180275 - Part 2: Disable test_app_protocol.html in release builds; r=ferjm 2015-07-15 20:00:00 -04:00
Ben Kelly
421933ed98 Bug 1181887 Fall back to network if ServiceWorker script fails to load. r=ehsan r=khuey 2015-07-15 12:21:40 -07:00
Olli Pettay
c29e236ad5 Bug 1183907, properly wrappercache worker URL object, r=baku 2015-07-15 14:50:59 +03:00
Nikhil Marathe
327f4e3a85 Bug 1183813 - PushEvent.data should be same instance every time. r=smaug 2015-07-14 13:10:58 -07:00
Eric Rahm
c8e90324c3 Bug 1183894 - Remove warning if MessagePort::CloseInternal is called before start. r=khuey 2015-07-14 18:06:32 -07:00
Catalin Badea
ed1068a522 Bug 1179685 - Fix messageport assert in wpt service worker test. r=baku 2015-07-14 17:41:13 -07:00
Andrea Marchesini
3091ea400a Bug 1160890 - Part 2: ImportScripts() should return muted errors with 3rd party scripts. r=smaug 2015-07-14 16:08:38 +01:00
Andrea Marchesini
4a9cc35b4e Bug 1160890 - Part 1: Remove unneeded code from ImportScripts(). r=smaug 2015-07-14 16:08:36 +01:00
Ben Kelly
1d6f011995 Bug 1173912 Fail opaque responses for client requests. r=ehsan 2015-07-14 13:11:26 -07:00
Ben Kelly
7d248a15f8 Bug 1173934 Show a message if a docshell fails to load due to SW intercept failure. r=ehsan r=jdm 2015-07-14 13:11:26 -07:00
Nikhil Marathe
4215e2e637 Bug 1114554 - Patch 8 - Support waitUntil() on notificationclick event. r=baku
This was originally a part of Bug 1160527, separated due to changes in order of landing the patches.
2015-06-25 18:50:26 -07:00
Nikhil Marathe
d99d4d842e Bug 1114554 - Patch 6 - ServiceWorkerRegistration.getNotifications() tests. r=wchen 2015-06-25 18:50:25 -07:00
Nikhil Marathe
2ce316e71c Bug 1114554 - Patch 5 - getNotifications() on worker thread. r=wchen 2015-06-25 18:50:25 -07:00
Nikhil Marathe
c82f6f8cc8 Bug 1114554 - Patch 4 - ServiceWorkerRegistration.getNotifications() on main thread. r=wchen 2015-06-25 18:50:25 -07:00
Nikhil Marathe
40af10ec0b Bug 1114554 - Patch 3 - Fire notificationclick event on ServiceWorkerGlobalScope. r=wchen,baku
Bug 1114554 - Patch 3.1 - ServiceWorker principal fixes. r=baku

Bug 1162088 introduced origin attributes that ServiceWorkerManager callers have to use. This patch updates notificationclick events to work.

Folded:
Hide NotificationEvent behind pref
2015-06-25 18:50:25 -07:00
Nikhil Marathe
d7c89d1814 Bug 1114554 - Patch 2 - ServiceWorkerRegistration.showNotification(). r=wchen,baku
Refactor creation and show dispatch so Notification constructor and showNotification can use it.
Move persistence to ShowInternal.
NotificationStorage calls callback async even when fetching from cache, simply to have similar semantics.
Calls to Notification::Get() are performed async since persistence is now async after being moved to ShowInternal().
Both are in accordance with the spec where the "append to list of notifications" operation is performed in the "show steps" which are performed in parallel from API invocations.
2015-06-25 18:50:24 -07:00
Nikhil Marathe
b043678543 Bug 1114554 - Patch 1 - Notification ServiceWorker API stubs. r=wchen,baku 2015-06-25 18:50:24 -07:00
Jose Antonio Olivera Ortega
4298df6a75 Bug 1178233 - [non-e10s] The update process doesn't work within about:serviceworkers in non-e10s mode. Test. r=baku 2015-07-14 15:44:15 +02:00
Jose Antonio Olivera Ortega
daea6febce Bug 1178233 - [non-e10s] The update process doesn't work within about:serviceworkers in non-e10s mode. r=baku 2015-07-14 15:44:13 +02:00
Ehsan Akhgari
b2d84799cc Bug 1183158 - Part 5: Get rid of RemoveAllEnumerator; r=baku 2015-07-13 22:42:10 -04:00
Ehsan Akhgari
10eb66850f Bug 1183158 - Part 4: Get rid of RemoveEnumerator; r=baku 2015-07-13 22:42:08 -04:00
Ehsan Akhgari
69a8bf5851 Bug 1183158 - Part 3: Get rid of UnregisterEnumerator; r=baku 2015-07-13 22:42:06 -04:00
Ehsan Akhgari
3fea9f7ebe Bug 1183158 - Part 2: Get rid of SoftUpdateEnumerator; r=baku 2015-07-13 22:42:05 -04:00
Ehsan Akhgari
1c9ff44332 Bug 1183158 - Part 1: Get rid of RegistrationEnumerator; r=baku 2015-07-13 22:42:03 -04:00
Ehsan Akhgari
544718bcdd Bug 1183141 - Use nsTHashtable::Iterator in ServiceWorkerManager::ClaimClients; r=catalinb 2015-07-13 22:42:01 -04:00
Ryan VanderMeulen
2f11bd6a1f Backed out changeset 57167b45c9d3 (bug 1183141) for wpt failures.
CLOSED TREE
2015-07-13 21:07:29 -04:00
Ryan VanderMeulen
19f79a0f75 Backed out 5 changesets (bug 1183158) for wpt failures.
Backed out changeset 2dad407995cc (bug 1183158)
Backed out changeset 5c7525b1e21c (bug 1183158)
Backed out changeset 2e6a27e72d83 (bug 1183158)
Backed out changeset db9953b220ae (bug 1183158)
Backed out changeset b0ea3f8b4512 (bug 1183158)
2015-07-13 21:07:01 -04:00
Ehsan Akhgari
a61f08bf74 Bug 1183158 - Part 5: Get rid of RemoveAllEnumerator; r=baku 2015-07-13 19:28:51 -04:00
Ehsan Akhgari
cd22a1b4e4 Bug 1183158 - Part 4: Get rid of RemoveEnumerator; r=baku 2015-07-13 19:28:49 -04:00
Ehsan Akhgari
4602f2663c Bug 1183158 - Part 3: Get rid of UnregisterEnumerator; r=baku 2015-07-13 19:28:48 -04:00
Ehsan Akhgari
eff9f3e100 Bug 1183158 - Part 2: Get rid of SoftUpdateEnumerator; r=baku 2015-07-13 19:28:46 -04:00
Ehsan Akhgari
f47d8fadff Bug 1183158 - Part 1: Get rid of RegistrationEnumerator; r=baku 2015-07-13 19:28:44 -04:00
Ehsan Akhgari
4d41f439fc Bug 1183141 - Use nsTHashtable::Iterator in ServiceWorkerManager::ClaimClients; r=catalinb 2015-07-13 19:28:43 -04:00
Birunthan Mohanathas
47ed3a3675 Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Michael Layzell
e01ad73eaf Bug 1181321 - Eliminate duplicate mRefCnt members in PromiseNativeHandler subclasses. r=baku 2015-07-09 08:56:00 +02:00
Wes Kocher
781244249b Backed out changeset adf95d1cd0aa (bug 1173934) for fetch-frame-resource.https.html WPT orange and test_synthesized_response.js S4 orange CLOSED TREE 2015-07-10 15:59:01 -07:00
Wes Kocher
f2c450e6c8 Backed out changeset df6593df027b (bug 1173912) 2015-07-10 15:58:24 -07:00
Ben Kelly
44931bb4b8 Bug 1173912 Fail opaque responses for client requests. r=ehsan 2015-07-10 14:28:32 -07:00
Ben Kelly
6ff3ab6e72 Bug 1173934 Show a message if a docshell fails to load due to SW intercept failure. r=ehsan r=jdm 2015-07-10 14:28:32 -07:00
Ben Kelly
ea56470171 Bug 1181871 P2 Fix ServiceWorkerManager usage of stack-based ErrorResult. r=ehsan 2015-07-10 13:56:06 -07:00
Geoff Brown
f8e98ea39a Bug 1026290 - Update mochitest-chrome manifests for android; r=jgriffin 2015-07-10 14:41:59 -06:00
Wes Kocher
502ddcea03 Backed out changeset 74293125739a (bug 1176341) 2015-07-10 12:48:20 -07:00