Title: [193286] trunk
Revision
193286
Author
wei...@apple.com
Date
2015-12-03 11:06:45 -0800 (Thu, 03 Dec 2015)

Log Message

Promise callbacks should be called at microtask checkpoints
https://bugs.webkit.org/show_bug.cgi?id=147933

Reviewed by Chris Dumez.

Source/WebCore:

- Re-names MicroTaskQueue and MicroTask to MicrotaskQueue and Microtask to match the spec language.
- Re-implements MicrotaskQueue and Microtask support suspended Microtasks (via the new KeepInQueue
  result value a Microtask can have when running) and correct behavior when Microtasks are added to
  the queue during a Microtask checkpoint.
- MicrotaskQueue now has a mainThreadQueue() static function, replacing the old singleton() function,
  which can be used for the Document (non-Worker) Microtasks. For Workers, the a MicrotaskQueue 
  can be separately allocated for each WorkerGlobalScope (though this was not done in this change).
- Adds a helper subclass of Microtask, ActiveDOMCallbackMicrotask, for Microtasks that are
  per-ScriptExecutationContext, and need to act as ActiveDOMCallbacks.
- Re-implement Document (non-Worker) Promises on top of ActiveDOMCallbackMicrotask.
- Re-implement MutationObserver delivery on top of Microtask.

Layout Test:
    fast/dom/microtask-promise-mutation-observer-order.html

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMAllInOne.cpp:
Add new files.

* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::queueTaskToEventLoop):
Switch to using ActiveDOMCallbackMicrotask/MicrotaskQueue rather than ScriptExecutionContext's Task mechanism
for _javascript_Core tasks.

* bindings/js/JSMainThreadExecState.cpp:
(WebCore::JSMainThreadExecState::didLeaveScriptContext):
Perform a microtask checkpoint rather than calling MutationObserver code explicitly now that mutation observers
use microtasks.

* dom/ActiveDOMCallbackMicrotask.cpp: Added.
(WebCore::ActiveDOMCallbackMicrotask::ActiveDOMCallbackMicrotask):
(WebCore::ActiveDOMCallbackMicrotask::~ActiveDOMCallbackMicrotask):
(WebCore::ActiveDOMCallbackMicrotask::run):
(WebCore::ActiveDOMCallbackMicrotask::contextDestroyed):
* dom/ActiveDOMCallbackMicrotask.h: Added.
Add a helper subclass of Microtask which behaves like a ActiveDOMCallback (e.g. supports suspension
and context destruction).

