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

Unified Diff: qunit/tests/url.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: Fix scoping regression Created Jan. 16, 2017, 9:12 a.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
Index: qunit/tests/url.js
diff --git a/qunit/tests/url.js b/qunit/tests/url.js
index 1b504cb70d7442a8f5cbfa086266fec9bc19dfaf..6168e75a9ffb90a62e6c8494e63789f2fdb2403b 100644
--- a/qunit/tests/url.js
+++ b/qunit/tests/url.js
@@ -15,18 +15,18 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
+"use strict";
-(function()
{
- var url = require("url");
- var getDecodedHostname = url.getDecodedHostname;
- var extractHostFromFrame = url.extractHostFromFrame;
- var stringifyURL = url.stringifyURL;
- var isThirdParty = url.isThirdParty;
+ let url = require("url");
+ let getDecodedHostname = url.getDecodedHostname;
+ let extractHostFromFrame = url.extractHostFromFrame;
+ let stringifyURL = url.stringifyURL;
+ let isThirdParty = url.isThirdParty;
module("URL/host tools");
- test("Extracting hostname from URL", function()
+ test("Extracting hostname from URL", () =>
{
function testURLHostname(url, expectedHostname, message)
{
@@ -46,14 +46,14 @@
testURLHostname("http://[2001:db8:85a3::8a2e:370:7334]/", "[2001:db8:85a3::8a2e:370:7334]", "IPv6 address");
});
- test("Extracting hostname from frame", function()
+ test("Extracting hostname from frame", () =>
{
function testFrameHostname(hierarchy, expectedHostname, message)
{
- var frame = null;
+ let frame = null;
- for (var i = 0; i < hierarchy.length; i++)
- frame = {parent: frame, url: new URL(hierarchy[i])};
+ for (let url of hierarchy)
+ frame = {parent: frame, url: new URL(url)};
equal(extractHostFromFrame(frame), expectedHostname, message);
}
@@ -66,7 +66,7 @@
testFrameHostname(["http://xn--f-1gaa.com/"], "f\u00f6\u00f6.com", "with punycode");
});
- test("Stringifying URLs", function()
+ test("Stringifying URLs", () =>
{
function testNormalizedURL(url, expectedURL, message)
{
@@ -89,7 +89,7 @@
testPreservedURL("data:text/plain,foo", "data: URL");
});
- test("Third-party checks", function()
+ test("Third-party checks", () =>
{
function hostnameToURL(hostname)
{
@@ -134,4 +134,4 @@
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");
});
-})();
+}

Powered by Google App Engine
This is Rietveld