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

Unified Diff: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp

Issue 2579213002: Don't skip security checks for javascript: URLs when the JS stack is empty. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
index eb81d639c4de017fbb4adf4c46265078a85c0f43..b68bf884d81dc25599d72aa3b90f43a461bd8d19 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
@@ -23,6 +23,7 @@
#include "core/html/HTMLFrameElementBase.h"
+#include "bindings/core/v8/BindingSecurity.h"
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/ScriptEventListener.h"
#include "core/HTMLNames.h"
@@ -56,10 +57,18 @@ bool HTMLFrameElementBase::isURLAllowed() const {
const KURL& completeURL = document().completeURL(m_URL);
- if (protocolIsJavaScript(completeURL)) {
- if (contentFrame() &&
- !ScriptController::canAccessFromCurrentOrigin(toIsolate(&document()),
- contentFrame()))
+ if (contentFrame() && protocolIsJavaScript(completeURL)) {
+ // Check if the caller can execute script in the context of the content
+ // frame. NB: This check can be invoked without any JS on the stack for some
+ // parser operations. In such case, we use the origin of the frame element's
+ // containing document as the caller context.
+ v8::Isolate* isolate = toIsolate(&document());
+ LocalDOMWindow* accessingWindow = isolate->InContext()
+ ? currentDOMWindow(isolate)
+ : document().domWindow();
+ if (!BindingSecurity::shouldAllowAccessToFrame(
+ accessingWindow, contentFrame(),
+ BindingSecurity::ErrorReportOption::Report))
return false;
}
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698