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

Unified Diff: url/url_canon_relative.cc

Issue 1409293007: new URL('') should throw TypeError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated testcase Created 5 years, 1 month 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: url/url_canon_relative.cc
diff --git a/url/url_canon_relative.cc b/url/url_canon_relative.cc
index c2e94e418529dd6cde73f2c6a92c225405eb4150..e34ea2fa2495dc6acbb301644dca4b04b3738762 100644
--- a/url/url_canon_relative.cc
+++ b/url/url_canon_relative.cc
@@ -75,6 +75,10 @@ bool DoIsRelativeURL(const char* base,
TrimURL(url, &begin, &url_len);
if (begin >= url_len) {
// Empty URLs are relative, but do nothing.
+ if (!is_base_hierarchical) {
+ // Don't allow relative URLs if the base scheme doesn't support it.
+ return false;
+ }
*relative_component = Component(begin, 0);
*is_relative = true;
return true;
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/fast/url/segments-from-data-url-expected.txt ('k') | url/url_canon_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698