mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
refactor(core.js): provide window.__bootstrap (#10423)
This commit is contained in:
parent
a50dab683f
commit
8922639c1d
10 changed files with 3 additions and 27 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -124,6 +124,9 @@
|
|||
opSync("op_close", rid);
|
||||
}
|
||||
|
||||
// Provide bootstrap namespace
|
||||
window.__bootstrap = {};
|
||||
// Extra Deno.core.* exports
|
||||
Object.assign(window.Deno.core, {
|
||||
opAsync,
|
||||
opSync,
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
window.crypto = {
|
||||
getRandomValues,
|
||||
};
|
||||
window.__bootstrap = window.__bootstrap || {};
|
||||
window.__bootstrap.crypto = {
|
||||
getRandomValues,
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -120,7 +120,6 @@
|
|||
|
||||
window.AbortSignal = AbortSignal;
|
||||
window.AbortController = AbortController;
|
||||
window.__bootstrap = window.__bootstrap || {};
|
||||
window.__bootstrap.abortSignal = {
|
||||
add,
|
||||
signalAbort,
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
window.__bootstrap = (window.__bootstrap || {});
|
||||
window.__bootstrap.globalInterfaces = {
|
||||
DedicatedWorkerGlobalScope,
|
||||
Window,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -348,7 +348,6 @@
|
|||
workerLocation = new WorkerLocation(href, locationConstructorKey);
|
||||
}
|
||||
|
||||
window.__bootstrap = (window.__bootstrap || {});
|
||||
window.__bootstrap.location = {
|
||||
locationConstructorDescriptor: {
|
||||
value: Location,
|
||||
|
|
|
@ -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 || {};
|
Loading…
Reference in a new issue