Changeset 232156 in webkit
- Timestamp:
- May 24, 2018, 11:10:05 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/platform/ios/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/bindings/js/JSDOMPromise.cpp (modified) (2 diffs)
-
Source/WebCore/bindings/js/JSDOMPromise.h (modified) (1 diff)
-
Source/WebCore/bindings/js/JSDOMPromiseDeferred.cpp (modified) (2 diffs)
-
Source/WebCore/bindings/js/JSDOMPromiseDeferred.h (modified) (2 diffs)
-
Source/WebCore/workers/service/ServiceWorkerContainer.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r232155 r232156 1 2018-05-24 Chris Dumez <cdumez@apple.com> 2 3 [iOS WK2] Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-fetch-event.https.html is a flaky failure 4 https://bugs.webkit.org/show_bug.cgi?id=181499 5 <rdar://problem/36443428> 6 7 Reviewed by Youenn Fablet. 8 9 Unskip test that should no longer be flaky. 10 11 * platform/ios/TestExpectations: 12 1 13 2018-05-24 Jinho Bang <zino@chromium.org> 2 14 -
trunk/LayoutTests/platform/ios/TestExpectations
r232107 r232156 3268 3268 webkit.org/b/180062 fast/text/user-installed-fonts/shadow-postscript-family.html [ ImageOnlyFailure ] 3269 3269 3270 webkit.org/b/181499 [ Release ] imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-fetch-event.https.html [ Pass Failure ]3271 3272 3270 webkit.org/b/181838 js/slow-stress/Int32Array-alloc-huge-long-lived.html [ Slow ] 3273 3271 -
trunk/Source/WebCore/ChangeLog
r232155 r232156 1 2018-05-24 Chris Dumez <cdumez@apple.com> 2 3 [iOS WK2] Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/update-after-navigation-fetch-event.https.html is a flaky failure 4 https://bugs.webkit.org/show_bug.cgi?id=181499 5 <rdar://problem/36443428> 6 7 Reviewed by Youenn Fablet. 8 9 After resolving a registration promise, we send an IPC back to the StorageProcess 10 for synchronization purposes, to make sure the registration does not get updated 11 before the promise's JS code has been executed. However, resolving a promise 12 schedules a microtask to run the JS and we would therefore send the IPC back too 13 early, thus causing flakiness. We now only send the IPC back back only after that 14 microtask has run and the JS has been executed. 15 16 * bindings/js/JSDOMPromiseDeferred.cpp: 17 (WebCore::DeferredPromise::callFunction): 18 (WebCore::DeferredPromise::whenSettled): 19 * bindings/js/JSDOMPromiseDeferred.h: 20 * workers/service/ServiceWorkerContainer.cpp: 21 (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration): 22 1 23 2018-05-24 Jinho Bang <zino@chromium.org> 2 24 -
trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp
r231839 r232156 54 54 void DOMPromise::whenSettled(std::function<void()>&& callback) 55 55 { 56 auto& state = *globalObject()->globalExec(); 56 whenPromiseIsSettled(globalObject(), promise(), WTFMove(callback)); 57 } 58 59 void DOMPromise::whenPromiseIsSettled(JSDOMGlobalObject* globalObject, JSC::JSObject* promise, std::function<void()>&& callback) 60 { 61 auto& state = *globalObject->globalExec(); 57 62 auto& vm = state.vm(); 58 63 JSLockHolder lock(vm); 59 auto* handler = JSC::JSNativeStdFunction::create(vm, globalObject (), 1, String { }, [callback = WTFMove(callback)] (ExecState*) mutable {64 auto* handler = JSC::JSNativeStdFunction::create(vm, globalObject, 1, String { }, [callback = WTFMove(callback)] (ExecState*) mutable { 60 65 callback(); 61 66 return JSC::JSValue::encode(JSC::jsUndefined()); … … 63 68 64 69 const JSC::Identifier& privateName = vm.propertyNames->builtinNames().thenPrivateName(); 65 auto* promise = this->promise();66 70 auto thenFunction = promise->get(&state, privateName); 67 71 ASSERT(thenFunction.isFunction(vm)); -
trunk/Source/WebCore/bindings/js/JSDOMPromise.h
r228218 r232156 51 51 Status status() const; 52 52 53 static void whenPromiseIsSettled(JSDOMGlobalObject*, JSC::JSObject* promise, std::function<void()>&&); 54 53 55 private: 54 56 DOMPromise(JSDOMGlobalObject& globalObject, JSC::JSPromise& promise) -
trunk/Source/WebCore/bindings/js/JSDOMPromiseDeferred.cpp
r228218 r232156 28 28 29 29 #include "DOMWindow.h" 30 #include "JSDOMPromise.h" 30 31 #include "JSDOMWindow.h" 31 32 #include <JavaScriptCore/BuiltinNames.h> … … 69 70 } 70 71 72 void DeferredPromise::whenSettled(std::function<void()>&& callback) 73 { 74 DOMPromise::whenPromiseIsSettled(globalObject(), deferred()->promise(), WTFMove(callback)); 75 } 76 71 77 void DeferredPromise::reject() 72 78 { -
trunk/Source/WebCore/bindings/js/JSDOMPromiseDeferred.h
r230764 r232156 135 135 JSC::JSValue promise() const; 136 136 137 void whenSettled(std::function<void()>&&); 138 137 139 private: 138 140 DeferredPromise(JSDOMGlobalObject& globalObject, JSC::JSPromiseDeferred& deferred, Mode mode) … … 145 147 146 148 WEBCORE_EXPORT void callFunction(JSC::ExecState&, JSC::JSValue function, JSC::JSValue resolution); 149 147 150 void resolve(JSC::ExecState& state, JSC::JSValue resolution) { callFunction(state, deferred()->resolve(), resolution); } 148 151 void reject(JSC::ExecState& state, JSC::JSValue resolution) { callFunction(state, deferred()->reject(), resolution); } -
trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp
r230009 r232156 420 420 } 421 421 422 WTF::Function<void()> notifyWhenResolvedIfNeeded = [] { };422 std::function<void()> notifyWhenResolvedIfNeeded; 423 423 if (shouldNotifyWhenResolved == ShouldNotifyWhenResolved::Yes) { 424 notifyWhenResolvedIfNeeded = [connection = m_swConnection, registrationKey = data.key .isolatedCopy()]() mutable {425 callOnMainThread([connection = WTFMove(connection), registrationKey = WTFMove(registrationKey)] {424 notifyWhenResolvedIfNeeded = [connection = m_swConnection, registrationKey = data.key]() mutable { 425 callOnMainThread([connection = WTFMove(connection), registrationKey = registrationKey.isolatedCopy()] { 426 426 connection->didResolveRegistrationPromise(registrationKey); 427 427 }); … … 430 430 431 431 if (isStopped()) { 432 notifyWhenResolvedIfNeeded(); 432 if (notifyWhenResolvedIfNeeded) 433 notifyWhenResolvedIfNeeded(); 433 434 return; 434 435 } 435 436 436 437 if (!job.promise()) { 437 notifyWhenResolvedIfNeeded(); 438 if (notifyWhenResolvedIfNeeded) 439 notifyWhenResolvedIfNeeded(); 438 440 return; 439 441 } … … 441 443 scriptExecutionContext()->postTask([this, protectedThis = makeRef(*this), job = makeRef(job), data = WTFMove(data), notifyWhenResolvedIfNeeded = WTFMove(notifyWhenResolvedIfNeeded)](ScriptExecutionContext& context) mutable { 442 444 if (isStopped() || !context.sessionID().isValid()) { 443 notifyWhenResolvedIfNeeded(); 445 if (notifyWhenResolvedIfNeeded) 446 notifyWhenResolvedIfNeeded(); 444 447 return; 445 448 } … … 449 452 CONTAINER_RELEASE_LOG_IF_ALLOWED("jobResolvedWithRegistration: Resolving promise for job %" PRIu64 ". Registration ID: %" PRIu64, job->identifier().toUInt64(), registration->identifier().toUInt64()); 450 453 454 if (notifyWhenResolvedIfNeeded) { 455 job->promise()->whenSettled([notifyWhenResolvedIfNeeded = WTFMove(notifyWhenResolvedIfNeeded)] { 456 notifyWhenResolvedIfNeeded(); 457 }); 458 } 459 451 460 job->promise()->resolve<IDLInterface<ServiceWorkerRegistration>>(WTFMove(registration)); 452 453 notifyWhenResolvedIfNeeded();454 461 }); 455 462 }
Note:
See TracChangeset
for help on using the changeset viewer.