|
| 1 | +From 7b959779fb4a9fd6939d03b6fef45bed1c6745b3 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Sohom <sdatta4@ncsu.edu> |
| 3 | +Date: Sun, 15 Feb 2026 01:56:41 -0500 |
| 4 | +Subject: [PATCH] Add support for Chrome 145 |
| 5 | + |
| 6 | +--- |
| 7 | + .../base/process_launcher/BindService.java | 2 +- |
| 8 | + chrome/android/java/AndroidManifest.xml | 4 +- |
| 9 | + .../java/gin_java_method_invocation_helper.cc | 2 + |
| 10 | + .../gin_java_function_invocation_helper.cc | 43 +++++++++++++++++++ |
| 11 | + content/renderer/renderer_main.cc | 3 +- |
| 12 | + .../modules/remote_objects/remote_object.cc | 1 + |
| 13 | + .../renderer/platform/bindings/v8_binding.h | 1 + |
| 14 | + 7 files changed, 51 insertions(+), 5 deletions(-) |
| 15 | + |
| 16 | +diff --git a/base/android/java/src/org/chromium/base/process_launcher/BindService.java b/base/android/java/src/org/chromium/base/process_launcher/BindService.java |
| 17 | +index f0b05f9da4de9..1fb127bf4f3cc 100644 |
| 18 | +--- a/base/android/java/src/org/chromium/base/process_launcher/BindService.java |
| 19 | ++++ b/base/android/java/src/org/chromium/base/process_launcher/BindService.java |
| 20 | +@@ -41,7 +41,7 @@ public final class BindService { |
| 21 | + |
| 22 | + static boolean supportVariableConnections() { |
| 23 | + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q |
| 24 | +- && !BuildConfig.IS_INCREMENTAL_INSTALL; |
| 25 | ++ && !true; // VisibleV8 android change required disabling renderer isolation. |
| 26 | + } |
| 27 | + |
| 28 | + // Note that handler is not guaranteed to be used, and client still need to correctly handle |
| 29 | +diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml |
| 30 | +index 030736d46a43d..279cf5a5eb3d8 100644 |
| 31 | +--- a/chrome/android/java/AndroidManifest.xml |
| 32 | ++++ b/chrome/android/java/AndroidManifest.xml |
| 33 | +@@ -1292,13 +1292,13 @@ by a child template that "extends" this file. |
| 34 | + <service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}" |
| 35 | + android:process=":sandboxed_process{{ i }}" |
| 36 | + android:permission="{{ manifest_package }}.permission.CHILD_SERVICE" |
| 37 | +- android:isolatedProcess="true" |
| 38 | ++ android:isolatedProcess="false" |
| 39 | + android:exported="{{sandboxed_service_exported|default(false)}}" |
| 40 | + {% if (i == 0) %} |
| 41 | + android:useAppZygote="true" |
| 42 | + {% endif %} |
| 43 | + {% if (sandboxed_service_exported|default(false)) == 'true' %} |
| 44 | +- android:externalService="true" |
| 45 | ++ android:externalService="false" |
| 46 | + tools:ignore="ExportedService" |
| 47 | + android:visibleToInstantApps="true" |
| 48 | + {% endif %} /> |
| 49 | +diff --git a/content/browser/android/java/gin_java_method_invocation_helper.cc b/content/browser/android/java/gin_java_method_invocation_helper.cc |
| 50 | +index 2d0c3dd4eb754..5c331d1bd1eb9 100644 |
| 51 | +--- a/content/browser/android/java/gin_java_method_invocation_helper.cc |
| 52 | ++++ b/content/browser/android/java/gin_java_method_invocation_helper.cc |
| 53 | +@@ -12,6 +12,8 @@ |
| 54 | + #include "base/android/event_log.h" |
| 55 | + #include "base/android/jni_android.h" |
| 56 | + #include "base/android/jni_string.h" |
| 57 | ++#include "base/logging.h" |
| 58 | ++#include "base/debug/stack_trace.h" |
| 59 | + #include "content/browser/android/java/gin_java_script_to_java_types_coercion.h" |
| 60 | + #include "content/browser/android/java/java_method.h" |
| 61 | + #include "content/common/android/gin_java_bridge_value.h" |
| 62 | +diff --git a/content/renderer/java/gin_java_function_invocation_helper.cc b/content/renderer/java/gin_java_function_invocation_helper.cc |
| 63 | +index 0d126236bc172..94da580147e57 100644 |
| 64 | +--- a/content/renderer/java/gin_java_function_invocation_helper.cc |
| 65 | ++++ b/content/renderer/java/gin_java_function_invocation_helper.cc |
| 66 | +@@ -14,6 +14,7 @@ |
| 67 | + #include "content/renderer/java/gin_java_bridge_object.h" |
| 68 | + #include "content/renderer/java/gin_java_bridge_value_converter.h" |
| 69 | + #include "v8/include/v8-exception.h" |
| 70 | ++#include "v8/include/v8-visiblev8.h" |
| 71 | + |
| 72 | + namespace content { |
| 73 | + |
| 74 | +@@ -79,6 +80,13 @@ v8::Local<v8::Value> GinJavaFunctionInvocationHelper::Invoke( |
| 75 | + } |
| 76 | + } |
| 77 | + |
| 78 | ++ std::vector<v8::Local<v8::Value>> visv8_args; |
| 79 | ++ |
| 80 | ++ v8::Local<v8::Value> val; |
| 81 | ++ while (args->GetNext(&val)) { |
| 82 | ++ visv8_args.push_back(val); |
| 83 | ++ } |
| 84 | ++ |
| 85 | + mojom::GinJavaBridgeError error = |
| 86 | + mojom::GinJavaBridgeError::kGinJavaBridgeNoError; |
| 87 | + |
| 88 | +@@ -95,12 +103,24 @@ v8::Local<v8::Value> GinJavaFunctionInvocationHelper::Invoke( |
| 89 | + } |
| 90 | + } |
| 91 | + if (!result.get()) { |
| 92 | ++ auto* functionCallbackInfo = args->GetFunctionCallbackInfo(); |
| 93 | ++ v8::visv8_log_java_api_call( |
| 94 | ++ args->isolate(), false, functionCallbackInfo->Data().As<v8::String>(), |
| 95 | ++ functionCallbackInfo->This().As<v8::Object>(), |
| 96 | ++ v8::Undefined(args->isolate()), visv8_args, visv8_args.size()); |
| 97 | + args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8( |
| 98 | + args->isolate(), base::StrCat({"Error invoking ", method_name_, ": ", |
| 99 | + GinJavaBridgeErrorToString(error)})))); |
| 100 | + return v8::Undefined(args->isolate()); |
| 101 | + } |
| 102 | + if (!result->is_blob()) { |
| 103 | ++ auto* functionCallbackInfo = args->GetFunctionCallbackInfo(); |
| 104 | ++ v8::visv8_log_java_api_call( |
| 105 | ++ args->isolate(), false, functionCallbackInfo->Data().As<v8::String>(), |
| 106 | ++ functionCallbackInfo->This().As<v8::Object>(), |
| 107 | ++ converter_->ToV8Value(result.get(), |
| 108 | ++ args->isolate()->GetCurrentContext()), |
| 109 | ++ visv8_args, visv8_args.size()); |
| 110 | + return converter_->ToV8Value(result.get(), |
| 111 | + args->isolate()->GetCurrentContext()); |
| 112 | + } |
| 113 | +@@ -116,15 +136,38 @@ v8::Local<v8::Value> GinJavaFunctionInvocationHelper::Invoke( |
| 114 | + if (object_result) { |
| 115 | + v8::Local<v8::Value> controller; |
| 116 | + if (!object_result->GetWrapper(args->isolate()).ToLocal(&controller)) { |
| 117 | ++ auto* functionCallbackInfo = args->GetFunctionCallbackInfo(); |
| 118 | ++ v8::visv8_log_java_api_call( |
| 119 | ++ args->isolate(), false, |
| 120 | ++ functionCallbackInfo->Data().As<v8::String>(), |
| 121 | ++ functionCallbackInfo->This().As<v8::Object>(), |
| 122 | ++ v8::Undefined(args->isolate()), visv8_args, visv8_args.size()); |
| 123 | + return v8::Undefined(args->isolate()); |
| 124 | + } |
| 125 | ++ auto* functionCallbackInfo = args->GetFunctionCallbackInfo(); |
| 126 | ++ v8::visv8_log_java_api_call(args->isolate(), false, |
| 127 | ++ functionCallbackInfo->Data().As<v8::String>(), |
| 128 | ++ functionCallbackInfo->This().As<v8::Object>(), |
| 129 | ++ controller, visv8_args, visv8_args.size()); |
| 130 | + return controller; |
| 131 | + } |
| 132 | + } else if (gin_value->IsType(GinJavaBridgeValue::TYPE_NONFINITE)) { |
| 133 | + float float_value; |
| 134 | + gin_value->GetAsNonFinite(&float_value); |
| 135 | ++ auto* functionCallbackInfo = args->GetFunctionCallbackInfo(); |
| 136 | ++ v8::visv8_log_java_api_call(args->isolate(), false, |
| 137 | ++ functionCallbackInfo->Data().As<v8::String>(), |
| 138 | ++ functionCallbackInfo->This().As<v8::Object>(), |
| 139 | ++ v8::Number::New(args->isolate(), float_value), |
| 140 | ++ visv8_args, visv8_args.size()); |
| 141 | + return v8::Number::New(args->isolate(), float_value); |
| 142 | + } |
| 143 | ++ |
| 144 | ++ auto* functionCallbackInfo = args->GetFunctionCallbackInfo(); |
| 145 | ++ v8::visv8_log_java_api_call( |
| 146 | ++ args->isolate(), false, functionCallbackInfo->Data().As<v8::String>(), |
| 147 | ++ functionCallbackInfo->This().As<v8::Object>(), |
| 148 | ++ v8::Undefined(args->isolate()), visv8_args, visv8_args.size()); |
| 149 | + return v8::Undefined(args->isolate()); |
| 150 | + } |
| 151 | + |
| 152 | +diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc |
| 153 | +index cc54c30df4042..2c2cfcc91ee24 100644 |
| 154 | +--- a/content/renderer/renderer_main.cc |
| 155 | ++++ b/content/renderer/renderer_main.cc |
| 156 | +@@ -232,8 +232,7 @@ int RendererMain(MainFunctionParams parameters) { |
| 157 | + { |
| 158 | + content::ContentRendererClient* client = GetContentClient()->renderer(); |
| 159 | + bool should_run_loop = true; |
| 160 | +- bool need_sandbox = |
| 161 | +- !command_line.HasSwitch(sandbox::policy::switches::kNoSandbox); |
| 162 | ++ bool need_sandbox = false; // VisibleV8 disable sandbox for desktop |
| 163 | + |
| 164 | + if (!need_sandbox) { |
| 165 | + // The post-sandbox actions still need to happen at some point. |
| 166 | +diff --git a/third_party/blink/renderer/modules/remote_objects/remote_object.cc b/third_party/blink/renderer/modules/remote_objects/remote_object.cc |
| 167 | +index c9c72eee69378..98ffd3c5de790 100644 |
| 168 | +--- a/third_party/blink/renderer/modules/remote_objects/remote_object.cc |
| 169 | ++++ b/third_party/blink/renderer/modules/remote_objects/remote_object.cc |
| 170 | +@@ -6,6 +6,7 @@ |
| 171 | + |
| 172 | + #include <tuple> |
| 173 | + |
| 174 | ++#include "base/logging.h" |
| 175 | + #include "base/numerics/safe_conversions.h" |
| 176 | + #include "gin/converter.h" |
| 177 | + #include "third_party/blink/public/web/blink.h" |
| 178 | +diff --git a/third_party/blink/renderer/platform/bindings/v8_binding.h b/third_party/blink/renderer/platform/bindings/v8_binding.h |
| 179 | +index 6a0a0762ff359..df13bc22358e2 100644 |
| 180 | +--- a/third_party/blink/renderer/platform/bindings/v8_binding.h |
| 181 | ++++ b/third_party/blink/renderer/platform/bindings/v8_binding.h |
| 182 | +@@ -49,6 +49,7 @@ |
| 183 | + #include "v8/include/v8-maybe.h" |
| 184 | + #include "v8/include/v8-persistent-handle.h" |
| 185 | + #include "v8/include/v8-primitive.h" |
| 186 | ++#include "v8/include/v8-visiblev8.h" |
| 187 | + #include "v8/include/v8-value.h" |
| 188 | + |
| 189 | + namespace blink { |
| 190 | +-- |
| 191 | +2.43.0 |
| 192 | + |
0 commit comments