From b0bf2746e72eb23d4a7d51be0e72ed51308d1551 Mon Sep 17 00:00:00 2001 From: XadillaX Date: Mon, 23 Aug 2021 17:58:47 +0800 Subject: [PATCH] lib,url: correct URL's argument to pass idlharness `url.idl` defines URL's constructor as: ``` constructor(USVString url, optional USVString base); ``` `idlharness.any.js` checks its length as `1`. So we should remove constructor's second argument and use `arguments[1]` in constructor's logic. Refs: https://url.spec.whatwg.org/#idl-index --- lib/internal/url.js | 2 +- test/wpt/status/url.json | 3 --- test/wpt/test-url.js | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/internal/url.js b/lib/internal/url.js index a5e3bb96908e2e..30b6701055f20d 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -621,7 +621,7 @@ function isURLThis(self) { } class URL { - constructor(input, base) { + constructor(input, base = undefined) { // toUSVString is not needed. input = `${input}`; let base_context; diff --git a/test/wpt/status/url.json b/test/wpt/status/url.json index ab89356f82c805..2372a367e982a9 100644 --- a/test/wpt/status/url.json +++ b/test/wpt/status/url.json @@ -13,9 +13,6 @@ "urlencoded-parser.any.js": { "fail": "missing Request and Response" }, - "idlharness.any.js": { - "fail": "getter/setter names are wrong, etc." - }, "urlsearchparams-constructor.any.js": { "fail": "FormData is not defined" }, diff --git a/test/wpt/test-url.js b/test/wpt/test-url.js index c1cb3e4f850c4e..1177000ea6f047 100644 --- a/test/wpt/test-url.js +++ b/test/wpt/test-url.js @@ -5,4 +5,5 @@ const { WPTRunner } = require('../common/wpt'); const runner = new WPTRunner('url'); +runner.setInitScript('global.Window = global.__proto__.constructor;'); runner.runJsTests();