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

Unified Diff: third_party/WebKit/Source/core/dom/URLSearchParams.cpp

Issue 1906773002: Have (new URLSearchParams(initString)) skip initial '?'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix misguided comment Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-constructor.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/URLSearchParams.cpp
diff --git a/third_party/WebKit/Source/core/dom/URLSearchParams.cpp b/third_party/WebKit/Source/core/dom/URLSearchParams.cpp
index 5fbe139215e0bffd8ac5ce2a428b58325a4f0509..5e3493b5ef114cedc23267b86fd886a103b47a22 100644
--- a/third_party/WebKit/Source/core/dom/URLSearchParams.cpp
+++ b/third_party/WebKit/Source/core/dom/URLSearchParams.cpp
@@ -38,8 +38,12 @@ private:
URLSearchParams* URLSearchParams::create(const URLSearchParamsInit& init)
{
- if (init.isUSVString())
- return new URLSearchParams(init.getAsUSVString());
+ if (init.isUSVString()) {
+ const String& queryString = init.getAsUSVString();
+ if (queryString.startsWith('?'))
+ return new URLSearchParams(queryString.substring(1));
+ return new URLSearchParams(queryString);
+ }
if (init.isURLSearchParams())
return new URLSearchParams(init.getAsURLSearchParams());
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/domurl/urlsearchparams-constructor.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698