aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-11 15:17:25 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-11 15:17:25 -0400
commit3c48290cd83744983df2e708b892a8415bcf750f (patch)
treec28e6f493a087ebcff9c9d4d65c25f896f30c1c0 /ext/fg/js
parent82f83970001682018f1f5b595ffdcd13123fed91 (diff)
Add isExtensionUrl utility function to yomichan object
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/popup.js11
1 files changed, 1 insertions, 10 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 42f08afa..99610e17 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -539,19 +539,10 @@ class Popup {
};
}
- static _isOnExtensionPage() {
- try {
- const url = chrome.runtime.getURL('/');
- return window.location.href.substring(0, url.length) === url;
- } catch (e) {
- // NOP
- }
- }
-
static async _injectStylesheet(id, type, value, useWebExtensionApi) {
const injectedStylesheets = Popup._injectedStylesheets;
- if (Popup._isOnExtensionPage()) {
+ if (yomichan.isExtensionUrl(window.location.href)) {
// Permissions error will occur if trying to use the WebExtension API to inject
// into an extension page.
useWebExtensionApi = false;