From 5808981e56bc438b91ba8bc8711e95b75f43393d Mon Sep 17 00:00:00 2001 From: Lea Verou Date: Mon, 16 Oct 2023 18:39:03 -0400 Subject: [PATCH] Remove location (breaks Node, also see #57) --- backends/coda/table/coda-table.js | 2 +- backends/github/api/github-api.js | 4 ++-- backends/github/file/github-file.js | 2 +- src/backend.js | 2 +- src/oauth-backend.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backends/coda/table/coda-table.js b/backends/coda/table/coda-table.js index d014f67..84c49b4 100644 --- a/backends/coda/table/coda-table.js +++ b/backends/coda/table/coda-table.js @@ -78,7 +78,7 @@ export default class CodaTable extends Coda { } static parseURL (source) { - let url = new URL(source, location); + let url = new URL(source); if (url.host === "coda.io") { for (let pattern in patterns) { diff --git a/backends/github/api/github-api.js b/backends/github/api/github-api.js index 0fec9d7..f643bae 100644 --- a/backends/github/api/github-api.js +++ b/backends/github/api/github-api.js @@ -73,13 +73,13 @@ export default class GithubAPI extends Github { } static test (url) { - url = new URL(url, location); + url = new URL(url); return url.host === "api.github.com"; } static parseURL (source) { let ret = { - url: new URL(source, location) + url: new URL(source) }; if (ret.url.pathname == "/graphql") { diff --git a/backends/github/file/github-file.js b/backends/github/file/github-file.js index 83b41ea..7c7697b 100644 --- a/backends/github/file/github-file.js +++ b/backends/github/file/github-file.js @@ -428,7 +428,7 @@ export default class GithubFile extends Github { } static test (url) { - url = new URL(url, location); + url = new URL(url); return ["github.com", "raw.githubusercontent.com"].includes(url.host); } diff --git a/src/backend.js b/src/backend.js index f9ca55d..db22ce4 100644 --- a/src/backend.js +++ b/src/backend.js @@ -202,7 +202,7 @@ export default class Backend extends EventTarget { } static parseURL(source) { - let url = new URL(source, location); + let url = new URL(source); return {url}; } diff --git a/src/oauth-backend.js b/src/oauth-backend.js index c1a223c..518559c 100644 --- a/src/oauth-backend.js +++ b/src/oauth-backend.js @@ -212,7 +212,7 @@ export default class OAuthBackend extends AuthBackend { popup.left = (screen.width - popup.width)/2; let state = { - url: location.href, + url: globalThis.location?.href, backend: oAuthBackend.name };