haikuwebkit/LayoutTests/js/promise-nested-microtasks-e...

17 lines
370 B
Plaintext
Raw Permalink Normal View History

Integrate automatic microtask draining into JSC framework and re-enable Promise https://bugs.webkit.org/show_bug.cgi?id=146828 Reviewed by Sam Weinig. Source/JavaScriptCore: Add automatic microtask draining system into JSC framework. When the depth of VM lock becomes 0, before this, we drain the queued microtasks. Enqueuing behavior can be injected by the JSGlobalObject's method table. It is utilized in WebCore to post the microtask to WebCore's event loop. In the case of JSC interactive shell, VM depth is always greater than 0. So we manually drains the queued microtasks after evaluating the written line. Since now JSC framework has the microtask queue, we can drain the queued microtasks. So re-enable the Promise in the JSC framework context. * API/JSContextRef.cpp: (javaScriptRuntimeFlags): Deleted. * API/tests/testapi.c: (main): * API/tests/testapi.mm: (testObjectiveCAPIMain): * jsc.cpp: (runInteractive): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::queueMicrotask): * runtime/JSLock.cpp: (JSC::JSLock::willReleaseLock): * runtime/VM.cpp: (JSC::VM::queueMicrotask): (JSC::VM::drainMicrotasks): (JSC::QueuedTask::run): * runtime/VM.h: (JSC::QueuedTask::QueuedTask): LayoutTests: Add Promise tests mainly focusing on microtasks. They can be executed in JSC shell. So they are locate in js/ directory (not js/dom). * js/promise-nested-microtasks-expected.txt: Added. * js/promise-nested-microtasks.html: Added. * js/promise-resolve-in-non-dom-expected.txt: Added. * js/promise-resolve-in-non-dom.html: Added. * js/script-tests/promise-nested-microtasks.js: Added. (Promise.resolve.then): * js/script-tests/promise-resolve-non-dom.js: Added. (value.then): * resources/standalone-post.js: Canonical link: https://commits.webkit.org/165100@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-07-17 22:40:40 +00:00
Test Promise nested microtasks.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
The promise is not fulfilled until after this function call executes.
PASS value1 is 42
PASS value2 is undefined.
PASS result is undefined.
PASS value2 is 84
PASS result is undefined.
PASS result is 3528
PASS successfullyParsed is true
TEST COMPLETE