Bug 265263

Summary: Worker IDL Interface is not exposed to 'SharedWorker'
Product: WebKit Reporter: Ahmad Saleem <ahmad.saleem792>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: cdumez, fujii.hironori, mike, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Ahmad Saleem
Reported 2023-11-22 12:23:50 PST
Hi Team, While looking into Workers.idl file in WebKit, I noticed that it is not exposed to 'SharedWorker' as per Web standard. Web-Spec: https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-worker-interface WebKit Source: https://searchfox.org/wubkat/rev/225be872c8ca8c801d73c28d87205f6bef773846/Source/WebCore/workers/Worker.idl#29 It might be leading to following WPT test failure (didn't test or confirmed). WPT Test Case: https://wpt.fyi/results/workers/semantics/interface-objects/003.any.sharedworker.html?label=master&label=experimental&aligned=&q=safari%3Afail Or if it is not progressing above, it might be failing few others. I just wanted to raise so we can fix it. Thanks!
Attachments
Alexey Proskuryakov
Comment 2 2023-11-25 13:37:08 PST
Does it work when exposed? We do support nested workers, but I'm not sure if it automatically means that workers inside shared workers are supported.
Ahmad Saleem
Comment 3 2023-11-25 13:39:40 PST
(In reply to Alexey Proskuryakov from comment #2) > Does it work when exposed? We do support nested workers, but I'm not sure if > it automatically means that workers inside shared workers are supported. Yes, it compiles and progress above mentioned two WPT test cases.
Chris Dumez
Comment 4 2023-11-25 19:58:48 PST
(In reply to Ahmad Saleem from comment #3) > (In reply to Alexey Proskuryakov from comment #2) > > Does it work when exposed? We do support nested workers, but I'm not sure if > > it automatically means that workers inside shared workers are supported. > > Yes, it compiles and progress above mentioned two WPT test cases. It should in theory just work if we expose it. Please upload a PR if you can.
Ahmad Saleem
Comment 5 2023-11-26 05:01:04 PST
Radar WebKit Bug Importer
Comment 6 2023-11-29 12:24:14 PST
Ahmad Saleem
Comment 7 2023-11-30 17:55:56 PST
This change leads to consistent crash in 'debug' build on following test: imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/nested-sharedworker-success.https.html Crash log: https://ews-build.s3-us-west-2.amazonaws.com/macOS-AppleSilicon-Sonoma-Debug-WK2-Tests-EWS/e035bd8d-3120/imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/nested-sharedworker-success.https-crash-log.txt No crash log found for WebKitTestRunner:20478. stdout: stderr: ASSERTION FAILED: RunLoop::isMain() /Volumes/Data/worker/macOS-AppleSilicon-Sonoma-Debug-Build-EWS/build/Source/WebKit/WebProcess/WebProcess.cpp(1183) : NetworkProcessConnection &WebKit::WebProcess::ensureNetworkProcessConnection() 1 0x137dfd248 WTFCrash 2 0x11e725cd0 std::__1::span<unsigned char const, 18446744073709551615ul>::span[abi:v160006]<unsigned char const*>(unsigned char const*, unsigned long) 3 0x120904afc WebKit::WebProcess::ensureNetworkProcessConnection() 4 0x120d24b70 WebKit::WebLoaderStrategy::addOnlineStateChangeListener(WTF::Function<void (bool)>&&) 5 0x285c461a8 WebCore::Worker::Worker(WebCore::ScriptExecutionContext&, JSC::RuntimeFlags, WebCore::WorkerOptions&&) 6 0x285c463b8 WebCore::Worker::Worker(WebCore::ScriptExecutionContext&, JSC::RuntimeFlags, WebCore::WorkerOptions&&) 7 0x285c46434 WebCore::Worker::create(WebCore::ScriptExecutionContext&, JSC::RuntimeFlags, WTF::String const&, WebCore::WorkerOptions&&) 8 0x281fa87cc WebCore::JSDOMConstructor<WebCore::JSWorker>::construct(JSC::JSGlobalObject*, JSC::CallFrame*) 9 0x2a4e54270 8 ??? 0x00000002a4e54270 0x0 + 11356422768 10 0x1384f37c4 llint_entry 11 0x1384f4838 llint_entry 12 0x1384f32ac llint_entry 13 0x1384f32ac llint_entry 14 0x1384f37c4 llint_entry 15 0x1384f32ac llint_entry 16 0x1384ccfb4 vmEntryToJavaScript 17 0x13965b5fc JSC::Interpreter::executeCallImpl(JSC::VM&, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 18 0x13965b6ec JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 19 0x1398ead38 JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 20 0x1398eaff8 JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 21 0x139b4e278 JSC::runJSMicrotask(JSC::JSGlobalObject*, WTF::ObjectIdentifierGeneric<JSC::MicrotaskIdentifierType, WTF::ObjectIdentifierThreadSafeAccessTraits>, JSC::JSValue, JSC::JSValue, JSC::JSValue, JSC::JSValue, JSC::JSValue) 22 0x139b4e424 JSC::JSMicrotask::run(JSC::JSGlobalObject*) 23 0x283150a74 WebCore::JSExecState::runTask(JSC::JSGlobalObject*, JSC::Microtask&) 24 0x28328ef28 WebCore::JSMicrotaskCallback::call() 25 0x28328eea8 WebCore::JSWorkerGlobalScopeBase::queueMicrotaskToEventLoop(JSC::JSGlobalObject&, WTF::Ref<JSC::Microtask, WTF::RawPtrTraits<JSC::Microtask>>&&)::$_3::operator()() 26 0x28328ee04 WTF::Detail::CallableWrapper<WebCore::JSWorkerGlobalScopeBase::queueMicrotaskToEventLoop(JSC::JSGlobalObject&, WTF::Ref<JSC::Microtask, WTF::RawPtrTraits<JSC::Microtask>>&&)::$_3, void>::call() 27 0x2800260e8 WTF::Function<void ()>::operator()() const 28 0x283ab0aec WebCore::EventLoopFunctionDispatchTask::execute() 29 0x283b155c0 WebCore::MicrotaskQueue::performMicrotaskCheckpoint() 30 0x283aa77a4 WebCore::EventLoop::performMicrotaskCheckpoint() 31 0x283aa9f40 WebCore::EventLoopTaskGroup::performMicrotaskCheckpoint() > I think I should close my PR or change to draft till figure out, what could be the reason of above 'assertion'.
Ahmad Saleem
Comment 8 2023-11-30 17:58:09 PST
Although if I look into 'WebProcess.cpp', we only have this as 'RELEASE_ASSERT' except here: https://searchfox.org/wubkat/rev/1531d41a4ef64103835343c7ca448db7defee9de/Source/WebKit/WebProcess/WebProcess.cpp#2139 which is behind: #if HAVE(DISPLAY_LINK)
Ahmad Saleem
Comment 9 2025-12-06 16:35:18 PST
We get this assertion now: ASSERTION FAILED: m_thread.ptr() == &Thread::currentSingleton() /Users/ahmadsaleem/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/SingleThreadIntegralWrapper.h(54) : void WTF::SingleThreadIntegralWrapper<unsigned int>::assertThread() const [IntegralType = unsigned int] 1 0x30004e234 WTF::SingleThreadIntegralWrapper<unsigned int>::assertThread() const 2 0x30004e1a8 WTF::SingleThreadIntegralWrapper<unsigned int>::operator++() 3 0x30004e17c WTF::CanMakeCheckedPtrBase<WTF::SingleThreadIntegralWrapper<unsigned int>, unsigned int, bool, (WTF::CheckedPtrDeleteCheckException)0>::incrementCheckedPtrCount() const 4 0x3071f1de0 WTF::CheckedPtr<WebCore::LoaderStrategy, WTF::RawPtrTraits<WebCore::LoaderStrategy>>::refIfNotNull() 5 0x3071f1e5c WTF::CheckedPtr<WebCore::LoaderStrategy, WTF::RawPtrTraits<WebCore::LoaderStrategy>>::CheckedPtr(WTF::CheckedPtr<WebCore::LoaderStrategy, WTF::RawPtrTraits<WebCore::LoaderStrategy>> const&) 6 0x3071f0094 WTF::CheckedPtr<WebCore::LoaderStrategy, WTF::RawPtrTraits<WebCore::LoaderStrategy>>::CheckedPtr(WTF::CheckedPtr<WebCore::LoaderStrategy, WTF::RawPtrTraits<WebCore::LoaderStrategy>> const&) 7 0x3071effdc WebCore::PlatformStrategies::loaderStrategy() 8 0x308ae448c WebCore::Worker::Worker(WebCore::ScriptExecutionContext&, JSC::RuntimeFlags, WebCore::WorkerOptions&&) 9 0x308ae4710 WebCore::Worker::Worker(WebCore::ScriptExecutionContext&, JSC::RuntimeFlags, WebCore::WorkerOptions&&) 10 0x308ae4824 WebCore::Worker::create(WebCore::ScriptExecutionContext&, JSC::RuntimeFlags, mpark::variant<WTF::RefPtr<WebCore::TrustedScriptURL, WTF::RawPtrTraits<WebCore::TrustedScriptURL>, WTF::DefaultRefDerefTraits<WebCore::TrustedScriptURL>>, WTF::String>&&, WebCore::WorkerOptions&&) 11 0x303012b6c WebCore::JSDOMConstructor<WebCore::JSWorker>::construct(JSC::JSGlobalObject*, JSC::CallFrame*) 12 0x13d070538 11 ??? 0x000000013d070538 0x0 + 5318837560 13 0x13d0380c8 12 ??? 0x000000013d0380c8 0x0 + 5318607048 14 0x13d038248 13 ??? 0x000000013d038248 0x0 + 5318607432 15 0x13d038008 14 ??? 0x000000013d038008 0x0 + 5318606856 16 0x13d038068 15 ??? 0x000000013d038068 0x0 + 5318606952 17 0x13d0380c8 16 ??? 0x000000013d0380c8 0x0 + 5318607048 18 0x13d038428 17 ??? 0x000000013d038428 0x0 + 5318607912 19 0x1325cdde8 JSC::Interpreter::executeCallImpl(JSC::VM&, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::JSCell*, JSC::ArgList const&) 20 0x1325cdf34 JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::JSCell*, JSC::ArgList const&) 21 0x1328ec174 JSC::callMicrotask(JSC::JSGlobalObject*, JSC::JSValue, JSC::JSValue, JSC::JSCell*, JSC::ArgList const&, WTF::ASCIILiteral) 22 0x132be70ec JSC::runInternalMicrotask(JSC::JSGlobalObject*, JSC::InternalMicrotask, std::__1::span<JSC::JSValue const, 4ul>) 23 0x305c6057c WebCore::MicrotaskQueue::runJSMicrotask(JSC::JSGlobalObject*, JSC::VM&, JSC::QueuedTask&) 24 0x305c80fc8 WebCore::MicrotaskQueue::performMicrotaskCheckpoint()::$_0::operator()(JSC::QueuedTask&) const 25 0x305c60abc void JSC::MicrotaskQueue::performMicrotaskCheckpoint<false, WebCore::MicrotaskQueue::performMicrotaskCheckpoint()::$_0>(JSC::VM&, WebCore::MicrotaskQueue::performMicrotaskCheckpoint()::$_0 const&) 26 0x305c607a8 WebCore::MicrotaskQueue::performMicrotaskCheckpoint() 27 0x305bd514c WebCore::EventLoop::performMicrotaskCheckpoint() 28 0x305bd8234 WebCore::EventLoopTaskGroup::performMicrotaskCheckpoint() 29 0x304b9e6c4 WebCore::JSExecState::didLeaveScriptContext(JSC::JSGlobalObject*) 30 0x304bd1034 WebCore::JSExecState::~JSExecState() 31 0x304b9ea88 WebCore::JSExecState::~JSExecState()
Note You need to log in before you can comment on or make changes to this bug.