1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-21 23:04:45 -05:00

refactor(core.js): provide window.__bootstrap (#10423)

This commit is contained in:
Aaron O'Mullan 2021-04-30 14:13:23 +02:00 committed by GitHub
parent a50dab683f
commit 8922639c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 3 additions and 27 deletions

View file

@ -8,10 +8,6 @@ use crate::profiling::is_profiling;
pub fn create_js_runtime(setup: impl FnOnce(&mut JsRuntime)) -> JsRuntime {
let mut rt = JsRuntime::new(Default::default());
// Setup bootstrap namespace
rt.execute("bootstrap", "globalThis.__bootstrap = {};")
.unwrap();
// Caller provided setup
setup(&mut rt);

View file

@ -124,6 +124,9 @@
opSync("op_close", rid);
}
// Provide bootstrap namespace
window.__bootstrap = {};
// Extra Deno.core.* exports
Object.assign(window.Deno.core, {
opAsync,
opSync,

View file

@ -44,7 +44,6 @@
window.crypto = {
getRandomValues,
};
window.__bootstrap = window.__bootstrap || {};
window.__bootstrap.crypto = {
getRandomValues,
};

View file

@ -10,13 +10,6 @@ fn create_js_runtime() -> JsRuntime {
..Default::default()
});
runtime
.execute(
"bootstrap",
"globalThis.__bootstrap = (globalThis.__bootstrap || {});",
)
.unwrap();
runtime.init_extension_js().unwrap();
runtime.init_extension_ops().unwrap();

View file

@ -1202,7 +1202,6 @@
window.dispatchEvent = EventTarget.prototype.dispatchEvent;
window.addEventListener = EventTarget.prototype.addEventListener;
window.removeEventListener = EventTarget.prototype.removeEventListener;
window.__bootstrap = (window.__bootstrap || {});
window.__bootstrap.eventTarget = {
EventTarget,
setEventTargetData,

View file

@ -120,7 +120,6 @@
window.AbortSignal = AbortSignal;
window.AbortController = AbortController;
window.__bootstrap = window.__bootstrap || {};
window.__bootstrap.abortSignal = {
add,
signalAbort,

View file

@ -44,7 +44,6 @@
}
}
window.__bootstrap = (window.__bootstrap || {});
window.__bootstrap.globalInterfaces = {
DedicatedWorkerGlobalScope,
Window,

View file

@ -4559,7 +4559,6 @@
window.TextDecoder = TextDecoder;
window.atob = atob;
window.btoa = btoa;
window.__bootstrap = window.__bootstrap || {};
window.__bootstrap.encoding = { decode };
window.__bootstrap.base64 = base64;
})(this);

View file

@ -348,7 +348,6 @@
workerLocation = new WorkerLocation(href, locationConstructorKey);
}
window.__bootstrap = (window.__bootstrap || {});
window.__bootstrap.location = {
locationConstructorDescriptor: {
value: Location,

View file

@ -1,10 +0,0 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// The only purpose of this file is to set up "globalThis.__bootstrap" namespace,
// that is used by scripts in this directory to reference exports between
// the files.
// This namespace is removed during runtime bootstrapping process.
"use strict";
globalThis.__bootstrap = globalThis.__bootstrap || {};