Commit 22e26ade authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Use ClassicScript in WebLocalFrameImpl::ExecuteScript()

This CL doesn't change the behavior.

Bug: 1111134
Change-Id: I35fabb6b626d8763b37ce71e6bd01505cf5b74ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2331417
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarDominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794558}
parent f8a4aa42
...@@ -233,6 +233,7 @@ ...@@ -233,6 +233,7 @@
#include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/paint/paint_timing.h" #include "third_party/blink/renderer/core/paint/paint_timing.h"
#include "third_party/blink/renderer/core/script/classic_script.h"
#include "third_party/blink/renderer/core/scroll/scroll_types.h" #include "third_party/blink/renderer/core/scroll/scroll_types.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h" #include "third_party/blink/renderer/core/scroll/scrollbar_theme.h"
#include "third_party/blink/renderer/core/timing/dom_window_performance.h" #include "third_party/blink/renderer/core/timing/dom_window_performance.h"
...@@ -778,9 +779,7 @@ void WebLocalFrameImpl::SetIsAdSubframe( ...@@ -778,9 +779,7 @@ void WebLocalFrameImpl::SetIsAdSubframe(
void WebLocalFrameImpl::ExecuteScript(const WebScriptSource& source) { void WebLocalFrameImpl::ExecuteScript(const WebScriptSource& source) {
DCHECK(GetFrame()); DCHECK(GetFrame());
v8::HandleScope handle_scope(ToIsolate(GetFrame())); ClassicScript::CreateUnspecifiedScript(source)->RunScript(GetFrame());
GetFrame()->GetScriptController().ExecuteScriptInMainWorld(
source, KURL(), SanitizeScriptErrors::kSanitize);
} }
void WebLocalFrameImpl::ExecuteScriptInIsolatedWorld( void WebLocalFrameImpl::ExecuteScriptInIsolatedWorld(
...@@ -793,8 +792,9 @@ void WebLocalFrameImpl::ExecuteScriptInIsolatedWorld( ...@@ -793,8 +792,9 @@ void WebLocalFrameImpl::ExecuteScriptInIsolatedWorld(
// Note: An error event in an isolated world will never be dispatched to // Note: An error event in an isolated world will never be dispatched to
// a foreign world. // a foreign world.
v8::HandleScope handle_scope(ToIsolate(GetFrame())); v8::HandleScope handle_scope(ToIsolate(GetFrame()));
GetFrame()->GetScriptController().ExecuteScriptInIsolatedWorld( ClassicScript::CreateUnspecifiedScript(source_in,
world_id, source_in, KURL(), SanitizeScriptErrors::kDoNotSanitize); SanitizeScriptErrors::kDoNotSanitize)
->RunScriptInIsolatedWorldAndReturnValue(GetFrame(), world_id);
} }
v8::Local<v8::Value> v8::Local<v8::Value>
...@@ -807,8 +807,9 @@ WebLocalFrameImpl::ExecuteScriptInIsolatedWorldAndReturnValue( ...@@ -807,8 +807,9 @@ WebLocalFrameImpl::ExecuteScriptInIsolatedWorldAndReturnValue(
// Note: An error event in an isolated world will never be dispatched to // Note: An error event in an isolated world will never be dispatched to
// a foreign world. // a foreign world.
return GetFrame()->GetScriptController().ExecuteScriptInIsolatedWorld( return ClassicScript::CreateUnspecifiedScript(
world_id, source_in, KURL(), SanitizeScriptErrors::kDoNotSanitize); source_in, SanitizeScriptErrors::kDoNotSanitize)
->RunScriptInIsolatedWorldAndReturnValue(GetFrame(), world_id);
} }
void WebLocalFrameImpl::ClearIsolatedWorldCSPForTesting(int32_t world_id) { void WebLocalFrameImpl::ClearIsolatedWorldCSPForTesting(int32_t world_id) {
...@@ -855,11 +856,8 @@ void WebLocalFrameImpl::CollectGarbageForTesting() { ...@@ -855,11 +856,8 @@ void WebLocalFrameImpl::CollectGarbageForTesting() {
v8::Local<v8::Value> WebLocalFrameImpl::ExecuteScriptAndReturnValue( v8::Local<v8::Value> WebLocalFrameImpl::ExecuteScriptAndReturnValue(
const WebScriptSource& source) { const WebScriptSource& source) {
DCHECK(GetFrame()); DCHECK(GetFrame());
return ClassicScript::CreateUnspecifiedScript(source)
return GetFrame() ->RunScriptAndReturnValue(GetFrame());
->GetScriptController()
.ExecuteScriptInMainWorldAndReturnValue(source, KURL(),
SanitizeScriptErrors::kSanitize);
} }
void WebLocalFrameImpl::RequestExecuteScriptAndReturnValue( void WebLocalFrameImpl::RequestExecuteScriptAndReturnValue(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment