From 51f6c2793adab2d864b3d2b360000ef8db1d3e92 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 10 Dec 2018 16:19:40 +0100 Subject: BASELINE: Update Chromium to 71.0.3578.93 Change-Id: I6a32086c33670e1b033f8b10e6bf1fd4da1d105d Reviewed-by: Alexandru Croitor --- .../renderer/bindings/core/v8/scheduled_action.cc | 31 +++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc') diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc b/chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc index 6b96f3d1277..94b91e7e15c 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc @@ -47,6 +47,7 @@ #include "third_party/blink/renderer/core/workers/worker_thread.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { @@ -58,7 +59,7 @@ ScheduledAction* ScheduledAction::Create(ScriptState* script_state, if (!script_state->World().IsWorkerWorld()) { if (!BindingSecurity::ShouldAllowAccessToFrame( EnteredDOMWindow(script_state->GetIsolate()), - ToDocument(target)->GetFrame(), + To(target)->GetFrame(), BindingSecurity::ErrorReportOption::kDoNotReport)) { UseCounter::Count(target, WebFeature::kScheduledActionIgnored); return new ScheduledAction(script_state); @@ -73,7 +74,7 @@ ScheduledAction* ScheduledAction::Create(ScriptState* script_state, if (!script_state->World().IsWorkerWorld()) { if (!BindingSecurity::ShouldAllowAccessToFrame( EnteredDOMWindow(script_state->GetIsolate()), - ToDocument(target)->GetFrame(), + To(target)->GetFrame(), BindingSecurity::ErrorReportOption::kDoNotReport)) { UseCounter::Count(target, WebFeature::kScheduledActionIgnored); return new ScheduledAction(script_state); @@ -108,8 +109,8 @@ void ScheduledAction::Execute(ExecutionContext* context) { // determine if it is allowed. Enter the scope here. ScriptState::Scope scope(script_state_->Get()); - if (context->IsDocument()) { - LocalFrame* frame = ToDocument(context)->GetFrame(); + if (auto* document = DynamicTo(context)) { + LocalFrame* frame = document->GetFrame(); if (!frame) { DVLOG(1) << "ScheduledAction::execute " << this << ": no frame"; return; @@ -170,10 +171,15 @@ void ScheduledAction::Execute(LocalFrame* frame) { } else { DVLOG(1) << "ScheduledAction::execute " << this << ": executing from source"; + // We're using |kSharableCrossOrigin| to keep the existing behavior, but + // this causes failures on + // wpt/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html + // and friends. frame->GetScriptController().ExecuteScriptAndReturnValue( script_state_->GetContext(), ScriptSourceCode(code_, - ScriptSourceLocationType::kEvalForScheduledAction)); + ScriptSourceLocationType::kEvalForScheduledAction), + KURL(), kSharableCrossOrigin); } // The frame might be invalid at this point because JavaScript could have @@ -205,15 +211,22 @@ void ScheduledAction::Execute(WorkerGlobalScope* worker) { function, worker, script_state_->GetContext()->Global(), info.size(), info.data(), script_state_->GetIsolate()); } else { - worker->ScriptController()->Evaluate(ScriptSourceCode( - code_, ScriptSourceLocationType::kEvalForScheduledAction)); + // We're using |kSharableCrossOrigin| to keep the existing behavior, but + // this causes failures on + // wpt/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html + // and friends. + worker->ScriptController()->Evaluate( + ScriptSourceCode(code_, + ScriptSourceLocationType::kEvalForScheduledAction), + kSharableCrossOrigin); } } void ScheduledAction::CreateLocalHandlesForArgs( Vector>* handles) { - handles->ReserveCapacity(info_.Size()); - for (size_t i = 0; i < info_.Size(); ++i) + wtf_size_t handle_count = SafeCast(info_.Size()); + handles->ReserveCapacity(handle_count); + for (wtf_size_t i = 0; i < handle_count; ++i) handles->push_back(info_.Get(i)); } -- cgit v1.2.1