Bug 183013 - ServiceWorkerJob::m_lastResponse is unneeded
Summary: ServiceWorkerJob::m_lastResponse is unneeded
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: 2018-02-21 12:47 PST by youenn fablet
Modified: 2018-02-21 13:52 PST (History)
3 users (show)

See Also:


Attachments
Patch (2.12 KB, patch)
2018-02-21 12:49 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 2018-02-21 12:47:38 PST
ServiceWorkerJob::m_lastResponse is unneeded
Comment 1 youenn fablet 2018-02-21 12:49:27 PST
Created attachment 334405 [details]
Patch
Comment 2 youenn fablet 2018-02-21 13:08:20 PST
This could fix the following crash since m_lastResponse is the only ResourceResponse:
Thread 5 Crashed ↩:: WebCore: Worker
0   com.apple.JavaScriptCore      	0x00007fff301cd4c0 WTF::StringImpl::~StringImpl() + 80
1   com.apple.JavaScriptCore      	0x00007fff301cd45e WTF::StringImpl::destroy(WTF::StringImpl*) + 14
2   com.apple.WebCore             	0x00007fff3a8133c8 WebCore::ResourceResponseBase::~ResourceResponseBase() + 184
3   com.apple.WebCore             	0x00007fff3bc2f89b WebCore::ServiceWorkerJob::~ServiceWorkerJob() + 59
4   com.apple.WebCore             	0x00007fff3bc2f94e WebCore::ServiceWorkerJob::~ServiceWorkerJob() + 14
5   com.apple.WebCore             	0x00007fff3bc2d27c WebCore::ServiceWorkerContainer::jobResolvedWithRegistration(WebCore::ServiceWorkerJob&, WebCore::ServiceWorkerRegistrationData&&, WebCore::ShouldNotifyWhenResolved) + 2444
6   com.apple.WebCore             	0x00007fff3bc26c98 WTF::Function<void (WebCore::ScriptExecutionContext&)>::CallableWrapper<WebCore::SWClientConnection::postTaskForJob(WTF::ObjectIdentifier<WebCore::ServiceWorkerJobIdentifierType>, WebCore::SWClientConnection::IsJobComplete, WTF::Function<void (WebCore::ServiceWorkerJob&)>&&)::$_2>::call(WebCore::ScriptExecutionContext&) + 72
7   com.apple.WebCore             	0x00007fff3bc1cd10 WebCore::WorkerRunLoop::runInMode(WebCore::WorkerGlobalScope*, WebCore::ModePredicate const&, WebCore::WorkerRunLoop::WaitMode) + 416
8   com.apple.WebCore             	0x00007fff3bc1cb10 WebCore::WorkerRunLoop::run(WebCore::WorkerGlobalScope*) + 96
9   com.apple.WebCore             	0x00007fff3bc1f0d9 WebCore::WorkerThread::workerThread() + 1033
10  com.apple.JavaScriptCore      	0x00007fff30db8f44 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 228
11  com.apple.JavaScriptCore      	0x00007fff301cdbd9 WTF::wtfThreadEntryPoint(void*) + 9
12  libsystem_pthread.dylib       	0x00007fff5597e661 _pthread_body + 340
13  libsystem_pthread.dylib       	0x00007fff5597e50d _pthread_start + 377
14  libsystem_pthread.dylib       	0x00007fff5597dbf9 thread_start + 13

That said, m_lastResponse is given by a WorkerThreadableLoaderClient callback so the response should already be isolated.
Maybe there is a bigger issue and ServiceWorkerJob is not always deleted in the right thread?
Comment 3 Chris Dumez 2018-02-21 13:10:14 PST
Comment on attachment 334405 [details]
Patch

r=me if the bots are happy.
Comment 4 WebKit Commit Bot 2018-02-21 13:51:38 PST
Comment on attachment 334405 [details]
Patch

Clearing flags on attachment: 334405

Committed r228895: <https://trac.webkit.org/changeset/228895>
Comment 5 WebKit Commit Bot 2018-02-21 13:51:40 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-02-21 13:52:27 PST
<rdar://problem/37759608>