<script>
if (window.testRunner)
    testRunner.dumpAsText();
var u = new URL("http://example.com?q=foo");
u.searchParams.foo = 1;
if (window.GCController)
	GCController.collect();
console.log(u.searchParams.foo == 1 ? "PASS" : "FAIL");

var x = new URLSearchParams("a=ß");
console.log(x == "a=%C3%83%C5%B8" ? "PASS" : "FAIL");

const a = new URL("http://host/?param");
a.searchParams.delete("param");
console.log(a == "http://host/" ? "PASS" : "FAIL");

let b = new URLSearchParams("a=b");
b.delete("a");
console.log(b == "" ? "PASS" : "FAIL");

try {
    new URLSearchParams({ [Symbol()]: "a" });
    console.log("FAIL");
} catch (err) {
    console.log(`PASS threw exception ${err}.`);
}
</script>
