1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00
denoland-deno/tests/specs/run/location/location.js
Bartek Iwańczuk 08d3f17110
feat: make 'globalThis.location' a configurable property (#25812)
This commit changes `globalThis.location` property to be configurable
so that packages wanting to override it (or delete it) work properly.

Towards https://github.com/denoland/deno/issues/23882

This change makes reproduction from
https://github.com/denoland/deno/issues/23882#issuecomment-2340783437
pass properly.
2024-09-23 14:18:07 +02:00

24 lines
402 B
JavaScript

let _location = undefined;
console.log(globalThis.location);
Object.defineProperty(globalThis, "location", {
get() {
return _location;
},
set(v) {
_location = v;
},
configurable: true,
});
console.log(globalThis.location);
globalThis.location = "https://deno.com";
console.log(_location);
console.log(location);
delete globalThis["location"];
console.log(globalThis.location);