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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js

Issue 1998563002: Fix URLSearchParams to use the right encoding algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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/LayoutTests/http/tests/fetch/script-tests/request.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
index c389263df47b7cc685075f821bdde35e6227b7d4..8ead4552122f1b88a5c7bd99c05aad06219bf1cb 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
@@ -648,6 +648,31 @@ async_test(function(t) {
assert_equals(result, "sample+string=1234567890");
})
.then(function() {
+ // Alphanumeric characters and *-._ shouldn't be percent-encoded.
+ // The others must.
+ var params = new URLSearchParams();
+ params.append('\0\x1f!)*+,-./:?[^_{~\x7f\u0080',
+ '\0\x1f!)*+,-./:?[^_{~\x7f\u0080');
+ request = new Request(URL, {method: 'POST', body: params});
+ return request.text();
+ })
+ .then(function(result) {
+ assert_equals(
+ result,
+ "%00%1F%21%29*%2B%2C-.%2F%3A%3F%5B%5E_%7B%7E%7F%C2%80=" +
+ "%00%1F%21%29*%2B%2C-.%2F%3A%3F%5B%5E_%7B%7E%7F%C2%80");
+ })
+ .then(function() {
+ // CR and LF shouldn't be normalized into CRLF.
+ var params = new URLSearchParams();
+ params.append('\r \n \r\n', '\r \n \r\n');
+ request = new Request(URL, {method: 'POST', body: params});
+ return request.text();
+ })
+ .then(function(result) {
+ assert_equals(result, "%0D+%0A+%0D%0A=%0D+%0A+%0D%0A");
+ })
+ .then(function() {
t.done();
})
.catch(unreached_rejection(t));

Powered by Google App Engine
This is Rietveld 408576698