mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 00:29:09 -05:00
parent
fcb0ae62e9
commit
084e7c9560
2 changed files with 17 additions and 0 deletions
|
@ -32,6 +32,21 @@ Deno.test(function urlParsing() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test(function emptyUrl() {
|
||||||
|
assertThrows(
|
||||||
|
// @ts-ignore for test
|
||||||
|
() => new URL(),
|
||||||
|
TypeError,
|
||||||
|
"1 argument required, but only 0 present",
|
||||||
|
);
|
||||||
|
assertThrows(
|
||||||
|
// @ts-ignore for test
|
||||||
|
() => URL.canParse(),
|
||||||
|
TypeError,
|
||||||
|
"1 argument required, but only 0 present",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
Deno.test(function urlProtocolParsing() {
|
Deno.test(function urlProtocolParsing() {
|
||||||
assertEquals(new URL("Aa+-.1://foo").protocol, "aa+-.1:");
|
assertEquals(new URL("Aa+-.1://foo").protocol, "aa+-.1:");
|
||||||
assertEquals(new URL("aA+-.1://foo").protocol, "aa+-.1:");
|
assertEquals(new URL("aA+-.1://foo").protocol, "aa+-.1:");
|
||||||
|
|
|
@ -371,6 +371,7 @@ class URL {
|
||||||
*/
|
*/
|
||||||
constructor(url, base = undefined) {
|
constructor(url, base = undefined) {
|
||||||
const prefix = "Failed to construct 'URL'";
|
const prefix = "Failed to construct 'URL'";
|
||||||
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||||
url = webidl.converters.DOMString(url, { prefix, context: "Argument 1" });
|
url = webidl.converters.DOMString(url, { prefix, context: "Argument 1" });
|
||||||
if (base !== undefined) {
|
if (base !== undefined) {
|
||||||
base = webidl.converters.DOMString(base, {
|
base = webidl.converters.DOMString(base, {
|
||||||
|
@ -390,6 +391,7 @@ class URL {
|
||||||
*/
|
*/
|
||||||
static canParse(url, base = undefined) {
|
static canParse(url, base = undefined) {
|
||||||
const prefix = "Failed to call 'URL.canParse'";
|
const prefix = "Failed to call 'URL.canParse'";
|
||||||
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||||
url = webidl.converters.DOMString(url, { prefix, context: "Argument 1" });
|
url = webidl.converters.DOMString(url, { prefix, context: "Argument 1" });
|
||||||
if (base !== undefined) {
|
if (base !== undefined) {
|
||||||
base = webidl.converters.DOMString(base, {
|
base = webidl.converters.DOMString(base, {
|
||||||
|
|
Loading…
Reference in a new issue