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: Addressed feedback, used destructuring Created Jan. 17, 2017, 7:39 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
« 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
diff --git a/qunit/tests/url.js b/qunit/tests/url.js
index 1b504cb70d7442a8f5cbfa086266fec9bc19dfaf..58376f442b59f914a94122455777213d45cc2588 100644
--- a/qunit/tests/url.js
+++ b/qunit/tests/url.js
@@ -15,18 +15,17 @@
* 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 {getDecodedHostname,
+ extractHostFromFrame,
+ stringifyURL,
+ isThirdParty} = require("url");
module("URL/host tools");
- test("Extracting hostname from URL", function()
+ test("Extracting hostname from URL", () =>
{
function testURLHostname(url, expectedHostname, message)
{
@@ -46,14 +45,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 +65,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 +88,7 @@
testPreservedURL("data:text/plain,foo", "data: URL");
});
- test("Third-party checks", function()
+ test("Third-party checks", () =>
{
function hostnameToURL(hostname)
{
@@ -134,4 +133,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");
});
-})();
+}
« 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