* dom/MicroTask.cpp: Renamed to Microtasks.cpp.
* dom/MicroTask.h: Renamed to Microtasks.h.
* dom/Microtasks.cpp: Renamed from Source/WebCore/dom/MicroTask.cpp.
(WebCore::Microtask::removeSelfFromQueue):
(WebCore::MicrotaskQueue::mainThreadQueue):
(WebCore::MicrotaskQueue::append):
(WebCore::MicrotaskQueue::remove):
(WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
(WebCore::MicroTaskQueue::singleton): Deleted.
(WebCore::MicroTaskQueue::queueMicroTask): Deleted.
(WebCore::MicroTaskQueue::runMicroTasks): Deleted.
* dom/Microtasks.h: Renamed from Source/WebCore/dom/MicroTask.h.
(WebCore::Microtask::~Microtask):
(WebCore::MicrotaskQueue::MicrotaskQueue):
(WebCore::MicrotaskQueue::~MicrotaskQueue):
(WebCore::MicroTask::~MicroTask): Deleted.
(WebCore::MicroTaskQueue::~MicroTaskQueue): Deleted.
(WebCore::MicroTaskQueue::MicroTaskQueue): Deleted.
Re-implement MicrotaskQueue and Microtask to support Microtask suspension (via the KeepInQueue result
value) and correct behavior when Microtasks are queued during checkpoints.

* dom/MutationObserver.cpp:
(WebCore::suspendedMutationObservers):
(WebCore::MutationObserverMicrotask::MutationObserverMicrotask):
(WebCore::MutationObserverMicrotask::~MutationObserverMicrotask):
(WebCore::MutationObserverMicrotask::run):
(WebCore::queueMutationObserverCompoundMicrotask):
(WebCore::MutationObserver::enqueueMutationRecord):
(WebCore::MutationObserver::setHasTransientRegistration):
* dom/MutationObserver.h:
Re-implement MutationObserver delivery on top of Microtasks.

* dom/ScriptRunner.cpp:
(WebCore::ScriptRunner::timerFired):
Remove unnecessary call to runMicroTasks().

* html/parser/HTMLScriptRunner.cpp:
(WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent):
(WebCore::HTMLScriptRunner::runScript):
Remove calls to MutationObserver::deliverAllMutations() now that the MicrotaskQueue will take care of it.

(WebCore::HTMLScriptRunner::executeScriptsWaitingForParsing):
Remove unnecessary call to runMicroTasks().

* testing/Internals.cpp:
(WebCore::Internals::queueMicroTask):
Use ActiveDOMCallbackMicrotask rather than a custom test subclass.

* testing/MicroTaskTest.cpp: Removed.
* testing/MicroTaskTest.h: Removed.
Remove custom test subclass of Microtask, just use ActiveDOMCallbackMicrotask directly.

LayoutTests:

* fast/dom/microtask-promise-mutation-observer-order-expected.txt: Added.
* fast/dom/microtask-promise-mutation-observer-order.html: Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (193285 => 193286)


--- trunk/LayoutTests/ChangeLog	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/LayoutTests/ChangeLog	2015-12-03 19:06:45 UTC (rev 193286)
@@ -1,3 +1,13 @@
+2015-12-02  Sam Weinig  <s...@webkit.org>
+
+        Promise callbacks should be called at microtask checkpoints
+        https://bugs.webkit.org/show_bug.cgi?id=147933
+
+        Reviewed by Chris Dumez.
+
+        * fast/dom/microtask-promise-mutation-observer-order-expected.txt: Added.
+        * fast/dom/microtask-promise-mutation-observer-order.html: Added.
+
 2015-12-03  Daniel Bates  <daba...@apple.com>
 
         ASSERT_WITH_SECURITY_IMPLICATION in WebCore::DocumentOrderedMap::add()

Added: trunk/LayoutTests/fast/dom/microtask-promise-mutation-observer-order-expected.txt (0 => 193286)


--- trunk/LayoutTests/fast/dom/microtask-promise-mutation-observer-order-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/microtask-promise-mutation-observer-order-expected.txt	2015-12-03 19:06:45 UTC (rev 193286)
@@ -0,0 +1,17 @@
+Test that promises and mutation observers are both delivered from the same microtask queue.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Expected result: promise,mutate,timeout
+Actual result: promise,mutate,timeout
+PASS actualResult is expectedResult
+
+Expected result: mutate,promise,timeout
+Actual result: mutate,promise,timeout
+PASS actualResult is expectedResult
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/microtask-promise-mutation-observer-order.html (0 => 193286)


--- trunk/LayoutTests/fast/dom/microtask-promise-mutation-observer-order.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/microtask-promise-mutation-observer-order.html	2015-12-03 19:06:45 UTC (rev 193286)
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+
+description("Test that promises and mutation observers are both delivered from the same microtask queue.");
+var jsTestIsAsync = true;
+
+var actualResult = [];
+var expectedResult = [];
+var currentTest = 0;
+
+new MutationObserver(function() { 
+    actualResult.push('mutate');
+    checkIfDone();
+}).observe(document.body, { attributes: true });
+function mutate()
+{
+    document.body.setAttribute('data-random', Math.random());
+}
+function promise()
+{
+    Promise.resolve().then(function() { 
+        actualResult.push('promise');
+        checkIfDone();
+    });
+}
+function timeout()
+{
+    setTimeout(function() {
+        actualResult.push('timeout');
+        checkIfDone();
+    }, 0);
+}
+
+function checkIfDone()
+{
+    if (actualResult.length != expectedResult.length)
+        return;
+
+    debug("Expected result: " + expectedResult);
+    debug("Actual result: " + actualResult);
+    shouldBe("actualResult", "expectedResult");
+    debug("");
+
+    ++currentTest
+    runNextTest();
+}
+
+var tests = [
+    [[timeout, promise, mutate], ["promise", "mutate", "timeout"]],
+    [[timeout, mutate, promise], ["mutate", "promise", "timeout"]]
+];
+
+function runNextTest()
+{
+    if (currentTest >= tests.length) {
+        finishJSTest();
+        return;
+    }
+
+    actualResult = [];
+    tasks = tests[currentTest][0];
+    expectedResult = tests[currentTest][1];
+
+    for (task of tasks) {
+        task();
+    }
+}
+
+runNextTest()
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/CMakeLists.txt (193285 => 193286)


--- trunk/Source/WebCore/CMakeLists.txt	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-12-03 19:06:45 UTC (rev 193286)
@@ -1413,6 +1413,7 @@
 
     cssjit/SelectorCompiler.cpp
 
+    dom/ActiveDOMCallbackMicrotask.cpp
     dom/ActiveDOMObject.cpp
     dom/AnimationEvent.cpp
     dom/Attr.cpp
@@ -1485,7 +1486,7 @@
     dom/MessageEvent.cpp
     dom/MessagePort.cpp
     dom/MessagePortChannel.cpp
-    dom/MicroTask.cpp
+    dom/Microtasks.cpp
     dom/MouseEvent.cpp
     dom/MouseRelatedEvent.cpp
     dom/MutationEvent.cpp
@@ -3344,7 +3345,6 @@
 
     testing/InternalSettings.cpp
     testing/Internals.cpp
-    testing/MicroTaskTest.cpp
     testing/MockPageOverlayClient.cpp
 
     testing/js/WebCoreTestSupport.cpp

Modified: trunk/Source/WebCore/ChangeLog (193285 => 193286)


--- trunk/Source/WebCore/ChangeLog	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/ChangeLog	2015-12-03 19:06:45 UTC (rev 193286)
@@ -1,3 +1,102 @@
+2015-12-02  Sam Weinig  <s...@webkit.org>
+
+        Promise callbacks should be called at microtask checkpoints
+        https://bugs.webkit.org/show_bug.cgi?id=147933
+
+        Reviewed by Chris Dumez.
+
+        - Re-names MicroTaskQueue and MicroTask to MicrotaskQueue and Microtask to match the spec language.
+        - Re-implements MicrotaskQueue and Microtask support suspended Microtasks (via the new KeepInQueue
+          result value a Microtask can have when running) and correct behavior when Microtasks are added to
+          the queue during a Microtask checkpoint.
+        - MicrotaskQueue now has a mainThreadQueue() static function, replacing the old singleton() function,
+          which can be used for the Document (non-Worker) Microtasks. For Workers, the a MicrotaskQueue 
+          can be separately allocated for each WorkerGlobalScope (though this was not done in this change).
+        - Adds a helper subclass of Microtask, ActiveDOMCallbackMicrotask, for Microtasks that are
+          per-ScriptExecutationContext, and need to act as ActiveDOMCallbacks.
+        - Re-implement Document (non-Worker) Promises on top of ActiveDOMCallbackMicrotask.
+        - Re-implement MutationObserver delivery on top of Microtask.
+
+        Layout Test:
+            fast/dom/microtask-promise-mutation-observer-order.html
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DOMAllInOne.cpp:
+        Add new files.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::queueTaskToEventLoop):
+        Switch to using ActiveDOMCallbackMicrotask/MicrotaskQueue rather than ScriptExecutionContext's Task mechanism
+        for _javascript_Core tasks.
+
+        * bindings/js/JSMainThreadExecState.cpp:
+        (WebCore::JSMainThreadExecState::didLeaveScriptContext):
+        Perform a microtask checkpoint rather than calling MutationObserver code explicitly now that mutation observers
+        use microtasks.
+
+        * dom/ActiveDOMCallbackMicrotask.cpp: Added.
+        (WebCore::ActiveDOMCallbackMicrotask::ActiveDOMCallbackMicrotask):
+        (WebCore::ActiveDOMCallbackMicrotask::~ActiveDOMCallbackMicrotask):
+        (WebCore::ActiveDOMCallbackMicrotask::run):
+        (WebCore::ActiveDOMCallbackMicrotask::contextDestroyed):
+        * dom/ActiveDOMCallbackMicrotask.h: Added.
+        Add a helper subclass of Microtask which behaves like a ActiveDOMCallback (e.g. supports suspension
+        and context destruction).
+
+        * dom/MicroTask.cpp: Renamed to Microtasks.cpp.
+        * dom/MicroTask.h: Renamed to Microtasks.h.
+        * dom/Microtasks.cpp: Renamed from Source/WebCore/dom/MicroTask.cpp.
+        (WebCore::Microtask::removeSelfFromQueue):
+        (WebCore::MicrotaskQueue::mainThreadQueue):
+        (WebCore::MicrotaskQueue::append):
+        (WebCore::MicrotaskQueue::remove):
+        (WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
+        (WebCore::MicroTaskQueue::singleton): Deleted.
+        (WebCore::MicroTaskQueue::queueMicroTask): Deleted.
+        (WebCore::MicroTaskQueue::runMicroTasks): Deleted.
+        * dom/Microtasks.h: Renamed from Source/WebCore/dom/MicroTask.h.
+        (WebCore::Microtask::~Microtask):
+        (WebCore::MicrotaskQueue::MicrotaskQueue):
+        (WebCore::MicrotaskQueue::~MicrotaskQueue):
+        (WebCore::MicroTask::~MicroTask): Deleted.
+        (WebCore::MicroTaskQueue::~MicroTaskQueue): Deleted.
+        (WebCore::MicroTaskQueue::MicroTaskQueue): Deleted.
+        Re-implement MicrotaskQueue and Microtask to support Microtask suspension (via the KeepInQueue result
+        value) and correct behavior when Microtasks are queued during checkpoints.
+
+        * dom/MutationObserver.cpp:
+        (WebCore::suspendedMutationObservers):
+        (WebCore::MutationObserverMicrotask::MutationObserverMicrotask):
+        (WebCore::MutationObserverMicrotask::~MutationObserverMicrotask):
+        (WebCore::MutationObserverMicrotask::run):
+        (WebCore::queueMutationObserverCompoundMicrotask):
+        (WebCore::MutationObserver::enqueueMutationRecord):
+        (WebCore::MutationObserver::setHasTransientRegistration):
+        * dom/MutationObserver.h:
+        Re-implement MutationObserver delivery on top of Microtasks.
+
+        * dom/ScriptRunner.cpp:
+        (WebCore::ScriptRunner::timerFired):
+        Remove unnecessary call to runMicroTasks().
+
+        * html/parser/HTMLScriptRunner.cpp:
+        (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent):
+        (WebCore::HTMLScriptRunner::runScript):
+        Remove calls to MutationObserver::deliverAllMutations() now that the MicrotaskQueue will take care of it.
+
+        (WebCore::HTMLScriptRunner::executeScriptsWaitingForParsing):
+        Remove unnecessary call to runMicroTasks().
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::queueMicroTask):
+        Use ActiveDOMCallbackMicrotask rather than a custom test subclass.
+
+        * testing/MicroTaskTest.cpp: Removed.
+        * testing/MicroTaskTest.h: Removed.
+        Remove custom test subclass of Microtask, just use ActiveDOMCallbackMicrotask directly.
+
 2015-12-03  Brady Eidson  <beid...@apple.com>
 
         Add GetterRaisesExceptionWithMessage and SetterRaisesExceptionWithMessage to the code generator.

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (193285 => 193286)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-12-03 19:06:45 UTC (rev 193286)
@@ -13554,6 +13554,20 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\dom\ActiveDOMCallbackMicrotask.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\dom\ActiveDOMObject.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -14493,7 +14507,7 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="..\dom\MicroTask.cpp">
+    <ClCompile Include="..\dom\Microtasks.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
@@ -22035,6 +22049,7 @@
     <ClInclude Include="..\xml\parser\MarkupTokenizerInlines.h" />
     <ClInclude Include="..\xml\parser\XMLDocumentParser.h" />
     <ClInclude Include="..\xml\parser\XMLDocumentParserScope.h" />
