Skip to content

Commit

Permalink
Enable shadowrealm testing for url api
Browse files Browse the repository at this point in the history
Starting with tests that don't have additional dependencies.
  • Loading branch information
rwaldron committed Sep 14, 2023
1 parent f8f9fa8 commit 57a0ec2
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions url/historical.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// META: global=window,dedicatedworker,shadowrealm
if (self.location) {
test(function() {
assert_false("searchParams" in self.location,
Expand Down
2 changes: 2 additions & 0 deletions url/url-origin.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");

function runURLTests(urlTests) {
Expand Down
2 changes: 2 additions & 0 deletions url/url-searchparams.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

function bURL(url, base) {
return new URL(url, base || "about:blank")
}
Expand Down
2 changes: 2 additions & 0 deletions url/url-setters-stripping.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

function urlString({ scheme = "https",
username = "username",
password = "password",
Expand Down
2 changes: 2 additions & 0 deletions url/url-statics-canparse.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

// This intentionally does not use resources/urltestdata.json to preserve resources.
[
{
Expand Down
2 changes: 2 additions & 0 deletions url/url-tojson.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(() => {
const a = new URL("https://example.com/")
assert_equals(JSON.stringify(a), "\"https://example.com/\"")
Expand Down
2 changes: 2 additions & 0 deletions url/urlencoded-parser.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

[
{ "input": "test", "output": [["test", ""]] },
{ "input": "\uFEFFtest=\uFEFF", "output": [["\uFEFFtest", "\uFEFF"]] },
Expand Down
2 changes: 2 additions & 0 deletions url/urlsearchparams-append.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(function() {
var params = new URLSearchParams();
params.append('a', 'b');
Expand Down
2 changes: 2 additions & 0 deletions url/urlsearchparams-constructor.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(function() {
var params = new URLSearchParams();
assert_equals(params + '', '');
Expand Down
2 changes: 2 additions & 0 deletions url/urlsearchparams-delete.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(function() {
var params = new URLSearchParams('a=b&c=d');
params.delete('a');
Expand Down
2 changes: 2 additions & 0 deletions url/urlsearchparams-foreach.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(function() {
var params = new URLSearchParams('a=1&b=2&c=3');
var keys = [];
Expand Down
2 changes: 2 additions & 0 deletions url/urlsearchparams-get.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(function() {
var params = new URLSearchParams('a=b&c=d');
assert_equals(params.get('a'), 'b');
Expand Down
2 changes: 2 additions & 0 deletions url/urlsearchparams-getall.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(function() {
var params = new URLSearchParams('a=b&c=d');
assert_array_equals(params.getAll('a'), ['b']);
Expand Down
4 changes: 3 additions & 1 deletion url/urlsearchparams-has.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(function() {
var params = new URLSearchParams('a=b&c=d');
assert_true(params.has('a'));
Expand Down Expand Up @@ -42,4 +44,4 @@ test(() => {
assert_false(params.has('a', 'c'));
assert_true(params.has('a', 'd'));
assert_true(params.has('a', undefined));
}, "Two-argument has() respects undefined as second arg");
}, "Two-argument has() respects undefined as second arg");
2 changes: 2 additions & 0 deletions url/urlsearchparams-set.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(function() {
var params = new URLSearchParams('a=b&c=d');
params.set('a', 'B');
Expand Down
2 changes: 2 additions & 0 deletions url/urlsearchparams-size.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(() => {
const params = new URLSearchParams("a=1&b=2&a=3");
assert_equals(params.size, 3);
Expand Down
2 changes: 2 additions & 0 deletions url/urlsearchparams-sort.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

[
{
"input": "z=b&a=b&z=a&a=a",
Expand Down
2 changes: 2 additions & 0 deletions url/urlsearchparams-stringifier.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(function() {
var params = new URLSearchParams();
params.append('a', 'b c');
Expand Down

0 comments on commit 57a0ec2

Please sign in to comment.