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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp

Issue 2502783004: Don't skip security checks for javascript: URLs when the JS stack is empty. (Closed)
Patch Set: Added comment. Created 4 years, 1 month 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann (hausmann@kde.org) 4 * (C) 2000 Simon Hausmann (hausmann@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "core/html/HTMLFrameElementBase.h" 24 #include "core/html/HTMLFrameElementBase.h"
25 25
26 #include "bindings/core/v8/BindingSecurity.h"
26 #include "bindings/core/v8/ScriptController.h" 27 #include "bindings/core/v8/ScriptController.h"
27 #include "bindings/core/v8/ScriptEventListener.h" 28 #include "bindings/core/v8/ScriptEventListener.h"
28 #include "core/HTMLNames.h" 29 #include "core/HTMLNames.h"
29 #include "core/dom/Attribute.h" 30 #include "core/dom/Attribute.h"
30 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
31 #include "core/frame/FrameView.h" 32 #include "core/frame/FrameView.h"
32 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
33 #include "core/frame/RemoteFrame.h" 34 #include "core/frame/RemoteFrame.h"
34 #include "core/frame/RemoteFrameView.h" 35 #include "core/frame/RemoteFrameView.h"
35 #include "core/html/parser/HTMLParserIdioms.h" 36 #include "core/html/parser/HTMLParserIdioms.h"
(...skipping 12 matching lines...) Expand all
48 m_scrollingMode(ScrollbarAuto), 49 m_scrollingMode(ScrollbarAuto),
49 m_marginWidth(-1), 50 m_marginWidth(-1),
50 m_marginHeight(-1) {} 51 m_marginHeight(-1) {}
51 52
52 bool HTMLFrameElementBase::isURLAllowed() const { 53 bool HTMLFrameElementBase::isURLAllowed() const {
53 if (m_URL.isEmpty()) 54 if (m_URL.isEmpty())
54 return true; 55 return true;
55 56
56 const KURL& completeURL = document().completeURL(m_URL); 57 const KURL& completeURL = document().completeURL(m_URL);
57 58
58 if (protocolIsJavaScript(completeURL)) { 59 if (contentFrame() && protocolIsJavaScript(completeURL)) {
59 if (contentFrame() && 60 // Check if the caller can execute script in the context of the content
60 !ScriptController::canAccessFromCurrentOrigin(toIsolate(&document()), 61 // frame. NB: This check can be invoked without any JS on the stack for some
61 contentFrame())) 62 // parser operations. In such case, we use the origin of the frame element's
63 // containing document as the caller context.
64 v8::Isolate* isolate = toIsolate(&document());
65 LocalDOMWindow* accessingWindow = isolate->InContext()
66 ? currentDOMWindow(isolate)
67 : document().domWindow();
68 if (!BindingSecurity::shouldAllowAccessToFrame(
69 accessingWindow, contentFrame(),
70 BindingSecurity::ErrorReportOption::Report))
62 return false; 71 return false;
63 } 72 }
64 73
65 LocalFrame* parentFrame = document().frame(); 74 LocalFrame* parentFrame = document().frame();
66 if (parentFrame) 75 if (parentFrame)
67 return parentFrame->isURLAllowed(completeURL); 76 return parentFrame->isURLAllowed(completeURL);
68 77
69 return true; 78 return true;
70 } 79 }
71 80
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 m_marginWidth = marginWidth; 255 m_marginWidth = marginWidth;
247 frameOwnerPropertiesChanged(); 256 frameOwnerPropertiesChanged();
248 } 257 }
249 258
250 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { 259 void HTMLFrameElementBase::setMarginHeight(int marginHeight) {
251 m_marginHeight = marginHeight; 260 m_marginHeight = marginHeight;
252 frameOwnerPropertiesChanged(); 261 frameOwnerPropertiesChanged();
253 } 262 }
254 263
255 } // namespace blink 264 } // namespace blink
OLDNEW
« 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