+    <ClInclude Include="..\dom\ActiveDOMCallbackMicrotask.h" />
     <ClInclude Include="..\dom\ActiveDOMObject.h" />
     <ClInclude Include="..\dom\AnimationEvent.h" />
     <ClInclude Include="..\dom\Attr.h" />
@@ -22126,7 +22141,7 @@
     <ClInclude Include="..\dom\MessageEvent.h" />
     <ClInclude Include="..\dom\MessagePort.h" />
     <ClInclude Include="..\dom\MessagePortChannel.h" />
-    <ClInclude Include="..\dom\MicroTask.h" />
+    <ClInclude Include="..\dom\Microtasks.h" />
     <ClInclude Include="..\dom\MouseEvent.h" />
     <ClInclude Include="..\dom\MouseRelatedEvent.h" />
     <ClInclude Include="..\dom\MutationEvent.h" />

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (193285 => 193286)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-12-03 19:06:45 UTC (rev 193286)
@@ -2278,7 +2278,7 @@
 		536D5A23193E8E0C00CE4CAB /* ParsingUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 536D5A22193E8E0C00CE4CAB /* ParsingUtilities.h */; };
 		536D5A25193F40FC00CE4CAB /* SourceSizeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 536D5A24193F40FC00CE4CAB /* SourceSizeList.cpp */; };
 		536D5A27193F410B00CE4CAB /* SourceSizeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 536D5A26193F410B00CE4CAB /* SourceSizeList.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		53B895AF19DC7ED9009CAA93 /* MicroTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 53B895AD19DC7C37009CAA93 /* MicroTask.h */; };
+		53B895AF19DC7ED9009CAA93 /* Microtasks.h in Headers */ = {isa = PBXBuildFile; fileRef = 53B895AD19DC7C37009CAA93 /* Microtasks.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		53C8298D13D8D92700DE2DEB /* RenderFlexibleBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53C8298B13D8D92700DE2DEB /* RenderFlexibleBox.cpp */; };
 		53C8298E13D8D92700DE2DEB /* RenderFlexibleBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		53E29E5E167A8A1900586D3D /* InternalSettingsGenerated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53E29E5C167A8A1900586D3D /* InternalSettingsGenerated.cpp */; };
@@ -2753,6 +2753,8 @@
 		7CC69940191EC5F500AF2270 /* JSWebKitNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */; };
 		7CC69941191EC5F500AF2270 /* JSWebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */; };
 		7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
+		7CD0BA041B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD0BA021B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp */; };
+		7CD0BA051B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */; };
 		7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */; };
 		7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7CDEEE1E197610D700E352CD /* ViewStateChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDEEE1D197610D700E352CD /* ViewStateChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5935,9 +5937,7 @@
 		CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */; };
 		CAE9F910146441F000C245B0 /* CSSAspectRatioValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */; };
