Commit 172dccb9 authored by Kunihiko Sakamoto's avatar Kunihiko Sakamoto Committed by Commit Bot

Prevent font-loading promise rejection while shutting down the document

This fixes a crash bug where cancellation of font loading causes promise
rejection inside a ScriptForbiddenScope, when the loading is cancelled
inside Document::Shutdown().

To prevent this, this patch adds an early return to
RemoteFontFaceSource::NotifyFinished() when the document is not active.

This is a short term fix to be merged for M76.

Bug: 960290
Change-Id: I9f8b18fe489c2224ebbf445ad25445b7769c3336
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1661313
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670005}
parent d3bed141
...@@ -117,6 +117,11 @@ void RemoteFontFaceSource::NotifyFinished(Resource* resource) { ...@@ -117,6 +117,11 @@ void RemoteFontFaceSource::NotifyFinished(Resource* resource) {
ExecutionContext* execution_context = font_selector_->GetExecutionContext(); ExecutionContext* execution_context = font_selector_->GetExecutionContext();
if (!execution_context) if (!execution_context)
return; return;
// Prevent promise rejection while shutting down the document.
// See crbug.com/960290
if (execution_context->IsDocument() &&
To<Document>(execution_context)->IsDetached())
return;
FontResource* font = ToFontResource(resource); FontResource* font = ToFontResource(resource);
histograms_.RecordRemoteFont(font); histograms_.RecordRemoteFont(font);
......
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