Commit 15bb54f8 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

service worker: Terminate worker thread if top-level script fetch failed

We should terminate a service worker thread when the top-level
script fetch fails. Otherwise the thread would stay running and
leak a V8 isolate. WorkerGlobalScope::close() schedules thread
termination.

I manually confirmed that this CL fixes the leak.
I'll add a test for this fix in a follow-up CL.

Bug: 1005650
Change-Id: If3fd2f7f0f746c4e240b9fdebd4cf242d87a0943
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819282
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699201}
parent 01544023
......@@ -440,6 +440,8 @@ void ServiceWorkerGlobalScope::DidFetchClassicScript(
// Step 9.3. "Invoke Finish Job with job and abort these steps."
// The browser process takes care of these steps.
ReportingProxy().DidFailToFetchClassicScript();
// Close the worker global scope to terminate the thread.
close();
return;
}
// The app cache ID is not used.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment