summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/06_util.js1
-rw-r--r--runtime/js/98_global_scope.js34
2 files changed, 8 insertions, 27 deletions
diff --git a/runtime/js/06_util.js b/runtime/js/06_util.js
index 5b6944ccc..391497ba8 100644
--- a/runtime/js/06_util.js
+++ b/runtime/js/06_util.js
@@ -131,6 +131,7 @@
function getterOnly(getter) {
return {
get: getter,
+ set() {},
enumerable: true,
configurable: true,
};
diff --git a/runtime/js/98_global_scope.js b/runtime/js/98_global_scope.js
index b4296278c..5a3dfffb0 100644
--- a/runtime/js/98_global_scope.js
+++ b/runtime/js/98_global_scope.js
@@ -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 = {