From cfee3286b2ab54fa255fd76cd24f5dcea06e643d Mon Sep 17 00:00:00 2001 From: Pedro Pontes Date: Fri, 29 Jul 2022 16:57:32 +0200 Subject: [PATCH] chore: cherry-pick 902f0d144a5b from chromium (#35097) * chore: cherry-pick 902f0d144a5b from chromium * chore: update patches * Trigger Build Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Electron Bot Co-authored-by: John Kleinschmidt --- patches/chromium/.patches | 1 + .../chromium/cherry-pick-902f0d144a5b.patch | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 patches/chromium/cherry-pick-902f0d144a5b.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index eacd57df0bdc5..0ac9a85a8d731 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -136,4 +136,5 @@ remove_default_window_title.patch cherry-pick-d7a5d6b38ea8.patch cherry-pick-22abbad430b6.patch cherry-pick-3cbd5973d704.patch +cherry-pick-902f0d144a5b.patch cherry-pick-664e0d8b4cfb.patch diff --git a/patches/chromium/cherry-pick-902f0d144a5b.patch b/patches/chromium/cherry-pick-902f0d144a5b.patch new file mode 100644 index 0000000000000..43d807c87d2e8 --- /dev/null +++ b/patches/chromium/cherry-pick-902f0d144a5b.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Justin Novosad +Date: Fri, 15 Jul 2022 23:12:50 +0000 +Subject: Mitigate bad cast in OffscreenCanvas::GetFontSelector + +This change will cause the browser to crash if the execution context +is not a Window or WorkerGlobalScope. This is a temporary solution +to handle the case where the execution context is an +AudioWorkletGlobalScope. The longer term solution, which will be +implemented in a follow-up CL, is to block OffscreenCanvas objects from +being transferred to AudioWorklets, as required by the postMessage spec. + +BUG=1334864 + +(cherry picked from commit 028c11e59fd41bc22eff06dbec10fe9b0e82bd04) + +Change-Id: Ief5e37eca6dff14098b12cdbe6fc362c3dd87d1d +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3722117 +Auto-Submit: Justin Novosad +Reviewed-by: Juanmi Huertas +Commit-Queue: Juanmi Huertas +Cr-Original-Commit-Position: refs/heads/main@{#1017357} +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3752921 +Commit-Queue: Srinivas Sista +Cr-Commit-Position: refs/branch-heads/5005@{#1254} +Cr-Branched-From: 5b4d9450fee01f821b6400e947b3839727643a71-refs/heads/main@{#992738} + +diff --git a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc +index 584920aad8a3bfd9f00bf0db99fdf1891b13176b..4625aec940a349e94f591e2b96801c99dcb3ef05 100644 +--- a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc ++++ b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc +@@ -548,6 +548,9 @@ FontSelector* OffscreenCanvas::GetFontSelector() { + if (auto* window = DynamicTo(GetExecutionContext())) { + return window->document()->GetStyleEngine().GetFontSelector(); + } ++ // TODO(crbug.com/1334864): Temporary mitigation. Remove the following ++ // CHECK once a more comprehensive solution has been implemented. ++ CHECK(GetExecutionContext()->IsWorkerGlobalScope()); + return To(GetExecutionContext())->GetFontSelector(); + } +