summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/lib.deno.shared_globals.d.ts63
-rw-r--r--cli/js/lib.deno.window.d.ts1
-rw-r--r--cli/js/lib.deno.worker.d.ts1
-rw-r--r--cli/js/ops/runtime.ts1
-rw-r--r--cli/js/runtime_main.ts15
-rw-r--r--cli/js/runtime_worker.ts7
-rw-r--r--cli/js/tests/location_test.ts7
-rw-r--r--cli/js/tests/unit_tests.ts1
-rw-r--r--cli/js/web/README.md5
-rw-r--r--cli/js/web/location.ts52
-rw-r--r--cli/js/web/url.ts2
11 files changed, 3 insertions, 152 deletions
diff --git a/cli/js/lib.deno.shared_globals.d.ts b/cli/js/lib.deno.shared_globals.d.ts
index f86279c27..8f73f0585 100644
--- a/cli/js/lib.deno.shared_globals.d.ts
+++ b/cli/js/lib.deno.shared_globals.d.ts
@@ -192,7 +192,6 @@ declare function clearInterval(id?: number): void;
declare function queueMicrotask(func: Function): void;
declare var console: Console;
-declare var location: Location;
declare function addEventListener(
type: string,
@@ -440,68 +439,6 @@ declare class DOMException extends Error {
readonly message: string;
}
-/** The location (URL) of the object it is linked to. Changes done on it are
- * reflected on the object it relates to. Both the Document and Window
- * interface have such a linked Location, accessible via Document.location and
- * Window.location respectively. */
-declare interface Location {
- /** Returns a DOMStringList object listing the origins of the ancestor
- * browsing contexts, from the parent browsing context to the top-level
- * browsing context. */
- readonly ancestorOrigins: DOMStringList;
- /** Returns the Location object's URL's fragment (includes leading "#" if
- * non-empty).
- *
- * Can be set, to navigate to the same URL with a changed fragment (ignores
- * leading "#"). */
- hash: string;
- /** Returns the Location object's URL's host and port (if different from the
- * default port for the scheme).
- *
- * Can be set, to navigate to the same URL with a changed host and port. */
- host: string;
- /** Returns the Location object's URL's host.
- *
- * Can be set, to navigate to the same URL with a changed host. */
- hostname: string;
- /** Returns the Location object's URL.
- *
- * Can be set, to navigate to the given URL. */
- href: string;
- toString(): string;
- /** Returns the Location object's URL's origin. */
- readonly origin: string;
- /** Returns the Location object's URL's path.
- *
- * Can be set, to navigate to the same URL with a changed path. */
- pathname: string;
- /** Returns the Location object's URL's port.
- *
- * Can be set, to navigate to the same URL with a changed port. */
- port: string;
- /** Returns the Location object's URL's scheme.
- *
- * Can be set, to navigate to the same URL with a changed scheme. */
- protocol: string;
- /** Returns the Location object's URL's query (includes leading "?" if
- * non-empty).
- *
- * Can be set, to navigate to the same URL with a changed query (ignores
- * leading "?"). */
- search: string;
- /**
- * Navigates to the given URL.
- */
- assign(url: string): void;
- /**
- * Reloads the current page.
- */
- reload(): void;
- /** Removes the current page from the session history and navigates to the
- * given URL. */
- replace(url: string): void;
-}
-
type BufferSource = ArrayBufferView | ArrayBuffer;
type BlobPart = BufferSource | Blob | string;
diff --git a/cli/js/lib.deno.window.d.ts b/cli/js/lib.deno.window.d.ts
index 6377057d3..21619af4d 100644
--- a/cli/js/lib.deno.window.d.ts
+++ b/cli/js/lib.deno.window.d.ts
@@ -12,7 +12,6 @@ declare interface Window extends EventTarget {
readonly self: Window & typeof globalThis;
onload: ((this: Window, ev: Event) => any) | null;
onunload: ((this: Window, ev: Event) => any) | null;
- location: Location;
crypto: Crypto;
close: () => void;
readonly closed: boolean;
diff --git a/cli/js/lib.deno.worker.d.ts b/cli/js/lib.deno.worker.d.ts
index bba5f3321..5343646f6 100644
--- a/cli/js/lib.deno.worker.d.ts
+++ b/cli/js/lib.deno.worker.d.ts
@@ -11,7 +11,6 @@ declare interface DedicatedWorkerGlobalScope {
self: DedicatedWorkerGlobalScope & typeof globalThis;
onmessage: (e: MessageEvent) => void;
onmessageerror: (e: MessageEvent) => void;
- location: Location;
onerror: undefined | typeof onerror;
name: typeof __workerMain.name;
close: typeof __workerMain.close;
diff --git a/cli/js/ops/runtime.ts b/cli/js/ops/runtime.ts
index a64c1f8f6..632424327 100644
--- a/cli/js/ops/runtime.ts
+++ b/cli/js/ops/runtime.ts
@@ -7,7 +7,6 @@ export interface Start {
cwd: string;
debugFlag: boolean;
denoVersion: string;
- location: string; // Absolute URL.
noColor: boolean;
pid: number;
repl: boolean;
diff --git a/cli/js/runtime_main.ts b/cli/js/runtime_main.ts
index b2ed5d52b..a9787d7cb 100644
--- a/cli/js/runtime_main.ts
+++ b/cli/js/runtime_main.ts
@@ -24,7 +24,6 @@ import { unstableMethods, unstableProperties } from "./globals_unstable.ts";
import { internalObject, internalSymbol } from "./internals.ts";
import { setSignals } from "./signals.ts";
import { replLoop } from "./repl.ts";
-import { LocationImpl } from "./web/location.ts";
import { setTimeout } from "./web/timers.ts";
import * as runtime from "./runtime.ts";
import { log, immutableDefine } from "./util.ts";
@@ -98,19 +97,7 @@ export function bootstrapMainRuntime(): void {
}
});
- const {
- args,
- cwd,
- location,
- noColor,
- pid,
- repl,
- unstableFlag,
- } = runtime.start();
-
- const location_ = new LocationImpl(location);
- immutableDefine(globalThis, "location", location_);
- Object.freeze(globalThis.location);
+ const { args, cwd, noColor, pid, repl, unstableFlag } = runtime.start();
Object.defineProperties(denoNs, {
pid: readOnly(pid),
diff --git a/cli/js/runtime_worker.ts b/cli/js/runtime_worker.ts
index 1e456f016..18f8841f9 100644
--- a/cli/js/runtime_worker.ts
+++ b/cli/js/runtime_worker.ts
@@ -21,7 +21,6 @@ import { unstableMethods, unstableProperties } from "./globals_unstable.ts";
import * as denoNs from "./deno.ts";
import * as denoUnstableNs from "./deno_unstable.ts";
import * as webWorkerOps from "./ops/web_worker.ts";
-import { LocationImpl } from "./web/location.ts";
import { log, assert, immutableDefine } from "./util.ts";
import { MessageEvent, ErrorEvent } from "./web/workers.ts";
import { TextEncoder } from "./web/text_encoding.ts";
@@ -138,14 +137,10 @@ export function bootstrapWorkerRuntime(
Object.defineProperties(globalThis, eventTargetProperties);
Object.defineProperties(globalThis, { name: readOnly(name) });
setEventTargetData(globalThis);
- const { location, unstableFlag, pid, noColor, args } = runtime.start(
+ const { unstableFlag, pid, noColor, args } = runtime.start(
internalName ?? name
);
- const location_ = new LocationImpl(location);
- immutableDefine(globalThis, "location", location_);
- Object.freeze(globalThis.location);
-
if (unstableFlag) {
Object.defineProperties(globalThis, unstableMethods);
Object.defineProperties(globalThis, unstableProperties);
diff --git a/cli/js/tests/location_test.ts b/cli/js/tests/location_test.ts
deleted file mode 100644
index 2d2faf0c2..000000000
--- a/cli/js/tests/location_test.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { unitTest, assert } from "./test_util.ts";
-
-unitTest(function locationBasic(): void {
- // location example: file:///Users/rld/src/deno/js/unit_tests.ts
- assert(window.location.toString().endsWith("unit_test_runner.ts"));
-});
diff --git a/cli/js/tests/unit_tests.ts b/cli/js/tests/unit_tests.ts
index db2df2216..40d0124d3 100644
--- a/cli/js/tests/unit_tests.ts
+++ b/cli/js/tests/unit_tests.ts
@@ -33,7 +33,6 @@ import "./headers_test.ts";
import "./internals_test.ts";
import "./io_test.ts";
import "./link_test.ts";
-import "./location_test.ts";
import "./make_temp_test.ts";
import "./metrics_test.ts";
import "./dom_iterable_test.ts";
diff --git a/cli/js/web/README.md b/cli/js/web/README.md
index 7df78151e..e44a87315 100644
--- a/cli/js/web/README.md
+++ b/cli/js/web/README.md
@@ -31,11 +31,6 @@ Some of the Web APIs are using ops under the hood, eg. `console`, `performance`.
Promise-based HTTP Request API
- [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData): access
to a `multipart/form-data` serialization
-- [Location](https://developer.mozilla.org/en-US/docs/Web/API/Location): parsing
- the current script's URL
- - **Implementation notes:** the `globalThis.location` object cannot be
- manipulated using `assign()`, `reload()` and `replace()` methods. They are
- not implemented.
- [Performance](https://developer.mozilla.org/en-US/docs/Web/API/Performance):
retrieving current time with a high precision
- [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout),
diff --git a/cli/js/web/location.ts b/cli/js/web/location.ts
deleted file mode 100644
index fe0ca2da2..000000000
--- a/cli/js/web/location.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { notImplemented } from "../util.ts";
-import { getDOMStringList } from "./dom_util.ts";
-
-export class LocationImpl implements Location {
- #url: URL;
-
- constructor(url: string) {
- const u = new URL(url);
- this.#url = u;
- this.hash = u.hash;
- this.host = u.host;
- this.href = u.href;
- this.hostname = u.hostname;
- this.origin = u.protocol + "//" + u.host;
- this.pathname = u.pathname;
- this.protocol = u.protocol;
- this.port = u.port;
- this.search = u.search;
- }
-
- toString(): string {
- return this.#url.toString();
- }
-
- readonly ancestorOrigins: DOMStringList = getDOMStringList([]);
- hash: string;
- host: string;
- hostname: string;
- href: string;
- readonly origin: string;
- pathname: string;
- port: string;
- protocol: string;
- search: string;
- assign(_url: string): void {
- throw notImplemented();
- }
- reload(): void {
- throw notImplemented();
- }
- replace(_url: string): void {
- throw notImplemented();
- }
-}
-
-/** Sets the `window.location` at runtime.
- * @internal */
-export function setLocation(url: string): void {
- globalThis.location = new LocationImpl(url);
- Object.freeze(globalThis.location);
-}
diff --git a/cli/js/web/url.ts b/cli/js/web/url.ts
index 3d513a010..1ae24ff87 100644
--- a/cli/js/web/url.ts
+++ b/cli/js/web/url.ts
@@ -405,7 +405,7 @@ export class URLImpl implements URL {
// TODO(kevinkassimo): implement MediaSource version in the future.
static createObjectURL(b: Blob): string {
- const origin = globalThis.location.origin || "http://deno-opaque-origin";
+ const origin = "http://deno-opaque-origin";
const key = `blob:${origin}/${generateUUID()}`;
blobURLMap.set(key, b);
return key;