Commit 7f88c93e authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Use ClassicScript in ExecuteJavascriptURL

This CL doesn't change the behavior.

Bug: 1111134
Change-Id: I5a0fb2249ccea2f240ba6031859fdcd8736b44d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2331381
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarDominic Farolino <dom@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794553}
parent ef1be886
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include "third_party/blink/renderer/core/loader/frame_loader.h" #include "third_party/blink/renderer/core/loader/frame_loader.h"
#include "third_party/blink/renderer/core/loader/progress_tracker.h" #include "third_party/blink/renderer/core/loader/progress_tracker.h"
#include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/script/classic_script.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" #include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
...@@ -290,21 +291,23 @@ void ScriptController::ExecuteJavaScriptURL( ...@@ -290,21 +291,23 @@ void ScriptController::ExecuteJavaScriptURL(
bool had_navigation_before = GetFrame()->Loader().HasProvisionalNavigation(); bool had_navigation_before = GetFrame()->Loader().HasProvisionalNavigation();
v8::HandleScope handle_scope(GetIsolate()); // https://html.spec.whatwg.org/multipage/browsing-the-web.html#javascript-protocol
// Step 6. "Let baseURL be settings's API base URL." [spec text]
// https://html.spec.whatwg.org/C/#navigate const KURL base_url = GetFrame()->GetDocument()->BaseURL();
// Step 12.8 "Let base URL be settings object's API base URL." [spec text]
KURL base_url = GetFrame()->GetDocument()->BaseURL();
// Step 12.9 "Let script be result of creating a classic script given script // Step 7. "Let script be the result of creating a classic script given
// source, settings, base URL, and the default classic script fetch options." // scriptSource, settings, baseURL, and the default classic script fetch
// [spec text] // options." [spec text]
//
// We pass |SanitizeScriptErrors::kDoNotSanitize| because |muted errors| is // We pass |SanitizeScriptErrors::kDoNotSanitize| because |muted errors| is
// false by default. // false by default.
v8::Local<v8::Value> v8_result = EvaluateScriptInMainWorld( ClassicScript* script = MakeGarbageCollected<ClassicScript>(
ScriptSourceCode(script_source, ScriptSourceLocationType::kJavascriptUrl), ScriptSourceCode(script_source, ScriptSourceLocationType::kJavascriptUrl),
base_url, SanitizeScriptErrors::kDoNotSanitize, ScriptFetchOptions(), base_url, ScriptFetchOptions(), SanitizeScriptErrors::kDoNotSanitize);
kDoNotExecuteScriptWhenScriptsDisabled);
DCHECK_EQ(&GetFrame()->GetScriptController(), this);
v8::HandleScope handle_scope(GetIsolate());
v8::Local<v8::Value> v8_result = script->RunScriptAndReturnValue(GetFrame());
UseCounter::Count(*GetFrame()->GetDocument(), UseCounter::Count(*GetFrame()->GetDocument(),
WebFeature::kExecutedJavaScriptURL); WebFeature::kExecutedJavaScriptURL);
......
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