mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
feat: add --location=<href> and globalThis.location (#7369)
This commit is contained in:
parent
c347dfcd56
commit
e61e81eb57
34 changed files with 737 additions and 193 deletions
|
@ -9,6 +9,7 @@ delete Object.prototype.__proto__;
|
|||
const util = window.__bootstrap.util;
|
||||
const eventTarget = window.__bootstrap.eventTarget;
|
||||
const globalInterfaces = window.__bootstrap.globalInterfaces;
|
||||
const location = window.__bootstrap.location;
|
||||
const dispatchMinimal = window.__bootstrap.dispatchMinimal;
|
||||
const build = window.__bootstrap.build;
|
||||
const version = window.__bootstrap.version;
|
||||
|
@ -196,6 +197,8 @@ delete Object.prototype.__proto__;
|
|||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope
|
||||
const windowOrWorkerGlobalScope = {
|
||||
Location: location.locationConstructorDescriptor,
|
||||
location: location.locationDescriptor,
|
||||
Blob: util.nonEnumerable(fetch.Blob),
|
||||
ByteLengthQueuingStrategy: util.nonEnumerable(
|
||||
streams.ByteLengthQueuingStrategy,
|
||||
|
@ -290,7 +293,19 @@ delete Object.prototype.__proto__;
|
|||
defineEventHandler(window, "unload", null);
|
||||
|
||||
runtimeStart(runtimeOptions);
|
||||
const { args, noColor, pid, ppid, unstableFlag } = runtimeOptions;
|
||||
const {
|
||||
args,
|
||||
location: locationHref,
|
||||
noColor,
|
||||
pid,
|
||||
ppid,
|
||||
unstableFlag,
|
||||
} = runtimeOptions;
|
||||
|
||||
if (locationHref != null) {
|
||||
location.setLocationHref(locationHref);
|
||||
fetch.setBaseUrl(locationHref);
|
||||
}
|
||||
|
||||
registerErrors();
|
||||
|
||||
|
@ -349,8 +364,11 @@ delete Object.prototype.__proto__;
|
|||
runtimeOptions,
|
||||
internalName ?? name,
|
||||
);
|
||||
const { unstableFlag, pid, noColor, args } = runtimeOptions;
|
||||
const { unstableFlag, pid, noColor, args, location: locationHref } =
|
||||
runtimeOptions;
|
||||
|
||||
location.setLocationHref(locationHref);
|
||||
fetch.setBaseUrl(locationHref);
|
||||
registerErrors();
|
||||
|
||||
const finalDenoNs = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue