Skip to content

Commit

Permalink
chore: cherry-pick 54454ec7fbcb from chromium (#23017)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Apr 10, 2020
1 parent 3bf5ad2 commit 7efa4cc
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
2 changes: 2 additions & 0 deletions patches/chromium/.patches
Expand Up @@ -101,6 +101,8 @@ streams_convert_state_dchecks_to_checks.patch
-_point_usrsctp_to_a68325e7d9ed844cc84ec134192d788586ea6cc1.patch
audiocontext_haspendingactivity_unless_it_s_closed.patch
protect_automatic_pull_handlers_with_mutex.patch
speculative_fix_for_potential_null_pointer_in_printwarningtoconsole.patch
verify_if_the_context_is_still_available.patch
use_supportsweakptr_for_messaging_from_rendering_thread_to_main.patch
use_weakptr_for_cross-thread_posting.patch
break_connections_before_removing_from_active_source_handlers.patch
Expand Down
@@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: shrekshao <shrekshao@google.com>
Date: Fri, 4 Oct 2019 21:07:08 +0000
Subject: Speculative fix for potential NULL pointer in PrintWarningToConsole

Couldn't reproduce this clusterfuzz bug locally. But make a speculative
fix attempt.

Bug: 1008300
Change-Id: Iab02f2b3997883ae05cccd1e1ea916a206952b60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838547
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Cr-Commit-Position: refs/heads/master@{#703036}

diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
index 1a094f9a03bd589b0ae4968e7cd3ea2aa854f924..e14c25d63ac372cc7b0d72a94063863d8fc3a930 100644
--- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
+++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
@@ -7502,9 +7502,12 @@ void WebGLRenderingContextBase::PrintGLErrorToConsole(const String& message) {
}

void WebGLRenderingContextBase::PrintWarningToConsole(const String& message) {
- Host()->GetTopExecutionContext()->AddConsoleMessage(
- ConsoleMessage::Create(mojom::ConsoleMessageSource::kRendering,
- mojom::ConsoleMessageLevel::kWarning, message));
+ blink::ExecutionContext* context = Host()->GetTopExecutionContext();
+ if (context) {
+ context->AddConsoleMessage(
+ ConsoleMessage::Create(mojom::ConsoleMessageSource::kRendering,
+ mojom::ConsoleMessageLevel::kWarning, message));
+ }
}

bool WebGLRenderingContextBase::ValidateFramebufferFuncParameters(
27 changes: 27 additions & 0 deletions patches/chromium/verify_if_the_context_is_still_available.patch
@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: David Manouchehri <david@davidmanouchehri.com>
Date: Wed, 19 Feb 2020 00:29:19 +0000
Subject: Verify if the context is still available.

Bug: 1051748
Change-Id: I6bbef3ef50930048984593270fbe39a59a6d61f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2053167
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Auto-Submit: David Manouchehri <david@davidmanouchehri.com>
Cr-Commit-Position: refs/heads/master@{#742401}

diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
index e14c25d63ac372cc7b0d72a94063863d8fc3a930..bb2c7db66322b6161b281ebba474775c4a359999 100644
--- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
+++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
@@ -7503,7 +7503,7 @@ void WebGLRenderingContextBase::PrintGLErrorToConsole(const String& message) {

void WebGLRenderingContextBase::PrintWarningToConsole(const String& message) {
blink::ExecutionContext* context = Host()->GetTopExecutionContext();
- if (context) {
+ if (context && !context->IsContextDestroyed()) {
context->AddConsoleMessage(
ConsoleMessage::Create(mojom::ConsoleMessageSource::kRendering,
mojom::ConsoleMessageLevel::kWarning, message));

0 comments on commit 7efa4cc

Please sign in to comment.