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

Unified Diff: third_party/WebKit/Source/core/page/CreateWindow.cpp

Issue 2855263004: Throw in window.open() when an invalid URL is being passed (Closed)
Patch Set: updates Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/CreateWindow.cpp
diff --git a/third_party/WebKit/Source/core/page/CreateWindow.cpp b/third_party/WebKit/Source/core/page/CreateWindow.cpp
index afa0cff05ab1655ee658e9711fde61ead04f999f..9f51a0f0d180d37b03dc86e1dde08001a3ddfacd 100644
--- a/third_party/WebKit/Source/core/page/CreateWindow.cpp
+++ b/third_party/WebKit/Source/core/page/CreateWindow.cpp
@@ -26,6 +26,7 @@
#include "core/page/CreateWindow.h"
+#include "bindings/core/v8/ExceptionState.h"
#include "core/dom/Document.h"
#include "core/frame/FrameClient.h"
#include "core/frame/LocalFrame.h"
@@ -179,7 +180,8 @@ DOMWindow* CreateWindow(const String& url_string,
const WindowFeatures& window_features,
LocalDOMWindow& calling_window,
LocalFrame& first_frame,
- LocalFrame& opener_frame) {
+ LocalFrame& opener_frame,
+ ExceptionState& exception_state) {
LocalFrame* active_frame = calling_window.GetFrame();
ASSERT(active_frame);
@@ -188,10 +190,9 @@ DOMWindow* CreateWindow(const String& url_string,
: first_frame.GetDocument()->CompleteURL(url_string);
if (!completed_url.IsEmpty() && !completed_url.IsValid()) {
UseCounter::Count(active_frame, UseCounter::kWindowOpenWithInvalidURL);
- // Don't expose client code to invalid URLs.
- calling_window.PrintErrorMessage(
- "Unable to open a window with invalid URL '" +
- completed_url.GetString() + "'.\n");
+ exception_state.ThrowDOMException(
+ kSyntaxError, "Unable to open a window with invalid URL '" +
+ completed_url.GetString() + "'.\n");
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698