chore: remove deprecated worldSafeExecuteJavaScript option (#28456)
This commit is contained in:
parent
c428ec5cd5
commit
da8c35e3b2
12 changed files with 28 additions and 86 deletions
|
@ -143,7 +143,6 @@ WebContentsPreferences::WebContentsPreferences(
|
|||
SetDefaultBoolIfUndefined(options::kSandbox, false);
|
||||
SetDefaultBoolIfUndefined(options::kNativeWindowOpen, false);
|
||||
SetDefaultBoolIfUndefined(options::kContextIsolation, true);
|
||||
SetDefaultBoolIfUndefined(options::kWorldSafeExecuteJavaScript, true);
|
||||
SetDefaultBoolIfUndefined(options::kJavaScript, true);
|
||||
SetDefaultBoolIfUndefined(options::kImages, true);
|
||||
SetDefaultBoolIfUndefined(options::kTextAreasAreResizable, true);
|
||||
|
@ -443,9 +442,6 @@ void WebContentsPreferences::OverrideWebkitPrefs(
|
|||
// Run Electron APIs and preload script in isolated world
|
||||
prefs->context_isolation = IsEnabled(options::kContextIsolation, true);
|
||||
|
||||
prefs->world_safe_execute_javascript =
|
||||
IsEnabled(options::kWorldSafeExecuteJavaScript, true);
|
||||
|
||||
int guest_instance_id = 0;
|
||||
if (GetAsInteger(&preference_, options::kGuestInstanceID, &guest_instance_id))
|
||||
prefs->guest_instance_id = guest_instance_id;
|
||||
|
|
|
@ -121,9 +121,6 @@ const char kNodeIntegration[] = "nodeIntegration";
|
|||
// Enable context isolation of Electron APIs and preload script
|
||||
const char kContextIsolation[] = "contextIsolation";
|
||||
|
||||
// Enable world safe passing of values when using "executeJavaScript"
|
||||
const char kWorldSafeExecuteJavaScript[] = "worldSafeExecuteJavaScript";
|
||||
|
||||
// Instance ID of guest WebContents.
|
||||
const char kGuestInstanceID[] = "guestInstanceId";
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ extern const char kPreloadScripts[];
|
|||
extern const char kPreloadURL[];
|
||||
extern const char kNodeIntegration[];
|
||||
extern const char kContextIsolation[];
|
||||
extern const char kWorldSafeExecuteJavaScript[];
|
||||
extern const char kGuestInstanceID[];
|
||||
extern const char kExperimentalFeatures[];
|
||||
extern const char kOpenerID[];
|
||||
|
|
|
@ -152,11 +152,8 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
|
|||
|
||||
explicit ScriptExecutionCallback(
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise,
|
||||
bool world_safe_result,
|
||||
CompletionCallback callback)
|
||||
: promise_(std::move(promise)),
|
||||
world_safe_result_(world_safe_result),
|
||||
callback_(std::move(callback)) {}
|
||||
: promise_(std::move(promise)), callback_(std::move(callback)) {}
|
||||
|
||||
~ScriptExecutionCallback() override = default;
|
||||
|
||||
|
@ -213,7 +210,6 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
|
|||
// the same world as the caller or the result is not an object and
|
||||
// therefore does not have a prototype chain to protect
|
||||
bool should_clone_value =
|
||||
world_safe_result_ &&
|
||||
!(value->IsObject() &&
|
||||
promise_.GetContext() ==
|
||||
value.As<v8::Object>()->CreationContext()) &&
|
||||
|
@ -261,7 +257,6 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
|
|||
|
||||
private:
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise_;
|
||||
bool world_safe_result_;
|
||||
CompletionCallback callback_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ScriptExecutionCallback);
|
||||
|
@ -427,8 +422,6 @@ v8::Local<v8::Value> GetWebPreference(v8::Isolate* isolate,
|
|||
return gin::ConvertToV8(isolate, prefs.opener_id);
|
||||
} else if (pref_name == options::kContextIsolation) {
|
||||
return gin::ConvertToV8(isolate, prefs.context_isolation);
|
||||
} else if (pref_name == options::kWorldSafeExecuteJavaScript) {
|
||||
return gin::ConvertToV8(isolate, prefs.world_safe_execute_javascript);
|
||||
} else if (pref_name == options::kGuestInstanceID) {
|
||||
// NOTE: guestInstanceId is internal-only.
|
||||
return gin::ConvertToV8(isolate, prefs.guest_instance_id);
|
||||
|
@ -643,13 +636,10 @@ v8::Local<v8::Promise> ExecuteJavaScript(gin_helper::Arguments* args,
|
|||
ScriptExecutionCallback::CompletionCallback completion_callback;
|
||||
args->GetNext(&completion_callback);
|
||||
|
||||
auto& prefs = render_frame->GetBlinkPreferences();
|
||||
|
||||
render_frame->GetWebFrame()->RequestExecuteScriptAndReturnValue(
|
||||
blink::WebScriptSource(blink::WebString::FromUTF16(code)),
|
||||
has_user_gesture,
|
||||
new ScriptExecutionCallback(std::move(promise),
|
||||
prefs.world_safe_execute_javascript,
|
||||
std::move(completion_callback)));
|
||||
|
||||
return handle;
|
||||
|
@ -709,13 +699,10 @@ v8::Local<v8::Promise> ExecuteJavaScriptInIsolatedWorld(
|
|||
blink::WebURL(GURL(url)), start_line));
|
||||
}
|
||||
|
||||
auto& prefs = render_frame->GetBlinkPreferences();
|
||||
|
||||
render_frame->GetWebFrame()->RequestExecuteScriptInIsolatedWorld(
|
||||
world_id, &sources.front(), sources.size(), has_user_gesture,
|
||||
scriptExecutionType,
|
||||
new ScriptExecutionCallback(std::move(promise),
|
||||
prefs.world_safe_execute_javascript,
|
||||
std::move(completion_callback)));
|
||||
|
||||
return handle;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue