-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 4cae7c8. rdar://117727810
Crash under WebCore::createMainThreadConnection(WebCore::WorkerGlobalScope&) https://bugs.webkit.org/show_bug.cgi?id=264222 rdar://117727810 Reviewed by Darin Adler. We're crashing when calling `createCacheStorageConnection()` on the WorkerLoaderProxy which we got from the WorkerThread. I believe the WorkerLoaderProxy reference returned by the WorkerThread is stale, which is possible since it keeps C++ references to its proxies. To address the issue, I updated WorkerThread to keep raw pointers to its proxies instead of C++ references. I am also adding a clearProxies() function to clear those raw pointers once the proxies get destroyed. Finally, I added null checks are proxy use sites now that we null them out. In the future, we should convert this raw pointers into CheckedPtrs. * Source/WebCore/Modules/badge/WorkerBadgeProxy.h: * Source/WebCore/Modules/cache/WorkerCacheStorageConnection.cpp: (WebCore::createMainThreadConnection): * Source/WebCore/Modules/permissions/Permissions.cpp: (WebCore::Permissions::query): * Source/WebCore/Modules/storage/WorkerStorageConnection.cpp: (WebCore::WorkerStorageConnection::getPersisted): (WebCore::WorkerStorageConnection::getEstimate): (WebCore::WorkerStorageConnection::fileSystemGetDirectory): * Source/WebCore/Modules/webaudio/AudioWorkletGlobalScope.cpp: (WebCore::AudioWorkletGlobalScope::registerProcessor): * Source/WebCore/Modules/webaudio/AudioWorkletMessagingProxy.cpp: (WebCore::AudioWorkletMessagingProxy::~AudioWorkletMessagingProxy): * Source/WebCore/Modules/webaudio/AudioWorkletThread.cpp: (WebCore::AudioWorkletThread::clearProxies): (WebCore::AudioWorkletThread::workerLoaderProxy): (WebCore::AudioWorkletThread::messagingProxy): * Source/WebCore/Modules/webaudio/AudioWorkletThread.h: (WebCore::AudioWorkletThread::messagingProxy): Deleted. * Source/WebCore/Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): * Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp: (WebCore::WorkerThreadableWebSocketChannel::Bridge::Bridge): (WebCore::WorkerThreadableWebSocketChannel::Bridge::mainThreadInitialize): * Source/WebCore/dom/BroadcastChannel.cpp: (WebCore::BroadcastChannel::MainThreadBridge::ensureOnMainThread): * Source/WebCore/dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::postTaskToResponsibleDocument): * Source/WebCore/loader/WorkerThreadableLoader.cpp: (WebCore::WorkerThreadableLoader::WorkerThreadableLoader): * Source/WebCore/loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::removeRequestFromSessionCaches): * Source/WebCore/page/WorkerNavigator.cpp: (WebCore::WorkerNavigator::setAppBadge): * Source/WebCore/workers/WorkerDebuggerProxy.h: * Source/WebCore/workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::~WorkerGlobalScope): (WebCore::WorkerGlobalScope::createRTCDataChannelRemoteHandlerConnection): (WebCore::WorkerGlobalScope::close): (WebCore::WorkerGlobalScope::logExceptionToConsole): (WebCore::WorkerGlobalScope::wrapCryptoKey): (WebCore::WorkerGlobalScope::unwrapCryptoKey): (WebCore::WorkerGlobalScope::reportErrorToWorkerObject): * Source/WebCore/workers/WorkerLoaderProxy.h: * Source/WebCore/workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::~WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): * Source/WebCore/workers/WorkerNotificationClient.cpp: (WebCore::WorkerNotificationClient::postToMainThread): * Source/WebCore/workers/WorkerOrWorkletThread.h: * Source/WebCore/workers/WorkerReportingProxy.h: * Source/WebCore/workers/WorkerThread.cpp: (WebCore::WorkerThread::workerBadgeProxy const): (WebCore::WorkerThread::workerDebuggerProxy const): (WebCore::WorkerThread::workerLoaderProxy): (WebCore::WorkerThread::workerReportingProxy const): (WebCore::WorkerThread::clearProxies): * Source/WebCore/workers/WorkerThread.h: (WebCore::WorkerThread::workerBadgeProxy const): Deleted. (WebCore::WorkerThread::workerReportingProxy const): Deleted. * Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp: (WebCore::ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy): * Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.cpp: (WebCore::SharedWorkerThreadProxy::~SharedWorkerThreadProxy): Canonical link: https://commits.webkit.org/267815.537@safari-7617-branch Identifier: 267815.520@safari-7617.1.16.10-branch
- Loading branch information
Showing
23 changed files
with
151 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.