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

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

Issue 2183423002: Only do security checks on javascript: URLs for frames for loading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/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 0c5029c6cb5d1b06cf5593ce1729964e2dd6cfc7..fcb970c22d7d9b60dca94b6d29cc5b8bfcd5ee98 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
@@ -50,16 +50,20 @@ HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Documen
{
}
-bool HTMLFrameElementBase::isURLAllowed() const
+bool HTMLFrameElementBase::isURLAllowed(ReasonForCallingURLAllowed reason) const
{
if (m_URL.isEmpty())
return true;
const KURL& completeURL = document().completeURL(m_URL);
- if (protocolIsJavaScript(completeURL)) {
- if (contentFrame() && !ScriptController::canAccessFromCurrentOrigin(toIsolate(&document()), contentFrame()))
- return false;
+ if (reason == WillLoadURL && protocolIsJavaScript(completeURL)) {
dcheng 2016/07/27 15:15:58 I wonder if we should just cache the result of thi
jochen (gone - plz use gerrit) 2016/07/27 15:19:37 well, if you want to do layout and get it wrong, y
dcheng 2016/07/27 15:39:06 I'm kind of thinking we should just reset this to
+ if (contentFrame()) {
+ v8::Isolate* isolate = toIsolate(&document());
+ SECURITY_CHECK(isolate->InContext());
+ if (!ScriptController::canAccessFromCurrentOrigin(toIsolate(&document()), contentFrame()))
dcheng 2016/07/27 15:15:58 I wonder if we should remove the isolate->InContex
jochen (gone - plz use gerrit) 2016/07/27 15:19:37 done
+ return false;
+ }
}
LocalFrame* parentFrame = document().frame();
@@ -71,7 +75,7 @@ bool HTMLFrameElementBase::isURLAllowed() const
void HTMLFrameElementBase::openURL(bool replaceCurrentItem)
{
- if (!isURLAllowed())
+ if (!isURLAllowed(WillLoadURL))
return;
if (m_URL.isEmpty())
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameElementBase.h ('k') | third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698