-		CB8CF0181A9358D4000D510B /* MicroTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CB8CF0151A934B43000D510B /* MicroTask.cpp */; };
-		CB8CF01D1A95DE42000D510B /* MicroTaskTest.h in Headers */ = {isa = PBXBuildFile; fileRef = CB8CF01C1A95DE42000D510B /* MicroTaskTest.h */; };
-		CB8CF01F1A95DE59000D510B /* MicroTaskTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CB8CF01E1A95DE59000D510B /* MicroTaskTest.cpp */; };
+		CB8CF0181A9358D4000D510B /* Microtasks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CB8CF0151A934B43000D510B /* Microtasks.cpp */; };
 		CCC2B51415F613060048CDD6 /* DeviceClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51015F613060048CDD6 /* DeviceClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CCC2B51115F613060048CDD6 /* DeviceController.cpp */; };
 		CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51215F613060048CDD6 /* DeviceController.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9745,7 +9745,7 @@
 		536D5A22193E8E0C00CE4CAB /* ParsingUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParsingUtilities.h; sourceTree = "<group>"; };
 		536D5A24193F40FC00CE4CAB /* SourceSizeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SourceSizeList.cpp; sourceTree = "<group>"; };
 		536D5A26193F410B00CE4CAB /* SourceSizeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceSizeList.h; sourceTree = "<group>"; };
-		53B895AD19DC7C37009CAA93 /* MicroTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MicroTask.h; sourceTree = "<group>"; };
+		53B895AD19DC7C37009CAA93 /* Microtasks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Microtasks.h; sourceTree = "<group>"; };
 		53C8298B13D8D92700DE2DEB /* RenderFlexibleBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFlexibleBox.cpp; sourceTree = "<group>"; };
 		53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFlexibleBox.h; sourceTree = "<group>"; };
 		53E29E5C167A8A1900586D3D /* InternalSettingsGenerated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InternalSettingsGenerated.cpp; sourceTree = "<group>"; };
@@ -10288,6 +10288,8 @@
 		7CC6993E191EC5F500AF2270 /* JSWebKitNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitNamespace.cpp; sourceTree = "<group>"; };
 		7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitNamespace.h; sourceTree = "<group>"; };
 		7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; };
+		7CD0BA021B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActiveDOMCallbackMicrotask.cpp; sourceTree = "<group>"; };
+		7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMCallbackMicrotask.h; sourceTree = "<group>"; };
 		7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderAttachment.cpp; sourceTree = "<group>"; };
 		7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderAttachment.h; sourceTree = "<group>"; };
 		7CDEEE1D197610D700E352CD /* ViewStateChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewStateChangeObserver.h; sourceTree = "<group>"; };
@@ -13776,9 +13778,7 @@
 		CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = "<group>"; };
 		CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSAspectRatioValue.cpp; sourceTree = "<group>"; };
 		CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSAspectRatioValue.h; sourceTree = "<group>"; };
-		CB8CF0151A934B43000D510B /* MicroTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MicroTask.cpp; sourceTree = "<group>"; };
-		CB8CF01C1A95DE42000D510B /* MicroTaskTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MicroTaskTest.h; sourceTree = "<group>"; };
-		CB8CF01E1A95DE59000D510B /* MicroTaskTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MicroTaskTest.cpp; sourceTree = "<group>"; };
+		CB8CF0151A934B43000D510B /* Microtasks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Microtasks.cpp; sourceTree = "<group>"; };
 		CCC2B51015F613060048CDD6 /* DeviceClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceClient.h; sourceTree = "<group>"; };
 		CCC2B51115F613060048CDD6 /* DeviceController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceController.cpp; sourceTree = "<group>"; };
 		CCC2B51215F613060048CDD6 /* DeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceController.h; sourceTree = "<group>"; };
@@ -16470,8 +16470,6 @@
 				A7BE7EDE14C9175A0014489D /* MallocStatistics.idl */,
 				CD5393CB175DCCE600C07123 /* MemoryInfo.h */,
 				CD5393CC175DCCE600C07123 /* MemoryInfo.idl */,
-				CB8CF01E1A95DE59000D510B /* MicroTaskTest.cpp */,
-				CB8CF01C1A95DE42000D510B /* MicroTaskTest.h */,
 				CDC26B3C160A62B00026757B /* MockCDM.cpp */,
 				CDC26B3D160A62B00026757B /* MockCDM.h */,
 				A1BF6B801AA96C7D00AF4A8A /* MockContentFilter.cpp */,
@@ -23783,6 +23781,8 @@
 				2D5036661BCDDDC400E20BB3 /* mac */,
 				E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */,
 				E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */,
+				7CD0BA021B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp */,
+				7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */,
 				319847FE1A1D816700A13318 /* AnimationEvent.cpp */,
 				319847FF1A1D816700A13318 /* AnimationEvent.h */,
 				319848001A1D816700A13318 /* AnimationEvent.idl */,
@@ -23999,8 +23999,8 @@
 				E1ADECBD0E76ACF1004A1A5E /* MessagePort.h */,
 				E1ADECC60E76AD1F004A1A5E /* MessagePort.idl */,
 				41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */,
-				CB8CF0151A934B43000D510B /* MicroTask.cpp */,
-				53B895AD19DC7C37009CAA93 /* MicroTask.h */,
+				CB8CF0151A934B43000D510B /* Microtasks.cpp */,
+				53B895AD19DC7C37009CAA93 /* Microtasks.h */,
 				85031B2F0A44EFC700F992E0 /* MouseEvent.cpp */,
 				85031B300A44EFC700F992E0 /* MouseEvent.h */,
 				141B94E509EC4223000E9413 /* MouseEvent.idl */,
@@ -24571,7 +24571,6 @@
 				CD5393D4175E018600C07123 /* JSMemoryInfo.h in Headers */,
 				A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */,
 				EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */,
-				CB8CF01D1A95DE42000D510B /* MicroTaskTest.h in Headers */,
 				CDC26B41160A8CCE0026757B /* MockCDM.h in Headers */,
 				A1BF6B831AA96C7D00AF4A8A /* MockContentFilter.h in Headers */,
 				A1B5B29F1AAA846F008B6042 /* MockContentFilterSettings.h in Headers */,
@@ -26819,7 +26818,7 @@
 				A78E52701346BD1700AD9C31 /* MeterShadowElement.h in Headers */,
 				37DDCDA51384501C0008B793 /* MHTMLArchive.h in Headers */,
 				37DDCDA71384501C0008B793 /* MHTMLParser.h in Headers */,
-				53B895AF19DC7ED9009CAA93 /* MicroTask.h in Headers */,
+				53B895AF19DC7ED9009CAA93 /* Microtasks.h in Headers */,
 				37DDCD9513844FD50008B793 /* MIMEHeader.h in Headers */,
 				BC772C4F0C4EB3040083285F /* MIMETypeRegistry.h in Headers */,
 				52F10866162B6DA8009AC81E /* MixedContentChecker.h in Headers */,
@@ -27500,6 +27499,7 @@
 				84730D931248F0B300D3A9C9 /* SpotLightSource.h in Headers */,
 				97BC6A3B1505F081001B74AC /* SQLCallbackWrapper.h in Headers */,
 				97BC6A3C1505F081001B74AC /* SQLError.h in Headers */,
