Bug 205440 - DOMPromise::whenPromiseIsSettled is asserting in service worker
Summary: DOMPromise::whenPromiseIsSettled is asserting in service worker
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-12-19 00:09 PST by youenn fablet
Modified: 2019-12-20 05:16 PST (History)
4 users (show)

See Also:


Attachments
Patch (3.02 KB, patch)
2019-12-19 00:47 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (3.23 KB, patch)
2019-12-20 03:47 PST, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2019-12-19 00:09:41 PST
DOMPromise::whenPromiseIsSettled is asserting in service worker

ASSERTION FAILED: !scope.exception() || !hasProperty
/Volumes/Data/slave/ios-simulator-13-debug/build/WebKitBuild/Debug-iphonesimulator/JavaScriptCore.framework/PrivateHeaders/JSObject.h(1471) : JSC::JSValue JSC::JSObject::get(JSC::JSGlobalObject *, JSC::PropertyName) const
1   0x40e414579 WTFCrash
2   0x4130c551b WTFCrashWithInfo(int, char const*, char const*, int)
3   0x4132f2856 JSC::JSObject::get(JSC::JSGlobalObject*, JSC::PropertyName) const
4   0x414f7f12a WebCore::DOMPromise::whenPromiseIsSettled(WebCore::JSDOMGlobalObject*, JSC::JSObject*, WTF::Function<void ()>&&)
5   0x414f7ef97 WebCore::DOMPromise::whenSettled(std::__1::function<void ()>&&)
6   0x4172d84a8 WebCore::FetchEvent::respondWith(WTF::Ref<WebCore::DOMPromise, WTF::DumbPtrTraits<WebCore::DOMPromise> >&&)
7   0x4139dee86 WebCore::jsFetchEventPrototypeFunctionRespondWithBody(JSC::JSGlobalObject*, JSC::CallFrame*, WebCore::JSFetchEvent*, JSC::ThrowScope&)
8   0x41396cd0f long long WebCore::IDLOperation<WebCore::JSFetchEvent>::call<&(WebCore::jsFetchEventPrototypeFunctionRespondWithBody(JSC::JSGlobalObject*, JSC::CallFrame*, WebCore::JSFetchEvent*, JSC::ThrowScope&)), (WebCore::CastedThisErrorBehavior)0>(JSC::JSGlobalObject&, JSC::CallFrame&, char const*)
9   0x41396c9f4 WebCore::jsFetchEventPrototypeFunctionRespondWith(JSC::JSGlobalObject*, JSC::CallFrame*)
10  0x33f2966012ab
11  0x40e7abcb7 llint_entry
12  0x40e78eee3 vmEntryToJavaScript
13  0x40f1d9627 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*)
14  0x40f1d9c6e JSC::Interpreter::executeCall(JSC::JSGlobalObject*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
15  0x40f4e59ec JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
16  0x40f4e5ada JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr<JSC::Exception>&)
17  0x40f4e5dce JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr<JSC::Exception>&)
18  0x414f6ed28 WebCore::JSExecState::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr<JSC::Exception>&)
19  0x414f8b3ac WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext&, WebCore::Event&)
20  0x4155f9dfc WebCore::EventTarget::innerInvokeEventListeners(WebCore::Event&, WTF::Vector<WTF::RefPtr<WebCore::RegisteredEventListener, WTF::DumbPtrTraits<WebCore::RegisteredEventListener> >, 1ul, WTF::CrashOnOverflow, 16ul>, WebCore::EventTarget::EventInvokePhase)
21  0x4155f5fa2 WebCore::EventTarget::fireEventListeners(WebCore::Event&, WebCore::EventTarget::EventInvokePhase)
22  0x4155f99dd WebCore::EventTarget::dispatchEvent(WebCore::Event&)
23  0x41735a2ee WebCore::ServiceWorkerFetch::dispatchFetchEvent(WTF::Ref<WebCore::ServiceWorkerFetch::Client, WTF::DumbPtrTraits<WebCore::ServiceWorkerFetch::Client> >&&, WebCore::ServiceWorkerGlobalScope&, WTF::Optional<WebCore::ServiceWorkerClientIdentifier>, WebCore::ResourceRequest&&, WTF::String&&, WebCore::FetchOptions&&)
24  0x41738a63a WebCore::ServiceWorkerThread::queueTaskToFireFetchEvent(WTF::Ref<WebCore::ServiceWorkerFetch::Client, WTF::DumbPtrTraits<WebCore::ServiceWorkerFetch::Client> >&&, WTF::Optional<WebCore::ServiceWorkerClientIdentifier>&&, WebCore::ResourceRequest&&, WTF::String&&, WebCore::FetchOptions&&)::$_24::operator()()
25  0x41738a259 WTF::Detail::CallableWrapper<WebCore::ServiceWorkerThread::queueTaskToFireFetchEvent(WTF::Ref<WebCore::ServiceWorkerFetch::Client, WTF::DumbPtrTraits<WebCore::ServiceWorkerFetch::Client> >&&, WTF::Optional<WebCore::ServiceWorkerClientIdentifier>&&, WebCore::ResourceRequest&&, WTF::String&&, WebCore::FetchOptions&&)::$_24, void>::call()
26  0x4130d962a WTF::Function<void ()>::operator()() const
27  0x4155eb0e9 WebCore::EventLoopFunctionDispatchTask::execute()
28  0x4155e5b6a WebCore::EventLoop::run()
29  0x4172c0df1 WebCore::WorkerEventLoop::scheduleToRun()::$_1::operator()(WebCore::ScriptExecutionContext&) const
30  0x4172c0b61 WTF::Detail::CallableWrapper<WebCore::WorkerEventLoop::scheduleToRun()::$_1, void, WebCore::ScriptExecutionContext&>::call(WebCore::ScriptExecutionContext&)
31  0x414dfab87 WTF::Function<void (WebCore::ScriptExecutionContext&)>::operator()(WebCore::ScriptExecutionContext&) const
Comment 1 youenn fablet 2019-12-19 00:47:15 PST
Created attachment 386080 [details]
Patch
Comment 2 Chris Dumez 2019-12-19 10:15:05 PST
Comment on attachment 386080 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=386080&action=review

> Source/WebCore/ChangeLog:7
> +

Can you please explain what your change does and why?
Comment 3 youenn fablet 2019-12-19 10:17:14 PST
(In reply to Chris Dumez from comment #2)
> Comment on attachment 386080 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=386080&action=review
> 
> > Source/WebCore/ChangeLog:7
> > +
> 
> Can you please explain what your change does and why?

OK, will add something like the following to the change log:
The promise.get(@then) is sometimes throwing an exception probably due to service worker being stopped. We need to catch the JS exception and exit early if the getter fails.
Comment 4 youenn fablet 2019-12-20 03:47:16 PST
Created attachment 386197 [details]
Patch for landing
Comment 5 WebKit Commit Bot 2019-12-20 05:15:32 PST
Comment on attachment 386197 [details]
Patch for landing

Clearing flags on attachment: 386197

Committed r253813: <https://trac.webkit.org/changeset/253813>
Comment 6 WebKit Commit Bot 2019-12-20 05:15:33 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-12-20 05:16:35 PST
<rdar://problem/58110810>