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

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

Issue 2154213003: Prevent 'javascript:' URL execution in sandboxed frame. (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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/sandboxed-iframe-javascript-url.html ('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
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 KURL url = document().completeURL(m_URL); 86 KURL url = document().completeURL(m_URL);
87 if (protocolIsJavaScript(m_URL)) { 87 if (protocolIsJavaScript(m_URL)) {
88 scriptURL = url; 88 scriptURL = url;
89 url = blankURL(); 89 url = blankURL();
90 } 90 }
91 91
92 if (!loadOrRedirectSubframe(url, m_frameName, replaceCurrentItem)) 92 if (!loadOrRedirectSubframe(url, m_frameName, replaceCurrentItem))
93 return; 93 return;
94 if (!contentFrame() || scriptURL.isEmpty() || !contentFrame()->isLocalFrame( )) 94 if (!contentFrame() || scriptURL.isEmpty() || !contentFrame()->isLocalFrame( ))
95 return; 95 return;
96 if (contentFrame()->owner()->getSandboxFlags() & SandboxOrigin)
97 return;
96 toLocalFrame(contentFrame())->script().executeScriptIfJavaScriptURL(scriptUR L); 98 toLocalFrame(contentFrame())->script().executeScriptIfJavaScriptURL(scriptUR L);
97 } 99 }
98 100
99 void HTMLFrameElementBase::frameOwnerPropertiesChanged() 101 void HTMLFrameElementBase::frameOwnerPropertiesChanged()
100 { 102 {
101 // Don't notify about updates if contentFrame() is null, for example when 103 // Don't notify about updates if contentFrame() is null, for example when
102 // the subframe hasn't been created yet. 104 // the subframe hasn't been created yet.
103 if (contentFrame()) 105 if (contentFrame())
104 document().frame()->loader().client()->didChangeFrameOwnerProperties(thi s); 106 document().frame()->loader().client()->didChangeFrameOwnerProperties(thi s);
105 } 107 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 frameOwnerPropertiesChanged(); 248 frameOwnerPropertiesChanged();
247 } 249 }
248 250
249 void HTMLFrameElementBase::setMarginHeight(int marginHeight) 251 void HTMLFrameElementBase::setMarginHeight(int marginHeight)
250 { 252 {
251 m_marginHeight = marginHeight; 253 m_marginHeight = marginHeight;
252 frameOwnerPropertiesChanged(); 254 frameOwnerPropertiesChanged();
253 } 255 }
254 256
255 } // namespace blink 257 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/sandboxed-iframe-javascript-url.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698