mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
fix: make self and window getters only & make getterOnly ignore setting (#17362)
This commit is contained in:
parent
0003cf756e
commit
257471f586
2 changed files with 8 additions and 27 deletions
|
@ -131,6 +131,7 @@
|
|||
function getterOnly(getter) {
|
||||
return {
|
||||
get: getter,
|
||||
set() {},
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
};
|
||||
|
|
|
@ -296,31 +296,15 @@
|
|||
Location: location.locationConstructorDescriptor,
|
||||
location: location.locationDescriptor,
|
||||
Window: globalInterfaces.windowConstructorDescriptor,
|
||||
window: util.readOnly(globalThis),
|
||||
self: util.writable(globalThis),
|
||||
window: util.getterOnly(() => globalThis),
|
||||
self: util.getterOnly(() => globalThis),
|
||||
Navigator: util.nonEnumerable(Navigator),
|
||||
navigator: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: () => navigator,
|
||||
},
|
||||
navigator: util.getterOnly(() => navigator),
|
||||
alert: util.writable(prompt.alert),
|
||||
confirm: util.writable(prompt.confirm),
|
||||
prompt: util.writable(prompt.prompt),
|
||||
localStorage: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: webStorage.localStorage,
|
||||
// Makes this reassignable to make astro work
|
||||
set: () => {},
|
||||
},
|
||||
sessionStorage: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: webStorage.sessionStorage,
|
||||
// Makes this reassignable to make astro work
|
||||
set: () => {},
|
||||
},
|
||||
localStorage: util.getterOnly(webStorage.localStorage),
|
||||
sessionStorage: util.getterOnly(webStorage.sessionStorage),
|
||||
Storage: util.nonEnumerable(webStorage.Storage),
|
||||
};
|
||||
|
||||
|
@ -331,12 +315,8 @@
|
|||
DedicatedWorkerGlobalScope:
|
||||
globalInterfaces.dedicatedWorkerGlobalScopeConstructorDescriptor,
|
||||
WorkerNavigator: util.nonEnumerable(WorkerNavigator),
|
||||
navigator: {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: () => workerNavigator,
|
||||
},
|
||||
self: util.readOnly(globalThis),
|
||||
navigator: util.getterOnly(() => workerNavigator),
|
||||
self: util.getterOnly(() => globalThis),
|
||||
};
|
||||
|
||||
window.__bootstrap.globalScope = {
|
||||
|
|
Loading…
Reference in a new issue