+				7CD0BA051B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h in Headers */,
 				97BC6A3F1505F081001B74AC /* SQLException.h in Headers */,
 				1A22464A0CC98DDB00C05240 /* SQLiteDatabase.h in Headers */,
 				7E474E1F12494DC900235364 /* SQLiteDatabaseTracker.h in Headers */,
@@ -28510,7 +28510,6 @@
 				A19AEA221AAA808A00B52B25 /* JSMockContentFilterSettings.cpp in Sources */,
 				A1E5B31F1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp in Sources */,
 				EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */,
-				CB8CF01F1A95DE59000D510B /* MicroTaskTest.cpp in Sources */,
 				CDC26B40160A8CC60026757B /* MockCDM.cpp in Sources */,
 				A1BF6B821AA96C7D00AF4A8A /* MockContentFilter.cpp in Sources */,
 				A1B5B29E1AAA846E008B6042 /* MockContentFilterSettings.cpp in Sources */,
@@ -28968,6 +28967,7 @@
 				49FC7A501444AF5F00A5D864 /* DisplayRefreshMonitor.cpp in Sources */,
 				2D29ECC5192ECC8300984B78 /* DisplayRefreshMonitorClient.cpp in Sources */,
 				0F97A658155DA81E00FADD4C /* DisplayRefreshMonitorIOS.mm in Sources */,
+				7CD0BA041B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.cpp in Sources */,
 				49AF2D6C14435D210016A784 /* DisplayRefreshMonitorMac.cpp in Sources */,
 				2D29ECC7192ECC8300984B78 /* DisplayRefreshMonitorManager.cpp in Sources */,
 				CD52481A18E200ED0008A07D /* DisplaySleepDisabler.cpp in Sources */,
@@ -30519,7 +30519,7 @@
 				75793E830D0CE0B3007FC0AC /* MessageEvent.cpp in Sources */,
 				E1ADECC00E76ACF1004A1A5E /* MessagePort.cpp in Sources */,
 				A78E526F1346BD1700AD9C31 /* MeterShadowElement.cpp in Sources */,
-				CB8CF0181A9358D4000D510B /* MicroTask.cpp in Sources */,
+				CB8CF0181A9358D4000D510B /* Microtasks.cpp in Sources */,
 				37DDCD9413844FD50008B793 /* MIMEHeader.cpp in Sources */,
 				BC772C4E0C4EB3040083285F /* MIMETypeRegistry.cpp in Sources */,
 				E453901D0EAFCACA003695C8 /* MIMETypeRegistryIOS.mm in Sources */,

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (193285 => 193286)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -24,12 +24,14 @@
 #include "config.h"
 #include "JSDOMWindowBase.h"
 
+#include "ActiveDOMCallbackMicrotask.h"
 #include "Chrome.h"
 #include "DOMWindow.h"
 #include "Frame.h"
 #include "InspectorController.h"
 #include "JSDOMGlobalObjectTask.h"
 #include "JSDOMWindowCustom.h"
+#include "JSMainThreadExecState.h"
 #include "JSModuleLoader.h"
 #include "JSNode.h"
 #include "Logging.h"
@@ -39,6 +41,7 @@
 #include "SecurityOrigin.h"
 #include "Settings.h"
 #include "WebCoreJSClientData.h"
+#include <heap/StrongInlines.h>
 #include <runtime/JSInternalPromiseDeferred.h>
 #include <runtime/Microtask.h>
 #include <wtf/MainThread.h>
@@ -240,10 +243,46 @@
     return frame->settings()._javascript_RuntimeFlags();
 }
 
-void JSDOMWindowBase::queueTaskToEventLoop(const JSGlobalObject* object, PassRefPtr<Microtask> task)
+class JSDOMWindowMicrotaskCallback : public RefCounted<JSDOMWindowMicrotaskCallback> {
+public:
+    static Ref<JSDOMWindowMicrotaskCallback> create(JSDOMWindowBase* globalObject, PassRefPtr<JSC::Microtask> task)
+    {
+        return adoptRef(*new JSDOMWindowMicrotaskCallback(globalObject, task));
+    }
+
+    void call()
+    {
+        Ref<JSDOMWindowMicrotaskCallback> protect(*this);
+        JSLockHolder lock(m_globalObject->vm());
+
+        ExecState* exec = m_globalObject->globalExec();
+
+        JSMainThreadExecState::runTask(exec, *m_task.get());
+
+        ASSERT(!exec->hadException());
+    }
+
+private:
+    JSDOMWindowMicrotaskCallback(JSDOMWindowBase* globalObject, PassRefPtr<JSC::Microtask> task)
+        : m_globalObject(globalObject->vm(), globalObject)
+        , m_task(task)
+    {
+    }
+
+    Strong<JSDOMWindowBase> m_globalObject;
+    RefPtr<JSC::Microtask> m_task;
+};
+
+void JSDOMWindowBase::queueTaskToEventLoop(const JSGlobalObject* object, PassRefPtr<JSC::Microtask> task)
 {
     const JSDOMWindowBase* thisObject = static_cast<const JSDOMWindowBase*>(object);
-    thisObject->scriptExecutionContext()->postTask(JSGlobalObjectTask((JSDOMWindowBase*)thisObject, task));
+
+    RefPtr<JSDOMWindowMicrotaskCallback> callback = JSDOMWindowMicrotaskCallback::create((JSDOMWindowBase*)thisObject, task);
+    auto microtask = std::make_unique<ActiveDOMCallbackMicrotask>(MicrotaskQueue::mainThreadQueue(), *thisObject->scriptExecutionContext(), [callback]() mutable {
+        callback->call();
+    });
+
+    MicrotaskQueue::mainThreadQueue().append(WTF::move(microtask));
 }
 
 void JSDOMWindowBase::willRemoveFromWindowShell()

Modified: trunk/Source/WebCore/bindings/js/JSMainThreadExecState.cpp (193285 => 193286)


--- trunk/Source/WebCore/bindings/js/JSMainThreadExecState.cpp	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/bindings/js/JSMainThreadExecState.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -25,6 +25,8 @@
 
 #include "config.h"
 #include "JSMainThreadExecState.h"
+
+#include "Microtasks.h"
 #include "MutationObserver.h"
 
 #if ENABLE(INDEXED_DATABASE)
@@ -43,7 +45,7 @@
     IDBPendingTransactionMonitor::deactivateNewTransactions();
 #endif
 
-    MutationObserver::deliverAllMutations();
+    MicrotaskQueue::mainThreadQueue().performMicrotaskCheckpoint();
 }
 
 JSC::JSValue functionCallHandlerFromAnyThread(JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args, NakedPtr<JSC::Exception>& returnedException)

