Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: qunit/tests/url.js

Issue 5919468974768128: Issue 2062 - Preserve trailing question mark when converting URL into string (Closed)
Patch Set: Created Feb. 27, 2015, 8:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/url.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 function testPreservedURL(url, message) 76 function testPreservedURL(url, message)
77 { 77 {
78 testNormalizedURL(url, url, message); 78 testNormalizedURL(url, url, message);
79 } 79 }
80 80
81 testPreservedURL("http://example.com/foo", "includes path"); 81 testPreservedURL("http://example.com/foo", "includes path");
82 testPreservedURL("http://example.com/?foo=bar", "includes query"); 82 testPreservedURL("http://example.com/?foo=bar", "includes query");
83 testPreservedURL("http://example.com:8080/", "includes port"); 83 testPreservedURL("http://example.com:8080/", "includes port");
84 testPreservedURL("http://example.com/?", "with empty query string");
84 testNormalizedURL("http://example.com/#top","http://example.com/", "stripped hash"); 85 testNormalizedURL("http://example.com/#top","http://example.com/", "stripped hash");
85 testNormalizedURL("http://user:password@example.com/","http://example.com/", "stripped auth credentials"); 86 testNormalizedURL("http://example.com/#top?", "http://example.com/", "stripp ed hash with trailing question mark");
Sebastian Noack 2015/02/27 20:06:29 The behavior regarding credentials changed. For si
86 testNormalizedURL("http://xn--f-1gaa.com/","http://f\u00f6\u00f6.com/", "dec oded punycode"); 87 testNormalizedURL("http://xn--f-1gaa.com/","http://f\u00f6\u00f6.com/", "dec oded punycode");
87 testPreservedURL("about:blank", "about:blank"); 88 testPreservedURL("about:blank", "about:blank");
88 testPreservedURL("data:text/plain,foo", "data: URL"); 89 testPreservedURL("data:text/plain,foo", "data: URL");
89 }); 90 });
90 91
91 test("Third-party checks", function() 92 test("Third-party checks", function()
92 { 93 {
93 function hostnameToURL(hostname) 94 function hostnameToURL(hostname)
94 { 95 {
95 return new URL("http://" + hostname); 96 return new URL("http://" + hostname);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 testThirdParty("1.0xff.1.1", "2.0xff.1.1", true, "different IPv4 address wit h hexadecimal octet is third-party"); 128 testThirdParty("1.0xff.1.1", "2.0xff.1.1", true, "different IPv4 address wit h hexadecimal octet is third-party");
128 testThirdParty("0xff.example.com", "example.com", false, "domain starts like a hexadecimal IPv4 address but isn't one"); 129 testThirdParty("0xff.example.com", "example.com", false, "domain starts like a hexadecimal IPv4 address but isn't one");
129 testThirdParty("[2001:db8:85a3::8a2e:370:7334]", "[2001:db8:85a3::8a2e:370:7 334]", false, "same IPv6 address isn't third-party"); 130 testThirdParty("[2001:db8:85a3::8a2e:370:7334]", "[2001:db8:85a3::8a2e:370:7 334]", false, "same IPv6 address isn't third-party");
130 testThirdParty("[2001:db8:85a3::8a2e:370:7334]", "[5001:db8:85a3::8a2e:370:7 334]", true, "different IPv6 address is third-party"); 131 testThirdParty("[2001:db8:85a3::8a2e:370:7334]", "[5001:db8:85a3::8a2e:370:7 334]", true, "different IPv6 address is third-party");
131 testThirdParty("[::ffff:192.0.2.128]", "[::ffff:192.0.2.128]", false, "same IPv4-mapped IPv6 address isn't third-party"); 132 testThirdParty("[::ffff:192.0.2.128]", "[::ffff:192.0.2.128]", false, "same IPv4-mapped IPv6 address isn't third-party");
132 testThirdParty("[::ffff:192.0.2.128]", "[::ffff:192.1.2.128]", true, "differ ent IPv4-mapped IPv6 address is third-party"); 133 testThirdParty("[::ffff:192.0.2.128]", "[::ffff:192.1.2.128]", true, "differ ent IPv4-mapped IPv6 address is third-party");
133 testThirdParty("xn--f-1gaa.com", "f\u00f6\u00f6.com", false, "same IDN isn't third-party"); 134 testThirdParty("xn--f-1gaa.com", "f\u00f6\u00f6.com", false, "same IDN isn't third-party");
134 testThirdParty("example.com..", "example.com....", false, "traling dots are ignored"); 135 testThirdParty("example.com..", "example.com....", false, "traling dots are ignored");
135 }); 136 });
136 })(); 137 })();
OLDNEW
« no previous file with comments | « lib/url.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld