Browse Source

chore: cherry-pick 54454ec7fbcb from chromium (#23017)

Jeremy Apthorp 5 years ago
parent
commit
7efa4ccfb3

+ 2 - 0
patches/chromium/.patches

@@ -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

+ 35 - 0
patches/chromium/speculative_fix_for_potential_null_pointer_in_printwarningtoconsole.patch

@@ -0,0 +1,35 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: shrekshao <[email protected]>
+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 <[email protected]>
+Commit-Queue: Shrek Shao <[email protected]>
+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 - 0
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 <[email protected]>
+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 <[email protected]>
+Reviewed-by: Kenneth Russell <[email protected]>
+Commit-Queue: Kenneth Russell <[email protected]>
+Auto-Submit: David Manouchehri <[email protected]>
+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));