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

Unified Diff: qunit/tests/url.js

Issue 29452181: Noissue - Merge current tip to Edge bookmark (Closed)
Patch Set: Created May 30, 2017, 3:49 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « qunit/tests/prefs.js ('k') | qunit/tests/versionComparator.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: qunit/tests/url.js
===================================================================
--- a/qunit/tests/url.js
+++ b/qunit/tests/url.js
@@ -1,6 +1,6 @@
/*
* This file is part of Adblock Plus <https://adblockplus.org/>,
- * Copyright (C) 2006-2016 Eyeo GmbH
+ * Copyright (C) 2006-2017 eyeo GmbH
*
* Adblock Plus is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -17,6 +17,7 @@
"use strict";
+(function()
{
let {getDecodedHostname,
extractHostFromFrame,
@@ -36,13 +37,16 @@
testURLHostname("http://example.com/?foo=bar", "example.com", "with query");
testURLHostname("http://example.com/#top", "example.com", "with hash");
testURLHostname("http://example.com:8080/", "example.com", "with port");
- testURLHostname("http://user:password@example.com/", "example.com", "with auth credentials");
- testURLHostname("http://xn--f-1gaa.com/", "f\u00f6\u00f6.com", "with punycode");
+ testURLHostname("http://user:password@example.com/", "example.com",
+ "with auth credentials");
+ testURLHostname("http://xn--f-1gaa.com/", "f\u00f6\u00f6.com",
+ "with punycode");
testURLHostname("about:blank", "", "about:blank");
testURLHostname("data:text/plain,foo", "", "data: URL");
testURLHostname("ftp://example.com/", "example.com", "ftp: URL");
testURLHostname("http://1.2.3.4:8000/", "1.2.3.4", "IPv4 address");
- testURLHostname("http://[2001:db8:85a3::8a2e:370:7334]/", "[2001:db8:85a3::8a2e:370:7334]", "IPv6 address");
+ testURLHostname("http://[2001:db8:85a3::8a2e:370:7334]/",
+ "[2001:db8:85a3::8a2e:370:7334]", "IPv6 address");
});
test("Extracting hostname from frame", () =>
@@ -58,11 +62,16 @@
}
testFrameHostname(["http://example.com/"], "example.com", "single frame");
- testFrameHostname(["http://example.com/", "http://example.org/"], "example.org", "with parent frame");
- testFrameHostname(["http://example.com/", "data:text/plain,foo"], "example.com", "data: URL, hostname in parent");
- testFrameHostname(["http://example.com/", "about:blank", "about:blank"], "example.com", "about:blank, hostname in ancestor");
- testFrameHostname(["about:blank", "about:blank"], "", "about:blank, no hostname");
- testFrameHostname(["http://xn--f-1gaa.com/"], "f\u00f6\u00f6.com", "with punycode");
+ testFrameHostname(["http://example.com/", "http://example.org/"],
+ "example.org", "with parent frame");
+ testFrameHostname(["http://example.com/", "data:text/plain,foo"],
+ "example.com", "data: URL, hostname in parent");
+ testFrameHostname(["http://example.com/", "about:blank", "about:blank"],
+ "example.com", "about:blank, hostname in ancestor");
+ testFrameHostname(["about:blank", "about:blank"], "",
+ "about:blank, no hostname");
+ testFrameHostname(["http://xn--f-1gaa.com/"], "f\u00f6\u00f6.com",
+ "with punycode");
});
test("Stringifying URLs", () =>
@@ -81,9 +90,12 @@
testPreservedURL("http://example.com/?foo=bar", "includes query");
testPreservedURL("http://example.com:8080/", "includes port");
testPreservedURL("http://example.com/?", "with empty query string");
- testNormalizedURL("http://example.com/#top","http://example.com/", "stripped hash");
- testNormalizedURL("http://example.com/#top?", "http://example.com/", "stripped hash with trailing question mark");
- testNormalizedURL("http://xn--f-1gaa.com/","http://f\u00f6\u00f6.com/", "decoded punycode");
+ testNormalizedURL("http://example.com/#top", "http://example.com/",
+ "stripped hash");
+ testNormalizedURL("http://example.com/#top?", "http://example.com/",
+ "stripped hash with trailing question mark");
+ testNormalizedURL("http://xn--f-1gaa.com/", "http://f\u00f6\u00f6.com/",
+ "decoded punycode");
testPreservedURL("about:blank", "about:blank");
testPreservedURL("data:text/plain,foo", "data: URL");
});
@@ -112,25 +124,59 @@
testThirdParty("foo", "foo", false, "same domain isn't third-party");
testThirdParty("foo", "bar", true, "different domain is third-party");
- testThirdParty("foo.com", "foo.com", false, "same domain with TLD (.com) isn't third-party");
- testThirdParty("foo.com", "bar.com", true, "same TLD (.com) but different domain is third-party");
- testThirdParty("foo.com", "www.foo.com", false, "same domain but differend subdomain isn't third-party");
- testThirdParty("foo.example.com", "bar.example.com", false, "same basedomain (example.com) isn't third-party");
- testThirdParty("foo.uk", "bar.uk", true, "same TLD (.uk) but different domain is third-party");
- testThirdParty("foo.co.uk", "bar.co.uk", true, "same TLD (.co.uk) but different domain is third-party");
- testThirdParty("foo.example.co.uk", "bar.example.co.uk", false, "same basedomain (example.co.uk) isn't third-party");
- testThirdParty("1.2.3.4", "1.2.3.4", false, "same IPv4 address isn't third-party");
- testThirdParty("1.1.1.1", "2.1.1.1", true, "different IPv4 address is third-party");
- testThirdParty("0x01ff0101", "0x01ff0101", false, "same IPv4 hexadecimal address isn't third-party");
- testThirdParty("0x01ff0101", "0x01ff0102", true, "different IPv4 hexadecimal address is third-party");
- testThirdParty("1.0xff.3.4", "1.0xff.3.4", false, "same IPv4 address with hexadecimal octet isn't third-party");
- testThirdParty("1.0xff.1.1", "2.0xff.1.1", true, "different IPv4 address with hexadecimal octet is third-party");
- testThirdParty("0xff.example.com", "example.com", false, "domain starts like a hexadecimal IPv4 address but isn't one");
- testThirdParty("[2001:db8:85a3::8a2e:370:7334]", "[2001:db8:85a3::8a2e:370:7334]", false, "same IPv6 address isn't third-party");
- testThirdParty("[2001:db8:85a3::8a2e:370:7334]", "[5001:db8:85a3::8a2e:370:7334]", true, "different IPv6 address is third-party");
- testThirdParty("[::ffff:192.0.2.128]", "[::ffff:192.0.2.128]", false, "same IPv4-mapped IPv6 address isn't third-party");
- testThirdParty("[::ffff:192.0.2.128]", "[::ffff:192.1.2.128]", true, "different IPv4-mapped IPv6 address is third-party");
- testThirdParty("xn--f-1gaa.com", "f\u00f6\u00f6.com", false, "same IDN isn't third-party");
- testThirdParty("example.com..", "example.com....", false, "traling dots are ignored");
+ testThirdParty("foo.com", "foo.com", false,
+ "same domain with TLD (.com) isn't third-party");
+ testThirdParty("foo.com", "bar.com", true,
+ "same TLD (.com) but different domain is third-party");
+ testThirdParty("foo.com", "www.foo.com", false,
+ "same domain but differend subdomain isn't third-party");
+ testThirdParty("foo.example.com", "bar.example.com", false,
+ "same basedomain (example.com) isn't third-party");
+ testThirdParty("foo.uk", "bar.uk", true,
+ "same TLD (.uk) but different domain is third-party");
+ testThirdParty("foo.co.uk", "bar.co.uk", true,
+ "same TLD (.co.uk) but different domain is third-party");
+ testThirdParty("foo.example.co.uk", "bar.example.co.uk", false,
+ "same basedomain (example.co.uk) isn't third-party");
+ testThirdParty("1.2.3.4", "1.2.3.4", false,
+ "same IPv4 address isn't third-party");
+ testThirdParty("1.1.1.1", "2.1.1.1", true,
+ "different IPv4 address is third-party");
+ testThirdParty("0x01ff0101", "0x01ff0101", false,
+ "same IPv4 hexadecimal address isn't third-party");
+ testThirdParty("0x01ff0101", "0x01ff0102", true,
+ "different IPv4 hexadecimal address is third-party");
+ testThirdParty(
+ "1.0xff.3.4", "1.0xff.3.4", false,
+ "same IPv4 address with hexadecimal octet isn't third-party"
+ );
+ testThirdParty(
+ "1.0xff.1.1", "2.0xff.1.1", true,
+ "different IPv4 address with hexadecimal octet is third-party"
+ );
+ testThirdParty(
+ "0xff.example.com", "example.com", false,
+ "domain starts like a hexadecimal IPv4 address but isn't one"
+ );
+ testThirdParty(
+ "[2001:db8:85a3::8a2e:370:7334]", "[2001:db8:85a3::8a2e:370:7334]", false,
+ "same IPv6 address isn't third-party"
+ );
+ testThirdParty(
+ "[2001:db8:85a3::8a2e:370:7334]", "[5001:db8:85a3::8a2e:370:7334]", true,
+ "different IPv6 address is third-party"
+ );
+ testThirdParty(
+ "[::ffff:192.0.2.128]", "[::ffff:192.0.2.128]", false,
+ "same IPv4-mapped IPv6 address isn't third-party"
+ );
+ testThirdParty(
+ "[::ffff:192.0.2.128]", "[::ffff:192.1.2.128]", true,
+ "different IPv4-mapped IPv6 address is third-party"
+ );
+ testThirdParty("xn--f-1gaa.com", "f\u00f6\u00f6.com", false,
+ "same IDN isn't third-party");
+ testThirdParty("example.com..", "example.com....", false,
+ "traling dots are ignored");
});
-}
+}());
« no previous file with comments | « qunit/tests/prefs.js ('k') | qunit/tests/versionComparator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld