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

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

Issue 2490943002: Block 'javascript:' navigation in the correct document. (Closed)
Patch Set: 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
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
(...skipping 14 matching lines...) Expand all
25 25
26 #include "bindings/core/v8/ScriptController.h" 26 #include "bindings/core/v8/ScriptController.h"
27 #include "bindings/core/v8/ScriptEventListener.h" 27 #include "bindings/core/v8/ScriptEventListener.h"
28 #include "core/HTMLNames.h" 28 #include "core/HTMLNames.h"
29 #include "core/dom/Attribute.h" 29 #include "core/dom/Attribute.h"
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/frame/FrameView.h" 31 #include "core/frame/FrameView.h"
32 #include "core/frame/LocalFrame.h" 32 #include "core/frame/LocalFrame.h"
33 #include "core/frame/RemoteFrame.h" 33 #include "core/frame/RemoteFrame.h"
34 #include "core/frame/RemoteFrameView.h" 34 #include "core/frame/RemoteFrameView.h"
35 #include "core/frame/csp/ContentSecurityPolicy.h"
35 #include "core/html/parser/HTMLParserIdioms.h" 36 #include "core/html/parser/HTMLParserIdioms.h"
36 #include "core/loader/FrameLoader.h" 37 #include "core/loader/FrameLoader.h"
37 #include "core/loader/FrameLoaderClient.h" 38 #include "core/loader/FrameLoaderClient.h"
38 #include "core/page/FocusController.h" 39 #include "core/page/FocusController.h"
39 #include "core/page/Page.h" 40 #include "core/page/Page.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 using namespace HTMLNames; 44 using namespace HTMLNames;
44 45
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 scriptURL = url; 88 scriptURL = url;
88 url = blankURL(); 89 url = blankURL();
89 } 90 }
90 91
91 if (!loadOrRedirectSubframe(url, m_frameName, replaceCurrentItem)) 92 if (!loadOrRedirectSubframe(url, m_frameName, replaceCurrentItem))
92 return; 93 return;
93 if (!contentFrame() || scriptURL.isEmpty() || !contentFrame()->isLocalFrame()) 94 if (!contentFrame() || scriptURL.isEmpty() || !contentFrame()->isLocalFrame())
94 return; 95 return;
95 if (contentFrame()->owner()->getSandboxFlags() & SandboxOrigin) 96 if (contentFrame()->owner()->getSandboxFlags() & SandboxOrigin)
96 return; 97 return;
98 if (!ContentSecurityPolicy::shouldBypassMainWorld(&document()) &&
99 !document().contentSecurityPolicy()->allowJavaScriptURLs(
100 this, document().url(), OrdinalNumber::first())) {
101 return;
102 }
97 toLocalFrame(contentFrame()) 103 toLocalFrame(contentFrame())
98 ->script() 104 ->script()
99 .executeScriptIfJavaScriptURL(scriptURL, this); 105 .executeScriptIfJavaScriptURL(scriptURL, this);
100 } 106 }
101 107
102 void HTMLFrameElementBase::frameOwnerPropertiesChanged() { 108 void HTMLFrameElementBase::frameOwnerPropertiesChanged() {
103 // Don't notify about updates if contentFrame() is null, for example when 109 // Don't notify about updates if contentFrame() is null, for example when
104 // the subframe hasn't been created yet. 110 // the subframe hasn't been created yet.
105 if (contentFrame()) 111 if (contentFrame())
106 document().frame()->loader().client()->didChangeFrameOwnerProperties(this); 112 document().frame()->loader().client()->didChangeFrameOwnerProperties(this);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 m_marginWidth = marginWidth; 252 m_marginWidth = marginWidth;
247 frameOwnerPropertiesChanged(); 253 frameOwnerPropertiesChanged();
248 } 254 }
249 255
250 void HTMLFrameElementBase::setMarginHeight(int marginHeight) { 256 void HTMLFrameElementBase::setMarginHeight(int marginHeight) {
251 m_marginHeight = marginHeight; 257 m_marginHeight = marginHeight;
252 frameOwnerPropertiesChanged(); 258 frameOwnerPropertiesChanged();
253 } 259 }
254 260
255 } // namespace blink 261 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698