Revert "feat: deprecate window global (#22057)" (#22084)

This reverts commit 930ce20870.

This is producing false-positives that are not actionable to users.
We're gonna address this in another release.
This commit is contained in:
Bartek Iwańczuk 2024-01-24 20:43:31 +01:00 committed by GitHub
parent 300eeb343e
commit 8e67bf829a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 16 deletions

View file

@ -20,7 +20,6 @@ false
true
true
true
[WILDCARD]
true
false
false

View file

@ -1 +1 @@
console.log(globalThis.localStorage);
console.log(window.localStorage);

View file

@ -1,4 +1,4 @@
globalThis.sessionStorage.setItem("hello", "deno");
window.sessionStorage.setItem("hello", "deno");
console.log(globalThis.localStorage);
console.log(globalThis.sessionStorage);
console.log(window.localStorage);
console.log(window.sessionStorage);

View file

@ -1 +1 @@
globalThis.localStorage.setItem("hello", "deno");
window.localStorage.setItem("hello", "deno");

View file

@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { core, internals, primordials } from "ext:core/mod.js";
import { core, primordials } from "ext:core/mod.js";
const {
op_bootstrap_language,
op_bootstrap_numcpus,
@ -108,15 +108,7 @@ const mainRuntimeGlobalProperties = {
Location: location.locationConstructorDescriptor,
location: location.locationDescriptor,
Window: globalInterfaces.windowConstructorDescriptor,
window: util.getterOnly(() => {
internals.warnOnDeprecatedApi(
"window",
new Error().stack,
"Use `globalThis` or `self` instead.",
"You can provide `window` in the current scope with: `const window = globalThis`.",
);
return globalThis;
}),
window: util.getterOnly(() => globalThis),
self: util.getterOnly(() => globalThis),
Navigator: util.nonEnumerable(Navigator),
navigator: util.getterOnly(() => navigator),

View file

@ -164,6 +164,7 @@ function warnOnDeprecatedApi(apiName, stack, ...suggestions) {
"font-weight: bold;",
);
}
if (isFromRemoteDependency) {
console.error(
`%chint: It appears this API is used by a remote dependency. Try upgrading to the latest version of that dependency.`,