From 7db0605d456559f1ca9447e6fa778559fe50cc95 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Sun, 17 Jan 2021 15:28:54 +0000 Subject: fix(op_crates/web): Use WorkerLocation for location in workers (#9084) --- cli/tests/070_location.ts.out | 2 -- cli/tests/079_location_authentication.ts | 1 + cli/tests/079_location_authentication.ts.out | 3 +++ cli/tests/integration_tests.rs | 5 +++++ cli/tests/subdir/worker_location.ts | 4 +++- cli/tests/workers_test.ts | 2 +- 6 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 cli/tests/079_location_authentication.ts create mode 100644 cli/tests/079_location_authentication.ts.out (limited to 'cli/tests') diff --git a/cli/tests/070_location.ts.out b/cli/tests/070_location.ts.out index 66d470b6f..2ba0f259d 100644 --- a/cli/tests/070_location.ts.out +++ b/cli/tests/070_location.ts.out @@ -6,12 +6,10 @@ Location { hostname: [Getter/Setter], href: [Getter/Setter], origin: [Getter], - password: [Getter/Setter], pathname: [Getter/Setter], port: [Getter/Setter], protocol: [Getter/Setter], search: [Getter/Setter], - username: [Getter/Setter], ancestorOrigins: [Getter], assign: [Function: assign], reload: [Function: reload], diff --git a/cli/tests/079_location_authentication.ts b/cli/tests/079_location_authentication.ts new file mode 100644 index 000000000..4989312ac --- /dev/null +++ b/cli/tests/079_location_authentication.ts @@ -0,0 +1 @@ +console.log(location.href); diff --git a/cli/tests/079_location_authentication.ts.out b/cli/tests/079_location_authentication.ts.out new file mode 100644 index 000000000..bb2458497 --- /dev/null +++ b/cli/tests/079_location_authentication.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +https://baz/qux +[WILDCARD] diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 586c405e3..9c64a9e07 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2651,6 +2651,11 @@ itest!(_078_unload_on_exit { output: "078_unload_on_exit.ts.out", }); +itest!(_079_location_authentication { + args: "run --location https://foo:bar@baz/qux 079_location_authentication.ts", + output: "079_location_authentication.ts.out", +}); + itest!(js_import_detect { args: "run --quiet --reload js_import_detect.ts", output: "js_import_detect.ts.out", diff --git a/cli/tests/subdir/worker_location.ts b/cli/tests/subdir/worker_location.ts index 480032350..89fa83036 100644 --- a/cli/tests/subdir/worker_location.ts +++ b/cli/tests/subdir/worker_location.ts @@ -1,4 +1,6 @@ onmessage = function (): void { - postMessage(self.location.href); + postMessage( + `${location.href}, ${location instanceof WorkerLocation}`, + ); close(); }; diff --git a/cli/tests/workers_test.ts b/cli/tests/workers_test.ts index 2ea6f6cf5..66444411e 100644 --- a/cli/tests/workers_test.ts +++ b/cli/tests/workers_test.ts @@ -648,7 +648,7 @@ Deno.test({ new URL("subdir/worker_location.ts", import.meta.url).href; const w = new Worker(workerModuleHref, { type: "module" }); w.onmessage = (e): void => { - assertEquals(e.data, workerModuleHref); + assertEquals(e.data, `${workerModuleHref}, true`); promise.resolve(); }; w.postMessage("Hello, world!"); -- cgit v1.2.3