From dfc254cd57683f394f1b5fdca8c75200b2a9969d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 9 Oct 2023 00:12:59 +0200 Subject: fix: define window.name (#20804) Closes https://github.com/denoland/deno/issues/20750 This matches what browsers do: https://developer.mozilla.org/en-US/docs/Web/API/Window/name In the future we might want to change the behavior to actually update the process name, but that needs a bit of discussion regarding if it needs a permission flag (that would make polyfiling `process.title` setter really easy too). --- cli/tests/unit/globals_test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'cli/tests/unit') diff --git a/cli/tests/unit/globals_test.ts b/cli/tests/unit/globals_test.ts index c63b28973..184b662a4 100644 --- a/cli/tests/unit/globals_test.ts +++ b/cli/tests/unit/globals_test.ts @@ -1,6 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // deno-lint-ignore-file no-window-prefix -import { assert } from "./test_util.ts"; +import { assert, assertEquals } from "./test_util.ts"; Deno.test(function globalThisExists() { assert(globalThis != null); @@ -128,3 +128,15 @@ Deno.test(function webApiGlobalThis() { assert(globalThis.CountQueuingStrategy !== null); assert(globalThis.ByteLengthQueuingStrategy !== null); }); + +Deno.test(function windowNameIsDefined() { + assertEquals(typeof globalThis.name, "string"); + assertEquals(name, ""); + assertEquals(window.name, name); + name = "foobar"; + assertEquals(window.name, "foobar"); + assertEquals(name, "foobar"); + name = ""; + assertEquals(window.name, ""); + assertEquals(name, ""); +}); -- cgit v1.2.3