gecko-dev/dom/workers
Kyle Huey 1ab13f2322 Bug 1059469: Part 2 - When rescheduling the interval timer, cancel it first, and refactor things so that actually does something. r=bent
RunExpiredTimeouts has "fudging" code to always ensure that we execute at least one timeout.  This is intended to cover cases where an nsITimer fires slightly early, but it means we must be careful not to fire a timer more times than we intend to or we'll execute a timeout prematurely.

Consider a sequences of setTimeout calls alternating in delay between 0ms and 1000ms.  When the 1000ms timeout fires, it schedules a 0ms timeout.  The setTimeout call itself calls RescheduleTimeoutTimer, which schedules the timer for a 0 ms delay.  And once we unwind the 1000ms timeout RunExpiredTimeouts will also schedule the timer for a 0 ms delay.  If the timer has fired (remember, it's processed on a completely different thread) in the meantime, we ultimately will get two callbacks from nsITimer for our 0 ms timeout.  The first will run the 0 ms timeout and schedule a 1000 ms timeout, and the second will run the 1000 ms timeout (remember, RunExpiredTimeouts always runs at least one timeout!) ~999 ms ahead of schedule.

The solution is to cancel the timer in RescheduleTimeoutTimer, so that when we call it the second time it will cause any pending events from the first scheduling to be canceled.  But this actually doesn't work at all, because of how we use nsITimer.  Before worker threads were capable of accepting arbitrary runnables we created TimerThreadEventTarget, which translates the timer firing to the special worker event queue when the timer thread attempts to *dispatch* a runnable to the worker.  We still need this for some of the other types of timers (which use control runnables that interrupt JS, and not the regular event queue).  But setTimeout can simply run like a normal nsITimer callback now.  We need that here, or calling nsITimer::Cancel won't actually do anything, because the timer's event was ignored and TimerThreadEventTarget created its own event.
2016-01-06 13:18:29 -08:00
..
test Bug 1153636: Don't assert with addEventListener("") on workers. r=smaug 2016-01-06 13:18:29 -08:00
ChromeWorkerScope.cpp Bug 1182996 - Fix and add missing namespace comments. rs=ehsan 2015-07-13 08:25:42 -07:00
ChromeWorkerScope.h Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
DataStore.cpp Bug 1224596 part 9. Switch DataStore to using the new WorkerMainThreadRunnable::Dispatch signature. r=khuey 2015-11-24 00:04:20 -05:00
DataStore.h Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
DataStoreCursor.cpp Bug 1224596 part 10. Switch DataStoreCursor to using the new WorkerMainThreadRunnable::Dispatch signature. r=khuey 2015-11-24 00:04:21 -05:00
DataStoreCursor.h Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
FileReaderSync.cpp Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
FileReaderSync.h Bug 1182996 - Fix and add missing namespace comments. rs=ehsan 2015-07-13 08:25:42 -07:00
Location.cpp Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
Location.h Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
moz.build Bug 1214593 - Remove service worker periodic updater. r=ehsan 2015-11-02 16:08:44 +08:00
Navigator.cpp Bug 1224596 part 11. Switch WorkerNavigator to using the new WorkerMainThreadRunnable::Dispatch signature. r=khuey 2015-11-24 00:04:21 -05:00
Navigator.h Bug 1224596 part 11. Switch WorkerNavigator to using the new WorkerMainThreadRunnable::Dispatch signature. r=khuey 2015-11-24 00:04:21 -05:00
nsIWorkerDebugger.idl Bug 1228382 - Expose an API to relate nsIWorkerDebugger to its nsIServiceWorkerInfo instance. r=ejpbruel 2015-12-15 03:10:53 -08:00
nsIWorkerDebuggerManager.idl
Performance.cpp Bug 1226147 - WorkerPrivate->CreationTime() and CreationTimeStamp(), r=bz 2015-11-19 20:32:49 +00:00
Performance.h Bug 1169068 - Performance.translateTime(), r=bz 2015-11-19 14:04:47 +00:00
Principal.cpp Bug 1209263 - Allow embedders to tell SpiderMonkey how to structured clone principals; r=bz 2015-10-02 16:44:00 +02:00
Principal.h Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
PServiceWorkerManager.ipdl Bug 1209162 - Create OriginAttributes subtypes. IGNORE IDL r=sicking. 2015-11-03 09:50:54 +08:00
Queue.h Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
RegisterBindings.cpp Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
RuntimeService.cpp Bug 1231333 - part 2, DOM: only allow futexWait in workers. r=khuey 2015-12-23 13:44:00 +01:00
RuntimeService.h Bug 1186810 (part 8) - Replace nsBaseHashtable::Enumerate() calls in dom/workers/ with iterators. r=khuey. 2015-10-26 17:09:44 -07:00
ScriptLoader.cpp Bug 1233171 Cancel channel when ScriptLoader is aborted during service worker script load. r=khuey 2015-12-17 10:11:26 -05:00
ScriptLoader.h Bug 1160890, r=smaug 2015-10-15 14:06:55 +02:00
ServiceWorker.cpp Bug 1169068 - Performance.translateTime(), r=bz 2015-11-19 14:04:47 +00:00
ServiceWorker.h Bug 1169068 - Performance.translateTime(), r=bz 2015-11-19 14:04:47 +00:00
ServiceWorkerClient.cpp Bug 1222464 - Part 1: Save a client ID for top-level navigations on the docshell and assign it as the document ID when we start loading the document; r=jdm 2015-12-02 20:36:56 -05:00
ServiceWorkerClient.h Bug 1222464 - Part 2: Implement FetchEvent.clientId; r=jdm 2015-12-02 20:36:59 -05:00
ServiceWorkerClients.cpp Bug 1221992 - Prevent ServiceWorkerClients.OpenWindow from opening tabs in private mode windows. r=smaug 2015-12-11 13:32:15 -05:00
ServiceWorkerClients.h Bug 1222464 - Part 3: Implement Clients.get(); r=jdm 2015-12-02 20:37:01 -05:00
ServiceWorkerCommon.h Bug 1182996 - Fix and add missing namespace comments. rs=ehsan 2015-07-13 08:25:42 -07:00
ServiceWorkerContainer.cpp Bug 1226479. Change ErrorResult::ThrowTypeError/ThrowRangeError to take string references, not pointers. r=mccr8 2015-11-20 13:36:46 -05:00
ServiceWorkerContainer.h Bug 1218139 - Remove ServiceWorkerContainer.onreloadpage; r=bzbarsky 2015-10-26 15:59:57 -04:00
ServiceWorkerEvents.cpp Bug 1222464 - Part 2: Implement FetchEvent.clientId; r=jdm 2015-12-02 20:36:59 -05:00
ServiceWorkerEvents.h Bug 1222464 - Part 2: Implement FetchEvent.clientId; r=jdm 2015-12-02 20:36:59 -05:00
ServiceWorkerManager.cpp Bug 1236686 - Remove nsIFetchEventDispatcher; r=jdm 2016-01-05 15:04:41 -05:00
ServiceWorkerManager.h Bug 1236686 - Remove nsIFetchEventDispatcher; r=jdm 2016-01-05 15:04:41 -05:00
ServiceWorkerManagerChild.cpp Bug 1227932 - Fix Service Workers SoftUpdate and registration.update code paths. r=ehsan 2015-11-26 19:03:10 +02:00
ServiceWorkerManagerChild.h Bug 1209162 - Create OriginAttributes subtypes. IGNORE IDL r=sicking. 2015-11-03 09:50:54 +08:00
ServiceWorkerManagerParent.cpp Bug 1225121 - [B2G] All the rest of content processes crash if user tries to run app that uses Service Workers after restart. r=baku 2015-11-24 19:38:48 +01:00
ServiceWorkerManagerParent.h Bug 1225121 - [B2G] All the rest of content processes crash if user tries to run app that uses Service Workers after restart. r=baku 2015-11-24 19:38:48 +01:00
ServiceWorkerManagerService.cpp Bug 1225121 - [B2G] All the rest of content processes crash if user tries to run app that uses Service Workers after restart. r=baku 2015-11-24 19:38:48 +01:00
ServiceWorkerManagerService.h Bug 1209162 - Create OriginAttributes subtypes. IGNORE IDL r=sicking. 2015-11-03 09:50:54 +08:00
ServiceWorkerMessageEvent.cpp Bug 1224061: Make Event::InitEvent infallible. r=smaug 2015-11-13 08:09:42 +08:00
ServiceWorkerMessageEvent.h Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
ServiceWorkerPrivate.cpp Bug 1214305 - Part 5: Use the secure upgraded channel URI in FetchEventRunnable::Init; r=jdm 2016-01-04 16:30:02 -05:00
ServiceWorkerPrivate.h Bug 1222464 - Part 2: Implement FetchEvent.clientId; r=jdm 2015-12-02 20:36:59 -05:00
ServiceWorkerRegistrar.cpp Bug 1209162 - Create OriginAttributes subtypes. IGNORE IDL r=sicking. 2015-11-03 09:50:54 +08:00
ServiceWorkerRegistrar.h Bug 1189235 - Use originAttribute for ServiceWorkerRegistrar. r=baku 2015-08-20 18:20:19 +08:00
ServiceWorkerRegistrarTypes.ipdlh
ServiceWorkerRegistration.cpp Bug 1226443 P6 Ignore update() called during top level service worker script evaluation. r=ehsan 2015-12-11 14:53:11 -05:00
ServiceWorkerRegistration.h Bug 1201127 - Return the same ServiceWorkerRegistration object from service worker APIs dealing with the same underlying registration object; r=jdm 2015-11-26 15:13:33 -05:00
ServiceWorkerScriptCache.cpp Bug 1226443 P4 Cleanup ServiceWorkerScriptCache objects when initialization fails. r=ehsan 2015-12-11 14:53:11 -05:00
ServiceWorkerScriptCache.h Bug 1207727 - Rework updating service workers according to the latest spec. r=bkelly 2015-10-26 10:59:48 +08:00
ServiceWorkerWindowClient.cpp Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
ServiceWorkerWindowClient.h Bug 1218146 - Move WindowClient.frameType to Client.frameType; r=bzbarsky 2015-10-26 16:00:00 -04:00
SharedWorker.cpp Bug 1221852 - SharedWorker.port should be always not null, r=smaug 2015-11-17 23:38:39 +00:00
SharedWorker.h Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
URL.cpp Bug 1224596 part 14. Switch URL to using the new WorkerMainThreadRunnable::Dispatch signature. r=baku 2015-11-24 00:04:21 -05:00
URL.h Bug 1224596 part 14. Switch URL to using the new WorkerMainThreadRunnable::Dispatch signature. r=baku 2015-11-24 00:04:21 -05:00
WorkerDebuggerManager.cpp Backed out changeset 9441286007c4 (bug 1211903) for assertion failures/crashes 2015-12-22 14:11:27 +01:00
WorkerDebuggerManager.h Backed out changeset 9441286007c4 (bug 1211903) for assertion failures/crashes 2015-12-22 14:11:27 +01:00
WorkerFeature.h Bug 1235629 - Remove dead code in WorkerFeature.h, r=smaug 2015-12-29 20:35:21 +00:00
WorkerInlines.h Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
WorkerPrefs.h Bug 1218119 - Simplify defining worker prefs; r=baku 2015-10-26 14:06:28 -04:00
WorkerPrivate.cpp Bug 1059469: Part 2 - When rescheduling the interval timer, cancel it first, and refactor things so that actually does something. r=bent 2016-01-06 13:18:29 -08:00
WorkerPrivate.h Bug 1059469: Part 2 - When rescheduling the interval timer, cancel it first, and refactor things so that actually does something. r=bent 2016-01-06 13:18:29 -08:00
WorkerRunnable.cpp Bug 1224596 part 17. Remove the old WorkerMainThreadRunnable::Dispatch signature. r=khuey 2015-11-24 00:04:21 -05:00
WorkerRunnable.h Bug 1224596 part 17. Remove the old WorkerMainThreadRunnable::Dispatch signature. r=khuey 2015-11-24 00:04:21 -05:00
Workers.h Bug 1218119 - Simplify defining worker prefs; r=baku 2015-10-26 14:06:28 -04:00
WorkerScope.cpp Bug 1059469: Part 1 - Add a log module for dump() calls. r=bent 2016-01-06 13:18:29 -08:00
WorkerScope.h Bug 1218142 - Remove ServiceWorkerGlobalScope.onbeforeevicted/onevicted; r=bzbarsky 2015-10-26 15:59:58 -04:00
WorkerThread.cpp Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
WorkerThread.h Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
XMLHttpRequest.cpp Bug 1235598 - Part 2: Use TraceEdge exclusively in Gecko; r=smaug 2015-12-30 08:52:14 -08:00
XMLHttpRequest.h Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
XMLHttpRequestUpload.cpp Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00
XMLHttpRequestUpload.h Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat 2015-10-18 01:24:48 -04:00