1if (self.location) { 2 test(function() { 3 assert_false("searchParams" in self.location, 4 "location object should not have a searchParams attribute"); 5 }, "searchParams on location object"); 6} 7 8if(self.GLOBAL.isWindow()) { 9 test(() => { 10 assert_false("searchParams" in document.createElement("a")) 11 assert_false("searchParams" in document.createElement("area")) 12 }, "<a> and <area>.searchParams should be undefined"); 13} 14 15test(function() { 16 var url = new URL("./foo", "http://www.example.org"); 17 assert_equals(url.href, "http://www.example.org/foo"); 18 assert_throws_js(TypeError, function() { 19 url.href = "./bar"; 20 }); 21}, "Setting URL's href attribute and base URLs"); 22 23test(function() { 24 assert_equals(URL.domainToASCII, undefined); 25}, "URL.domainToASCII should be undefined"); 26 27test(function() { 28 assert_equals(URL.domainToUnicode, undefined); 29}, "URL.domainToUnicode should be undefined"); 30 31test(() => { 32 assert_throws_dom("DataCloneError", () => self.structuredClone(new URL("about:blank"))); 33}, "URL: no structured serialize/deserialize support"); 34 35test(() => { 36 assert_throws_dom("DataCloneError", () => self.structuredClone(new URLSearchParams())); 37}, "URLSearchParams: no structured serialize/deserialize support"); 38 39test(() => { 40 const url = new URL("about:blank"); 41 url.toString = () => { throw 1 }; 42 assert_throws_exactly(1, () => new URL(url), "url argument"); 43 assert_throws_exactly(1, () => new URL("about:blank", url), "base argument"); 44}, "Constructor only takes strings"); 45 46done(); 47