Added: trunk/Source/WebCore/dom/ActiveDOMCallbackMicrotask.cpp (0 => 193286)


--- trunk/Source/WebCore/dom/ActiveDOMCallbackMicrotask.cpp	                        (rev 0)
+++ trunk/Source/WebCore/dom/ActiveDOMCallbackMicrotask.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ActiveDOMCallbackMicrotask.h"
+
+namespace WebCore {
+
+ActiveDOMCallbackMicrotask::ActiveDOMCallbackMicrotask(MicrotaskQueue& queue, ScriptExecutionContext& scriptExecutionContext, std::function<void()>&& task)
+    : ActiveDOMCallback(&scriptExecutionContext)
+    , m_queue(queue)
+    , m_task(WTF::move(task))
+{
+}
+
+ActiveDOMCallbackMicrotask::~ActiveDOMCallbackMicrotask()
+{
+}
+
+Microtask::Result ActiveDOMCallbackMicrotask::run()
+{
+    if (!canInvokeCallback())
+        return Result::KeepInQueue;
+
+    m_task();
+    return Result::Done;
+}
+
+void ActiveDOMCallbackMicrotask::contextDestroyed()
+{
+    // NOTE: Calling the function below will cause this to be destroyed.
+    removeSelfFromQueue(m_queue);
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/dom/ActiveDOMCallbackMicrotask.h (0 => 193286)


--- trunk/Source/WebCore/dom/ActiveDOMCallbackMicrotask.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/ActiveDOMCallbackMicrotask.h	2015-12-03 19:06:45 UTC (rev 193286)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ActiveDOMCallbackMicrotask_h
+#define ActiveDOMCallbackMicrotask_h
+
+#include "ActiveDOMCallback.h"
+#include "Microtasks.h"
+#include <functional>
+
+namespace WebCore {
+
+class ActiveDOMCallbackMicrotask : public Microtask, public ActiveDOMCallback {
+public:
+    WEBCORE_EXPORT ActiveDOMCallbackMicrotask(MicrotaskQueue&, ScriptExecutionContext&, std::function<void()>&&);
+    virtual ~ActiveDOMCallbackMicrotask();
+
+    virtual Result run() override;
+
+private:
+    virtual void contextDestroyed() override;
+
+    // FIXME: It should not be necessary to have the queue as a member. Instead, it should
+    // be accessed via the ScriptExecutionContext, which should hold a reference to the relevent
+    // queue.
+    MicrotaskQueue& m_queue;
+    std::function<void()> m_task;
+};
+
+} // namespace WebCore
+
+#endif // ActiveDOMCallbackMicrotask_h

Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (193285 => 193286)


--- trunk/Source/WebCore/dom/DOMAllInOne.cpp	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -25,6 +25,7 @@
 
 // This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
 
+#include "ActiveDOMCallbackMicrotask.cpp"
 #include "ActiveDOMObject.cpp"
 #include "AnimationEvent.cpp"
 #include "Attr.cpp"
@@ -97,7 +98,7 @@
 #include "MessageEvent.cpp"
 #include "MessagePort.cpp"
 #include "MessagePortChannel.cpp"
-#include "MicroTask.cpp"
+#include "Microtasks.cpp"
 #include "MouseEvent.cpp"
 #include "MouseRelatedEvent.cpp"
 #include "MutationEvent.cpp"

Deleted: trunk/Source/WebCore/dom/MicroTask.cpp (193285 => 193286)


--- trunk/Source/WebCore/dom/MicroTask.cpp	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/dom/MicroTask.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2014 Yoav Weiss (y...@yoav.ws)
- * Copyright (C) 2015 Akamai Technologies Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "MicroTask.h"
-
-#include "Document.h"
-
-namespace WebCore {
-
-MicroTaskQueue& MicroTaskQueue::singleton()
-{
-    ASSERT(isMainThread());
-    static NeverDestroyed<MicroTaskQueue> queue;
-    return queue;
-}
-
-void MicroTaskQueue::queueMicroTask(std::unique_ptr<MicroTask> task)
-{
-    ASSERT(isMainThread());
-    m_microTaskQueue.append(WTF::move(task));
-}
-
-void MicroTaskQueue::runMicroTasks()
-{
-    ASSERT(isMainThread());
-    for (auto& task : m_microTaskQueue)
-        task->run();
-    m_microTaskQueue.clear();
-}
-
-} // namespace WebCore
-

Deleted: trunk/Source/WebCore/dom/MicroTask.h (193285 => 193286)


--- trunk/Source/WebCore/dom/MicroTask.h	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/dom/MicroTask.h	2015-12-03 19:06:45 UTC (rev 193286)
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2014 Yoav Weiss (y...@yoav.ws)
- * Copyright (C) 2015 Akamai Technologies Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef MicroTask_h
-#define MicroTask_h
-
-#include <wtf/NeverDestroyed.h>
-#include <wtf/Vector.h>
-
-
-namespace WebCore {
-
-class MicroTask {
-public:
-    virtual void run() = 0;
-    virtual ~MicroTask() { }
-};
-
-class MicroTaskQueue {
-    friend NeverDestroyed<MicroTaskQueue>;
-
-public:
-    WEBCORE_EXPORT static MicroTaskQueue& singleton();
-    ~MicroTaskQueue() { }
-
-    WEBCORE_EXPORT void queueMicroTask(std::unique_ptr<MicroTask>);
-
-    void runMicroTasks();
-
-private:
-    MicroTaskQueue() { }
-    Vector<std::unique_ptr<MicroTask>> m_microTaskQueue;
-};
-
-} // namespace WebCore
-
-#endif // MicroTask_h

Copied: trunk/Source/WebCore/dom/Microtasks.cpp (from rev 192969, trunk/Source/WebCore/dom/MicroTask.cpp) (0 => 193286)


--- trunk/Source/WebCore/dom/Microtasks.cpp	                        (rev 0)
+++ trunk/Source/WebCore/dom/Microtasks.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2014 Yoav Weiss (y...@yoav.ws)
+ * Copyright (C) 2015 Akamai Technologies Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "Microtasks.h"
+
+#include <wtf/MainThread.h>
+#include <wtf/TemporaryChange.h>
+
+namespace WebCore {
+
+void Microtask::removeSelfFromQueue(MicrotaskQueue& queue)
+{
+    queue.remove(*this);
+}
+
+MicrotaskQueue::MicrotaskQueue()
+    : m_timer(*this, &MicrotaskQueue::timerFired)
+{
+}
+
+MicrotaskQueue::~MicrotaskQueue()
+{
+}
+
+MicrotaskQueue& MicrotaskQueue::mainThreadQueue()
+{
+    ASSERT(isMainThread());
+    static NeverDestroyed<MicrotaskQueue> queue;
+    return queue;
+}
+
+void MicrotaskQueue::append(std::unique_ptr<Microtask>&& task)
+{
+    if (m_performingMicrotaskCheckpoint)
+        m_tasksAppendedDuringMicrotaskCheckpoint.append(WTF::move(task));
+    else
+        m_microtaskQueue.append(WTF::move(task));
+
+    m_timer.startOneShot(0);
+}
+
+void MicrotaskQueue::remove(const Microtask& task)
+{
+    for (size_t i = 0; i < m_microtaskQueue.size(); ++i) {
+        if (m_microtaskQueue[i].get() == &task) {
+            m_microtaskQueue.remove(i);
+            return;
+        }
+    }
+    for (size_t i = 0; i < m_tasksAppendedDuringMicrotaskCheckpoint.size(); ++i) {
+        if (m_tasksAppendedDuringMicrotaskCheckpoint[i].get() == &task) {
+            m_tasksAppendedDuringMicrotaskCheckpoint.remove(i);
+            return;
+        }
+    }
+}
+
+void MicrotaskQueue::timerFired()
+{
+    performMicrotaskCheckpoint();
+}
+
+void MicrotaskQueue::performMicrotaskCheckpoint()
+{
+    if (m_performingMicrotaskCheckpoint)
+        return;
+
+    TemporaryChange<bool> change(m_performingMicrotaskCheckpoint, true);
+
+    Vector<std::unique_ptr<Microtask>> queue = WTF::move(m_microtaskQueue);
+    for (auto& task : queue) {
+        auto result = task->run();
+        switch (result) {
+        case Microtask::Result::Done:
+            break;
+        case Microtask::Result::KeepInQueue:
+            m_microtaskQueue.append(WTF::move(task));
+            break;
+        }
+    }
+
+    for (auto& task : m_tasksAppendedDuringMicrotaskCheckpoint)
+        m_microtaskQueue.append(WTF::move(task));
+    m_tasksAppendedDuringMicrotaskCheckpoint.clear();
+}
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/dom/Microtasks.h (from rev 192969, trunk/Source/WebCore/dom/MicroTask.h) (0 => 193286)


--- trunk/Source/WebCore/dom/Microtasks.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/Microtasks.h	2015-12-03 19:06:45 UTC (rev 193286)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2014 Yoav Weiss (y...@yoav.ws)
+ * Copyright (C) 2015 Akamai Technologies Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef Microtasks_h
+#define Microtasks_h
+
+#include "Timer.h"
+#include <wtf/NeverDestroyed.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class MicrotaskQueue;
+
+class Microtask {
+public:
+    virtual ~Microtask()
+    {
+    }
+
+    enum class Result {
+        Done,
+        KeepInQueue
+    };
+
+    virtual Result run() = 0;
+
+protected:
+    void removeSelfFromQueue(MicrotaskQueue&);
+};
+
+class MicrotaskQueue {
+    friend NeverDestroyed<MicrotaskQueue>;
+    friend class Microtask;
+public:
+    WEBCORE_EXPORT static MicrotaskQueue& mainThreadQueue();
+
+    WEBCORE_EXPORT MicrotaskQueue();
+    WEBCORE_EXPORT ~MicrotaskQueue();
+
+    WEBCORE_EXPORT void append(std::unique_ptr<Microtask>&&);
+    WEBCORE_EXPORT void performMicrotaskCheckpoint();
+
+private:
+    WEBCORE_EXPORT void remove(const Microtask&);
+
+    void timerFired();
+
+    bool m_performingMicrotaskCheckpoint = false;
+    Vector<std::unique_ptr<Microtask>> m_microtaskQueue;
+    Vector<std::unique_ptr<Microtask>> m_tasksAppendedDuringMicrotaskCheckpoint;
+
+    // FIXME: Instead of a Timer, we should have a centralized Event Loop that calls performMicrotaskCheckpoint()
+    // on every iteration, implementing https://html.spec.whatwg.org/multipage/webappapis.html#processing-model-9
+    Timer m_timer;
+};
+
+} // namespace WebCore
+
+#endif // Microtask_h

Modified: trunk/Source/WebCore/dom/MutationObserver.cpp (193285 => 193286)


--- trunk/Source/WebCore/dom/MutationObserver.cpp	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/dom/MutationObserver.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -35,6 +35,7 @@
 #include "Dictionary.h"
 #include "Document.h"
 #include "ExceptionCode.h"
+#include "Microtasks.h"
 #include "MutationCallback.h"
 #include "MutationObserverRegistration.h"
 #include "MutationRecord.h"
@@ -154,17 +155,54 @@
     return suspendedObservers;
 }
 
+static bool mutationObserverCompoundMicrotaskQueuedFlag;
+
+class MutationObserverMicrotask : public Microtask {
+public:
+    MutationObserverMicrotask()
+    {
+    }
+
+    virtual ~MutationObserverMicrotask()
+    {
+    }
+
+private:    
+    virtual Result run()
+    {
+        mutationObserverCompoundMicrotaskQueuedFlag = false;
+
+        MutationObserver::deliverAllMutations();
+
+        return Result::Done;
+    }
+};
+
+static void queueMutationObserverCompoundMicrotask()
+{
+    if (mutationObserverCompoundMicrotaskQueuedFlag)
+        return;
+    mutationObserverCompoundMicrotaskQueuedFlag = true;
+
+    auto microtask = std::make_unique<MutationObserverMicrotask>();
+    MicrotaskQueue::mainThreadQueue().append(WTF::move(microtask));
+}
+
 void MutationObserver::enqueueMutationRecord(PassRefPtr<MutationRecord> mutation)
 {
     ASSERT(isMainThread());
     m_records.append(mutation);
     activeMutationObservers().add(this);
+
+    queueMutationObserverCompoundMicrotask();
 }
 
 void MutationObserver::setHasTransientRegistration()
 {
     ASSERT(isMainThread());
     activeMutationObservers().add(this);
+
+    queueMutationObserverCompoundMicrotask();
 }
 
 HashSet<Node*> MutationObserver::getObservedNodes() const

Modified: trunk/Source/WebCore/dom/MutationObserver.h (193285 => 193286)


--- trunk/Source/WebCore/dom/MutationObserver.h	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/dom/MutationObserver.h	2015-12-03 19:06:45 UTC (rev 193286)
@@ -53,6 +53,7 @@
 typedef unsigned char MutationRecordDeliveryOptions;
 
 class MutationObserver : public RefCounted<MutationObserver> {
+    friend class MutationObserverMicrotask;
 public:
     enum MutationType {
         ChildList = 1 << 0,
@@ -73,7 +74,6 @@
     };
 
     static Ref<MutationObserver> create(PassRefPtr<MutationCallback>);
-    static void deliverAllMutations();
 
     ~MutationObserver();
 
@@ -94,6 +94,7 @@
     explicit MutationObserver(PassRefPtr<MutationCallback>);
     void deliver();
 
+    static void deliverAllMutations();
     static bool validateOptions(MutationObserverOptions);
 
     RefPtr<MutationCallback> m_callback;

Modified: trunk/Source/WebCore/dom/ScriptRunner.cpp (193285 => 193286)


--- trunk/Source/WebCore/dom/ScriptRunner.cpp	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/dom/ScriptRunner.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -28,7 +28,6 @@
 
 #include "CachedScript.h"
 #include "Element.h"
-#include "MicroTask.h"
 #include "PendingScript.h"
 #include "ScriptElement.h"
 
@@ -120,7 +119,6 @@
         toScriptElementIfPossible(element.get())->execute(cachedScript);
         m_document.decrementLoadEventDelayCount();
     }
-    MicroTaskQueue::singleton().runMicroTasks();
 }
 
 }

