Changeset 227959 in webkit
- Timestamp:
- Feb 1, 2018 3:50:47 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r227958 r227959 1 2018-02-01 Chris Dumez <cdumez@apple.com> 2 3 Queue a microtask when a waitUntil() promise is settled 4 https://bugs.webkit.org/show_bug.cgi?id=182372 5 <rdar://problem/37101019> 6 7 Reviewed by Mark Lam. 8 9 Reaseline WPT test now that all checks are passing. 10 11 * web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt: 12 1 13 2018-02-01 Ms2ger <Ms2ger@igalia.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/extendable-event-async-waituntil.https-expected.txt
r227425 r227959 4 4 PASS Test calling waitUntil in a different microtask without an existing extension throws 5 5 PASS Test calling waitUntil in a different task with an existing extension succeeds 6 FAIL Test calling waitUntil with an existing extension promise handler succeeds assert_unreached: unexpected rejection: assert_equals: expected "OK" but got "InvalidStateError" Reached unreachable code 6 PASS Test calling waitUntil with an existing extension promise handler succeeds 7 7 PASS Test calling waitUntil at the end of the microtask turn throws 8 8 PASS Test calling waitUntil after the current extension expired in a different task fails 9 9 PASS Test calling waitUntil on a script constructed ExtendableEvent throws exception 10 10 PASS Test calling waitUntil asynchronously with pending respondWith promise. 11 FAIL Test calling waitUntil synchronously inside microtask of respondWith promise. assert_unreached: unexpected rejection: assert_equals: expected "OK" but got "InvalidStateError" Reached unreachable code 11 PASS Test calling waitUntil synchronously inside microtask of respondWith promise. 12 12 PASS Test calling waitUntil asynchronously inside microtask of respondWith promise. 13 13 -
trunk/Source/JavaScriptCore/ChangeLog
r227952 r227959 1 2018-02-01 Chris Dumez <cdumez@apple.com> 2 3 Queue a microtask when a waitUntil() promise is settled 4 https://bugs.webkit.org/show_bug.cgi?id=182372 5 <rdar://problem/37101019> 6 7 Reviewed by Mark Lam. 8 9 Export a symbol so it can be used in WebCore. 10 11 * runtime/JSGlobalObject.h: 12 1 13 2018-01-31 Don Olmstead <don.olmstead@sony.com> 2 14 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r227617 r227959 833 833 static RuntimeFlags javaScriptRuntimeFlags(const JSGlobalObject*) { return RuntimeFlags(); } 834 834 835 void queueMicrotask(Ref<Microtask>&&);835 JS_EXPORT_PRIVATE void queueMicrotask(Ref<Microtask>&&); 836 836 837 837 bool evalEnabled() const { return m_evalEnabled; } -
trunk/Source/WebCore/ChangeLog
r227956 r227959 1 2018-02-01 Chris Dumez <cdumez@apple.com> 2 3 Queue a microtask when a waitUntil() promise is settled 4 https://bugs.webkit.org/show_bug.cgi?id=182372 5 <rdar://problem/37101019> 6 7 Reviewed by Mark Lam. 8 9 Queue a microtask when a waitUntil() promise is settled, as per: 10 - https://w3c.github.io/ServiceWorker/#dom-extendableevent-waituntil (step 5) 11 12 Otherwise, we decrement m_pendingPromiseCount too quickly and it may cause 13 following calls to waitUntil() to throw when they shouldn't. 14 15 No new tests, rebaselined existing test. 16 17 * workers/service/ExtendableEvent.cpp: 18 (WebCore::ExtendableEvent::addExtendLifetimePromise): 19 1 20 2018-02-01 Antti Koivisto <antti@apple.com> 2 21 -
trunk/Source/WebCore/workers/service/ExtendableEvent.cpp
r224584 r227959 30 30 31 31 #include "JSDOMPromise.h" 32 #include <runtime/Microtask.h> 32 33 33 34 namespace WebCore { … … 61 62 } 62 63 64 class FunctionMicrotask final : public JSC::Microtask { 65 public: 66 static Ref<FunctionMicrotask> create(Function<void()>&& function) 67 { 68 return adoptRef(*new FunctionMicrotask(WTFMove(function))); 69 } 70 71 private: 72 explicit FunctionMicrotask(Function<void()>&& function) 73 : m_function(WTFMove(function)) 74 { 75 } 76 77 void run(JSC::ExecState*) final 78 { 79 m_function(); 80 } 81 82 Function<void()> m_function; 83 }; 84 63 85 void ExtendableEvent::addExtendLifetimePromise(Ref<DOMPromise>&& promise) 64 86 { 65 promise->whenSettled([this, protectedThis = makeRefPtr(this), settledPromise = promise.ptr()] () { 66 --m_pendingPromiseCount; 87 promise->whenSettled([this, protectedThis = makeRefPtr(this), settledPromise = promise.ptr()] () mutable { 88 settledPromise->globalObject()->queueMicrotask(FunctionMicrotask::create([this, protectedThis = WTFMove(protectedThis)] { 89 --m_pendingPromiseCount; 67 90 68 // FIXME: Let registration be the context object's relevant global object's associated service worker's containing service worker registration.69 // FIXME: If registration's uninstalling flag is set, invoke Try Clear Registration with registration.70 // FIXME: If registration is not null, invoke Try Activate with registration.91 // FIXME: Let registration be the context object's relevant global object's associated service worker's containing service worker registration. 92 // FIXME: If registration's uninstalling flag is set, invoke Try Clear Registration with registration. 93 // FIXME: If registration is not null, invoke Try Activate with registration. 71 94 72 if (m_pendingPromiseCount)73 return;95 if (m_pendingPromiseCount) 96 return; 74 97 75 auto settledPromises = WTFMove(m_extendLifetimePromises); 76 if (auto handler = WTFMove(m_whenAllExtendLifetimePromisesAreSettledHandler)) 77 handler(WTFMove(settledPromises)); 98 auto settledPromises = WTFMove(m_extendLifetimePromises); 99 if (auto handler = WTFMove(m_whenAllExtendLifetimePromisesAreSettledHandler)) 100 handler(WTFMove(settledPromises)); 101 })); 78 102 }); 79 103
Note: See TracChangeset
for help on using the changeset viewer.