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

Side by Side Diff: Source/core/page/CreateWindow.cpp

Issue 208853004: Don't propagate sandbox flags to an opened window unless triggered entirely by script. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/navigation/resources/new-window-sandboxed-iframe-iframe.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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return 0; 74 return 0;
75 75
76 Page* page = oldPage->chrome().client().createWindow(&openerFrame, request, features, policy, shouldSendReferrer); 76 Page* page = oldPage->chrome().client().createWindow(&openerFrame, request, features, policy, shouldSendReferrer);
77 if (!page) 77 if (!page)
78 return 0; 78 return 0;
79 FrameHost* host = &page->frameHost(); 79 FrameHost* host = &page->frameHost();
80 80
81 ASSERT(page->mainFrame()); 81 ASSERT(page->mainFrame());
82 LocalFrame& frame = *page->mainFrame(); 82 LocalFrame& frame = *page->mainFrame();
83 83
84 frame.loader().forceSandboxFlags(openerFrame.document()->sandboxFlags());
85
86 if (request.frameName() != "_blank") 84 if (request.frameName() != "_blank")
87 frame.tree().setName(request.frameName()); 85 frame.tree().setName(request.frameName());
88 86
89 host->chrome().setWindowFeatures(features); 87 host->chrome().setWindowFeatures(features);
90 88
91 // 'x' and 'y' specify the location of the window, while 'width' and 'height ' 89 // 'x' and 'y' specify the location of the window, while 'width' and 'height '
92 // specify the size of the viewport. We can only resize the window, so adjus t 90 // specify the size of the viewport. We can only resize the window, so adjus t
93 // for the difference between the window size and the viewport size. 91 // for the difference between the window size and the viewport size.
94 92
95 FloatRect windowRect = host->chrome().windowRect(); 93 FloatRect windowRect = host->chrome().windowRect();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 FrameLoader::addHTTPOriginIfNeeded(request, AtomicString(firstFrame.document ()->outgoingOrigin())); 132 FrameLoader::addHTTPOriginIfNeeded(request, AtomicString(firstFrame.document ()->outgoingOrigin()));
135 FrameLoadRequest frameRequest(callingWindow.document(), request, frameName); 133 FrameLoadRequest frameRequest(callingWindow.document(), request, frameName);
136 134
137 // We pass the opener frame for the lookupFrame in case the active frame is different from 135 // We pass the opener frame for the lookupFrame in case the active frame is different from
138 // the opener frame, and the name references a frame relative to the opener frame. 136 // the opener frame, and the name references a frame relative to the opener frame.
139 bool created; 137 bool created;
140 LocalFrame* newFrame = createWindow(*activeFrame, openerFrame, frameRequest, windowFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created); 138 LocalFrame* newFrame = createWindow(*activeFrame, openerFrame, frameRequest, windowFeatures, NavigationPolicyIgnore, MaybeSendReferrer, created);
141 if (!newFrame) 139 if (!newFrame)
142 return 0; 140 return 0;
143 141
142 if (newFrame != &openerFrame && newFrame != openerFrame.tree().top())
143 newFrame->loader().forceSandboxFlags(openerFrame.document()->sandboxFlag s());
144
144 newFrame->loader().setOpener(&openerFrame); 145 newFrame->loader().setOpener(&openerFrame);
145 newFrame->page()->setOpenedByDOM(); 146 newFrame->page()->setOpenedByDOM();
146 147
147 if (newFrame->domWindow()->isInsecureScriptAccess(callingWindow, completedUR L)) 148 if (newFrame->domWindow()->isInsecureScriptAccess(callingWindow, completedUR L))
148 return newFrame; 149 return newFrame;
149 150
150 if (function) 151 if (function)
151 function(newFrame->domWindow(), functionContext); 152 function(newFrame->domWindow(), functionContext);
152 153
153 if (created) { 154 if (created) {
(...skipping 28 matching lines...) Expand all
182 if (shouldSendReferrer == MaybeSendReferrer) { 183 if (shouldSendReferrer == MaybeSendReferrer) {
183 newFrame->loader().setOpener(&openerFrame); 184 newFrame->loader().setOpener(&openerFrame);
184 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy()); 185 newFrame->document()->setReferrerPolicy(openerFrame.document()->referrer Policy());
185 } 186 }
186 FrameLoadRequest newRequest(0, request.resourceRequest()); 187 FrameLoadRequest newRequest(0, request.resourceRequest());
187 newRequest.setFormState(request.formState()); 188 newRequest.setFormState(request.formState());
188 newFrame->loader().load(newRequest); 189 newFrame->loader().load(newRequest);
189 } 190 }
190 191
191 } // namespace WebCore 192 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/navigation/resources/new-window-sandboxed-iframe-iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698