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

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

Issue 2798593002: Count how often we'd throw for invalid URLs in window.open (Closed)
Patch Set: Created 3 years, 8 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
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 LocalDOMWindow& callingWindow, 179 LocalDOMWindow& callingWindow,
180 LocalFrame& firstFrame, 180 LocalFrame& firstFrame,
181 LocalFrame& openerFrame) { 181 LocalFrame& openerFrame) {
182 LocalFrame* activeFrame = callingWindow.frame(); 182 LocalFrame* activeFrame = callingWindow.frame();
183 ASSERT(activeFrame); 183 ASSERT(activeFrame);
184 184
185 KURL completedURL = urlString.isEmpty() 185 KURL completedURL = urlString.isEmpty()
186 ? KURL(ParsedURLString, emptyString) 186 ? KURL(ParsedURLString, emptyString)
187 : firstFrame.document()->completeURL(urlString); 187 : firstFrame.document()->completeURL(urlString);
188 if (!completedURL.isEmpty() && !completedURL.isValid()) { 188 if (!completedURL.isEmpty() && !completedURL.isValid()) {
189 UseCounter::count(activeFrame, UseCounter::WindowOpenWithInvalidURL);
189 // Don't expose client code to invalid URLs. 190 // Don't expose client code to invalid URLs.
190 callingWindow.printErrorMessage( 191 callingWindow.printErrorMessage(
191 "Unable to open a window with invalid URL '" + 192 "Unable to open a window with invalid URL '" +
192 completedURL.getString() + "'.\n"); 193 completedURL.getString() + "'.\n");
193 return nullptr; 194 return nullptr;
194 } 195 }
195 196
196 FrameLoadRequest frameRequest(callingWindow.document(), completedURL, 197 FrameLoadRequest frameRequest(callingWindow.document(), completedURL,
197 frameName); 198 frameName);
198 frameRequest.setShouldSetOpener(windowFeatures.noopener ? NeverSetOpener 199 frameRequest.setShouldSetOpener(windowFeatures.noopener ? NeverSetOpener
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 288 }
288 289
289 // TODO(japhet): Form submissions on RemoteFrames don't work yet. 290 // TODO(japhet): Form submissions on RemoteFrames don't work yet.
290 FrameLoadRequest newRequest(0, request.resourceRequest()); 291 FrameLoadRequest newRequest(0, request.resourceRequest());
291 newRequest.setForm(request.form()); 292 newRequest.setForm(request.form());
292 if (newFrame->isLocalFrame()) 293 if (newFrame->isLocalFrame())
293 toLocalFrame(newFrame)->loader().load(newRequest); 294 toLocalFrame(newFrame)->loader().load(newRequest);
294 } 295 }
295 296
296 } // namespace blink 297 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698