[ios blink] Skip executing js for blink environments
The code is trying to execute on the JavascriptFeatureManager which is for WK environments and we need to be able to execute this on ContentJavascriptFeatureManager eventually. Bug: 40254930 Change-Id: I1832530a301b0d67e336ff9b2a15f232404dad97 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6384237 Reviewed-by: Rohit Rao <rohitrao@chromium.org> Commit-Queue: Dave Tapuska <dtapuska@chromium.org> Cr-Commit-Position: refs/heads/main@{#1436309}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
f6943031b3
commit
32891da50f
ios/web/js_messaging
@ -53,6 +53,7 @@ source_set("java_script_feature") {
|
||||
":scoped_wk_script_message_handler",
|
||||
":web_view_js_utils",
|
||||
"//base",
|
||||
"//build:blink_buildflags",
|
||||
"//ios/web:features",
|
||||
"//ios/web/public",
|
||||
"//ios/web/public/js_messaging",
|
||||
|
@ -9,6 +9,7 @@
|
||||
#import "base/functional/bind.h"
|
||||
#import "base/strings/sys_string_conversions.h"
|
||||
#import "base/time/time.h"
|
||||
#import "build/blink_buildflags.h"
|
||||
#import "ios/web/javascript_flags.h"
|
||||
#import "ios/web/js_messaging/java_script_content_world.h"
|
||||
#import "ios/web/js_messaging/java_script_feature_manager.h"
|
||||
@ -267,6 +268,10 @@ bool JavaScriptFeature::CallJavaScriptFunction(
|
||||
const base::Value::List& parameters) {
|
||||
DCHECK(web_frame);
|
||||
|
||||
#if BUILDFLAG(USE_BLINK)
|
||||
// TODO(crbug.com/40254930): Call the ContentJavascriptFeatureManager instead.
|
||||
return false;
|
||||
#else
|
||||
JavaScriptFeatureManager* feature_manager =
|
||||
JavaScriptFeatureManager::FromBrowserState(web_frame->GetBrowserState());
|
||||
DCHECK(feature_manager);
|
||||
@ -284,6 +289,7 @@ bool JavaScriptFeature::CallJavaScriptFunction(
|
||||
|
||||
return web_frame->GetWebFrameInternal()->CallJavaScriptFunctionInContentWorld(
|
||||
function_name, parameters, content_world);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool JavaScriptFeature::CallJavaScriptFunction(
|
||||
@ -294,6 +300,10 @@ bool JavaScriptFeature::CallJavaScriptFunction(
|
||||
base::TimeDelta timeout) {
|
||||
DCHECK(web_frame);
|
||||
|
||||
#if BUILDFLAG(USE_BLINK)
|
||||
// TODO(crbug.com/40254930): Call the ContentJavascriptFeatureManager instead.
|
||||
return false;
|
||||
#else
|
||||
JavaScriptFeatureManager* feature_manager =
|
||||
JavaScriptFeatureManager::FromBrowserState(web_frame->GetBrowserState());
|
||||
DCHECK(feature_manager);
|
||||
@ -311,6 +321,7 @@ bool JavaScriptFeature::CallJavaScriptFunction(
|
||||
|
||||
return web_frame->GetWebFrameInternal()->CallJavaScriptFunctionInContentWorld(
|
||||
function_name, parameters, content_world, std::move(callback), timeout);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool JavaScriptFeature::ExecuteJavaScript(
|
||||
@ -319,6 +330,10 @@ bool JavaScriptFeature::ExecuteJavaScript(
|
||||
ExecuteJavaScriptCallbackWithError callback) {
|
||||
DCHECK(web_frame);
|
||||
|
||||
#if BUILDFLAG(USE_BLINK)
|
||||
// TODO(crbug.com/40254930): Call the ContentJavascriptFeatureManager instead.
|
||||
return false;
|
||||
#else
|
||||
JavaScriptFeatureManager* feature_manager =
|
||||
JavaScriptFeatureManager::FromBrowserState(web_frame->GetBrowserState());
|
||||
DCHECK(feature_manager);
|
||||
@ -336,6 +351,7 @@ bool JavaScriptFeature::ExecuteJavaScript(
|
||||
|
||||
return web_frame->GetWebFrameInternal()->ExecuteJavaScriptInContentWorld(
|
||||
script, content_world, std::move(callback));
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace web
|
||||
|
Reference in New Issue
Block a user