mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
08d3f17110
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.
24 lines
402 B
JavaScript
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);
|