0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 17:34:47 -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 { pub fn create_js_runtime(setup: impl FnOnce(&mut JsRuntime)) -> JsRuntime {
let mut rt = JsRuntime::new(Default::default()); let mut rt = JsRuntime::new(Default::default());
// Setup bootstrap namespace
rt.execute("bootstrap", "globalThis.__bootstrap = {};")
.unwrap();
// Caller provided setup // Caller provided setup
setup(&mut rt); setup(&mut rt);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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