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

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

Issue 2393053002: Fix reentrancy crash in createWindowHelper (Closed)
Patch Set: Created 4 years, 2 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/loading/window-open-onblur-reentrancy-expected.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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 "frame whose 'allow-popups' permission is not set.")); 153 "frame whose 'allow-popups' permission is not set."));
154 return nullptr; 154 return nullptr;
155 } 155 }
156 156
157 if (openerFrame.settings() && 157 if (openerFrame.settings() &&
158 !openerFrame.settings()->supportsMultipleWindows()) 158 !openerFrame.settings()->supportsMultipleWindows())
159 window = openerFrame.tree().top(); 159 window = openerFrame.tree().top();
160 } 160 }
161 161
162 if (window) { 162 if (window) {
163 // JS can run inside reuseExistingWindow (via onblur), which can detach
164 // the target window.
165 if (!window->client())
166 return nullptr;
163 if (request.getShouldSetOpener() == MaybeSetOpener) 167 if (request.getShouldSetOpener() == MaybeSetOpener)
164 window->client()->setOpener(&openerFrame); 168 window->client()->setOpener(&openerFrame);
165 return window; 169 return window;
166 } 170 }
167 171
168 return createNewWindow(openerFrame, request, features, policy, created); 172 return createNewWindow(openerFrame, request, features, policy, created);
169 } 173 }
170 174
171 DOMWindow* createWindow(const String& urlString, 175 DOMWindow* createWindow(const String& urlString,
172 const AtomicString& frameName, 176 const AtomicString& frameName,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 281 }
278 282
279 // TODO(japhet): Form submissions on RemoteFrames don't work yet. 283 // TODO(japhet): Form submissions on RemoteFrames don't work yet.
280 FrameLoadRequest newRequest(0, request.resourceRequest()); 284 FrameLoadRequest newRequest(0, request.resourceRequest());
281 newRequest.setForm(request.form()); 285 newRequest.setForm(request.form());
282 if (newFrame->isLocalFrame()) 286 if (newFrame->isLocalFrame())
283 toLocalFrame(newFrame)->loader().load(newRequest); 287 toLocalFrame(newFrame)->loader().load(newRequest);
284 } 288 }
285 289
286 } // namespace blink 290 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/loading/window-open-onblur-reentrancy-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698