Add self.queueMicrotask(f) on DOMWindow
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 03:55:47 +0000 (03:55 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 03:55:47 +0000 (03:55 +0000)
commit9907f18285480ec63dacffb32db73ddad85030dd
tree6853b6872f913b8010d26be356e48a0a60a0cc8f
parent890766fea7ed0ab886a17e3e40ee2e4c0832a702
Add self.queueMicrotask(f) on DOMWindow
https://bugs.webkit.org/show_bug.cgi?id=188212

Reviewed by Ryosuke Niwa.

Source/JavaScriptCore:

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* runtime/JSGlobalObject.cpp:
(JSC::enqueueJob):
* runtime/JSMicrotask.cpp: Renamed from Source/JavaScriptCore/runtime/JSJob.cpp.
(JSC::createJSMicrotask):
Export them to WebCore.

(JSC::JSMicrotask::run):
* runtime/JSMicrotask.h: Renamed from Source/JavaScriptCore/runtime/JSJob.h.
Add another version of JSMicrotask which does not have arguments.

Source/WebCore:

This patch adds self.queueMicrotask(f) in DOMWindow, which takes a function and enqueue it into microtask queue.
We do not add this to Worker's global scope since our worker does not support microtasks correctly.

Tests: js/dom/queue-microtask-window.html

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::queueMicrotask):
Post a microtask to JSC's microtask mechanism. This will eventually go to WebCore's MicrotaskQueue code.

* page/DOMWindow.idl:

LayoutTests:

* js/dom/queue-microtask-window-expected.txt: Added.
* js/dom/queue-microtask-window.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234491 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/js/dom/queue-microtask-window-expected.txt [new file with mode: 0644]
LayoutTests/js/dom/queue-microtask-window.html [new file with mode: 0644]
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/Sources.txt
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSMicrotask.cpp [moved from Source/JavaScriptCore/runtime/JSJob.cpp with 72% similarity]
Source/JavaScriptCore/runtime/JSMicrotask.h [moved from Source/JavaScriptCore/runtime/JSJob.h with 90% similarity]
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
Source/WebCore/page/DOMWindow.idl