diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-12-10 16:19:40 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-12-10 16:01:50 +0000 |
commit | 51f6c2793adab2d864b3d2b360000ef8db1d3e92 (patch) | |
tree | 835b3b4446b012c75e80177cef9fbe6972cc7dbe /chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc | |
parent | 6036726eb981b6c4b42047513b9d3f4ac865daac (diff) | |
download | qtwebengine-chromium-51f6c2793adab2d864b3d2b360000ef8db1d3e92.tar.gz |
BASELINE: Update Chromium to 71.0.3578.93
Change-Id: I6a32086c33670e1b033f8b10e6bf1fd4da1d105d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc | 31 |
1 files changed, 22 insertions, 9 deletions
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<Document>(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<Document>(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<Document>(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<v8::Local<v8::Value>>* handles) { - handles->ReserveCapacity(info_.Size()); - for (size_t i = 0; i < info_.Size(); ++i) + wtf_size_t handle_count = SafeCast<wtf_size_t>(info_.Size()); + handles->ReserveCapacity(handle_count); + for (wtf_size_t i = 0; i < handle_count; ++i) handles->push_back(info_.Get(i)); } |