Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScheduledAction.cpp

Issue 2702213004: Add security checks to scheduled actions (Closed)
Patch Set: updates Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ScheduledAction.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScheduledAction.cpp b/third_party/WebKit/Source/bindings/core/v8/ScheduledAction.cpp
index e395e84105f5c0b3b08eff72f22df8340f73ab9a..a84d288607e9a7e17d3355500fd5f8f79dd1d362 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScheduledAction.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScheduledAction.cpp
@@ -30,6 +30,7 @@
#include "bindings/core/v8/ScheduledAction.h"
+#include "bindings/core/v8/BindingSecurity.h"
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/ScriptSourceCode.h"
#include "bindings/core/v8/SourceLocation.h"
@@ -46,14 +47,26 @@
namespace blink {
ScheduledAction* ScheduledAction::create(ScriptState* scriptState,
+ ExecutionContext* target,
haraken 2017/02/21 13:10:20 Is the target execution context different from scr
jochen (gone - plz use gerrit) 2017/02/21 13:13:02 possibly - you could invoke setTimeout on a same-o
haraken 2017/02/21 13:23:10 Ah, right. Maybe would it be nicer to move the CH
const ScriptValue& handler,
const Vector<ScriptValue>& arguments) {
ASSERT(handler.isFunction());
+ if (!scriptState->world().isWorkerWorld()) {
+ CHECK(BindingSecurity::shouldAllowAccessToFrame(
+ enteredDOMWindow(scriptState->isolate()), toDocument(target)->frame(),
+ BindingSecurity::ErrorReportOption::DoNotReport));
+ }
return new ScheduledAction(scriptState, handler, arguments);
}
ScheduledAction* ScheduledAction::create(ScriptState* scriptState,
+ ExecutionContext* target,
const String& handler) {
+ if (!scriptState->world().isWorkerWorld()) {
+ CHECK(BindingSecurity::shouldAllowAccessToFrame(
+ enteredDOMWindow(scriptState->isolate()), toDocument(target)->frame(),
+ BindingSecurity::ErrorReportOption::DoNotReport));
+ }
return new ScheduledAction(scriptState, handler);
}

Powered by Google App Engine
This is Rietveld 408576698