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

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: 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
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());

Powered by Google App Engine
This is Rietveld 408576698