Modified: trunk/Source/WebCore/html/parser/HTMLScriptRunner.cpp (193285 => 193286)


--- trunk/Source/WebCore/html/parser/HTMLScriptRunner.cpp	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/html/parser/HTMLScriptRunner.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -35,7 +35,7 @@
 #include "HTMLNames.h"
 #include "HTMLScriptRunnerHost.h"
 #include "IgnoreDestructiveWriteCountIncrementer.h"
-#include "MicroTask.h"
+#include "Microtasks.h"
 #include "MutationObserver.h"
 #include "NestingLevelIncrementer.h"
 #include "NotImplemented.h"
@@ -129,10 +129,8 @@
     if (pendingScript.cachedScript() && pendingScript.watchingForLoad())
         stopWatchingForLoad(pendingScript);
 
-    if (!isExecutingScript()) {
-        MutationObserver::deliverAllMutations();
-        MicroTaskQueue::singleton().runMicroTasks();
-    }
+    if (!isExecutingScript())
+        MicrotaskQueue::mainThreadQueue().performMicrotaskCheckpoint();
 
     // Clear the pending script before possible rentrancy from executeScript()
     RefPtr<Element> element = pendingScript.releaseElementAndClear();
@@ -233,8 +231,6 @@
         if (!m_document)
             return false;
     }
-    if (!isExecutingScript())
-        MicroTaskQueue::singleton().runMicroTasks();
     return true;
 }
 
@@ -297,10 +293,8 @@
         // every script element, even if it's not ready to execute yet. There's
         // unfortuantely no obvious way to tell if prepareScript is going to
         // execute the script from out here.
-        if (!isExecutingScript()) {
-            MutationObserver::deliverAllMutations();
-            MicroTaskQueue::singleton().runMicroTasks();
-        }
+        if (!isExecutingScript())
+            MicrotaskQueue::mainThreadQueue().performMicrotaskCheckpoint();
 
         InsertionPointRecord insertionPointRecord(m_host.inputStream());
         NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel);

Modified: trunk/Source/WebCore/testing/Internals.cpp (193285 => 193286)


--- trunk/Source/WebCore/testing/Internals.cpp	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/testing/Internals.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -28,6 +28,7 @@
 #include "Internals.h"
 
 #include "AXObjectCache.h"
+#include "ActiveDOMCallbackMicrotask.h"
 #include "AnimationController.h"
 #include "ApplicationCacheStorage.h"
 #include "BackForwardController.h"
@@ -81,8 +82,6 @@
 #include "MediaPlayer.h"
 #include "MemoryCache.h"
 #include "MemoryInfo.h"
-#include "MicroTask.h"
-#include "MicroTaskTest.h"
 #include "MockPageOverlayClient.h"
 #include "Page.h"
 #include "PageCache.h"
@@ -3055,8 +3054,15 @@
 
 void Internals::queueMicroTask(int testNumber)
 {
-    if (contextDocument())
-        MicroTaskQueue::singleton().queueMicroTask(std::make_unique<MicroTaskTest>(contextDocument()->createWeakPtr(), testNumber));
+    Document* document = contextDocument();
+    if (!document)
+        return;
+
+    auto microtask = std::make_unique<ActiveDOMCallbackMicrotask>(MicrotaskQueue::mainThreadQueue(), *document, [document, testNumber]() {
+        document->addConsoleMessage(MessageSource::JS, MessageLevel::Debug, makeString("MicroTask #", String::number(testNumber), " has run."));
+    });
+
+    MicrotaskQueue::mainThreadQueue().append(WTF::move(microtask));
 }
 
 #if ENABLE(CONTENT_FILTERING)

Deleted: trunk/Source/WebCore/testing/MicroTaskTest.cpp (193285 => 193286)


--- trunk/Source/WebCore/testing/MicroTaskTest.cpp	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/testing/MicroTaskTest.cpp	2015-12-03 19:06:45 UTC (rev 193286)
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2015 Akamai Technologies Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "MicroTaskTest.h"
-
-#include "Document.h"
-
-namespace WebCore {
-
-void MicroTaskTest::run()
-{
-    if (m_document)
-        m_document->addConsoleMessage(MessageSource::JS, MessageLevel::Debug, makeString("MicroTask #", String::number(m_testNumber), " has run."));
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/testing/MicroTaskTest.h (193285 => 193286)


--- trunk/Source/WebCore/testing/MicroTaskTest.h	2015-12-03 19:06:40 UTC (rev 193285)
+++ trunk/Source/WebCore/testing/MicroTaskTest.h	2015-12-03 19:06:45 UTC (rev 193286)
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2015 Akamai Technologies Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef MicroTaskTest_h
-#define MicroTaskTest_h
-
-#include "MicroTask.h"
-#include <wtf/WeakPtr.h>
-
-namespace WebCore {
-
-class Document;
-
-class MicroTaskTest : public MicroTask {
-public:
-    MicroTaskTest(WeakPtr<Document> document, int testNumber)
-        : m_document(document)
-        , m_testNumber(testNumber)
-    {
-    }
-
-    virtual void run() override;
-    WEBCORE_TESTSUPPORT_EXPORT static std::unique_ptr<MicroTaskTest> create(WeakPtr<Document>, int testNumber);
-
-private:
-    WeakPtr<Document> m_document;
-    int m_testNumber;
-};
-
-} // namespace WebCore
-
-#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to