mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
browser.extension.getURL -> browser.runtime.getURL
Function is deprecated: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/extension/getURL Replacement has essentially identical functionality: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/getURL I'm sure that there's _some_ difference between the "path in install directory" and "path relative to manifest.json", but I don't think that we're going to be the ones running into it.
This commit is contained in:
parent
787f519494
commit
031883e85c
5 changed files with 12 additions and 12 deletions
|
@ -15,7 +15,7 @@ import { enumerate } from "@src/lib/itertools"
|
||||||
import { toNumber } from "@src/lib/convert"
|
import { toNumber } from "@src/lib/convert"
|
||||||
import * as aliases from "@src/lib/aliases"
|
import * as aliases from "@src/lib/aliases"
|
||||||
|
|
||||||
export const DEFAULT_FAVICON = browser.extension.getURL(
|
export const DEFAULT_FAVICON = browser.runtime.getURL(
|
||||||
"static/defaultFavicon.svg",
|
"static/defaultFavicon.svg",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ export class HistoryCompletionSource extends Completions.CompletionSourceFuse {
|
||||||
// In the nonewtab version, this will return `null` and upset getURL.
|
// In the nonewtab version, this will return `null` and upset getURL.
|
||||||
// Ternary op below prevents the runtime error.
|
// Ternary op below prevents the runtime error.
|
||||||
const newtab = (browser.runtime.getManifest()).chrome_url_overrides.newtab
|
const newtab = (browser.runtime.getManifest()).chrome_url_overrides.newtab
|
||||||
const newtaburl = newtab !== null ? browser.extension.getURL(newtab) : null
|
const newtaburl = newtab !== null ? browser.runtime.getURL(newtab) : null
|
||||||
if (!query || config.get("historyresults") === 0) {
|
if (!query || config.get("historyresults") === 0) {
|
||||||
return (await browserBg.topSites.get())
|
return (await browserBg.topSites.get())
|
||||||
.filter(page => page.url !== newtaburl)
|
.filter(page => page.url !== newtaburl)
|
||||||
|
|
|
@ -24,7 +24,7 @@ const cmdline_iframe = window.document.createElementNS(
|
||||||
cmdline_iframe.className = "cleanslate"
|
cmdline_iframe.className = "cleanslate"
|
||||||
cmdline_iframe.setAttribute(
|
cmdline_iframe.setAttribute(
|
||||||
"src",
|
"src",
|
||||||
browser.extension.getURL("static/commandline.html"),
|
browser.runtime.getURL("static/commandline.html"),
|
||||||
)
|
)
|
||||||
cmdline_iframe.setAttribute("id", "cmdline_iframe")
|
cmdline_iframe.setAttribute("id", "cmdline_iframe")
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ export const EditorCmds = new Proxy(_EditorCmds, {
|
||||||
get(target, property) {
|
get(target, property) {
|
||||||
if (target[property]) {
|
if (target[property]) {
|
||||||
return (...args) => {
|
return (...args) => {
|
||||||
if ((document.activeElement as any).src === browser.extension.getURL("static/commandline.html")) {
|
if ((document.activeElement as any).src === browser.runtime.getURL("static/commandline.html")) {
|
||||||
return messageOwnTab("commandline_frame", "editor_function", [property].concat(args))
|
return messageOwnTab("commandline_frame", "editor_function", [property].concat(args))
|
||||||
}
|
}
|
||||||
return _EditorCmds[property](DOM.getLastUsedInput(), ...args)
|
return _EditorCmds[property](DOM.getLastUsedInput(), ...args)
|
||||||
|
|
|
@ -1279,7 +1279,7 @@ export async function help(...helpItems: string[]) {
|
||||||
if (resolved.includes(helpItem)) break
|
if (resolved.includes(helpItem)) break
|
||||||
}
|
}
|
||||||
if (resolved.length > 0) {
|
if (resolved.length > 0) {
|
||||||
return browser.extension.getURL("static/docs/modules/_src_excmds_.html") + "#" + helpItem
|
return browser.runtime.getURL("static/docs/modules/_src_excmds_.html") + "#" + helpItem
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
},
|
},
|
||||||
|
@ -1294,13 +1294,13 @@ export async function help(...helpItems: string[]) {
|
||||||
if (helpItem in bindings) {
|
if (helpItem in bindings) {
|
||||||
helpItem = bindings[helpItem].split(" ")
|
helpItem = bindings[helpItem].split(" ")
|
||||||
helpItem = ["composite", "fillcmdline"].includes(helpItem[0]) ? helpItem[1] : helpItem[0]
|
helpItem = ["composite", "fillcmdline"].includes(helpItem[0]) ? helpItem[1] : helpItem[0]
|
||||||
return browser.extension.getURL("static/docs/modules/_src_excmds_.html") + "#" + helpItem
|
return browser.runtime.getURL("static/docs/modules/_src_excmds_.html") + "#" + helpItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
},
|
},
|
||||||
// -e: look for an excmd
|
// -e: look for an excmd
|
||||||
"-e": (settings, helpItem) => browser.extension.getURL("static/docs/modules/_src_excmds_.html") + "#" + helpItem,
|
"-e": (settings, helpItem) => browser.runtime.getURL("static/docs/modules/_src_excmds_.html") + "#" + helpItem,
|
||||||
// -s: look for a setting
|
// -s: look for a setting
|
||||||
"-s": (settings, helpItem) => {
|
"-s": (settings, helpItem) => {
|
||||||
let subSettings = settings
|
let subSettings = settings
|
||||||
|
@ -1314,7 +1314,7 @@ export async function help(...helpItems: string[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (settingHelpAnchor !== "") {
|
if (settingHelpAnchor !== "") {
|
||||||
return browser.extension.getURL("static/docs/classes/_src_lib_config_.default_config.html") + "#" + settingHelpAnchor.slice(0, -1)
|
return browser.runtime.getURL("static/docs/classes/_src_lib_config_.default_config.html") + "#" + settingHelpAnchor.slice(0, -1)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
},
|
},
|
||||||
|
@ -1344,7 +1344,7 @@ export async function help(...helpItems: string[]) {
|
||||||
}, "")
|
}, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((await activeTab()).url.startsWith(browser.extension.getURL("static/docs/"))) {
|
if ((await activeTab()).url.startsWith(browser.runtime.getURL("static/docs/"))) {
|
||||||
open(url)
|
open(url)
|
||||||
} else {
|
} else {
|
||||||
tabopen(url)
|
tabopen(url)
|
||||||
|
@ -1356,7 +1356,7 @@ export async function help(...helpItems: string[]) {
|
||||||
*/
|
*/
|
||||||
//#background
|
//#background
|
||||||
export async function tutor(newtab?: string) {
|
export async function tutor(newtab?: string) {
|
||||||
const tutor = browser.extension.getURL("static/clippy/1-tutor.html")
|
const tutor = browser.runtime.getURL("static/clippy/1-tutor.html")
|
||||||
if (newtab) tabopen(tutor)
|
if (newtab) tabopen(tutor)
|
||||||
else open(tutor)
|
else open(tutor)
|
||||||
}
|
}
|
||||||
|
@ -1366,7 +1366,7 @@ export async function tutor(newtab?: string) {
|
||||||
*/
|
*/
|
||||||
//#background
|
//#background
|
||||||
export async function credits(excmd?: string) {
|
export async function credits(excmd?: string) {
|
||||||
const creditspage = browser.extension.getURL("static/authors.html")
|
const creditspage = browser.runtime.getURL("static/authors.html")
|
||||||
tabopen(creditspage)
|
tabopen(creditspage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4151,7 +4151,7 @@ export async function issue() {
|
||||||
logger.warning("issue(): Couldn't find textarea element in github issue page.")
|
logger.warning("issue(): Couldn't find textarea element in github issue page.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let template = await (fetch(browser.extension.getURL("issue_template.md"))
|
let template = await (fetch(browser.runtime.getURL("issue_template.md"))
|
||||||
.then(resp => resp.body.getReader())
|
.then(resp => resp.body.getReader())
|
||||||
.then(reader => reader.read())
|
.then(reader => reader.read())
|
||||||
.then(r => (new TextDecoder("utf-8")).decode(r.value)))
|
.then(r => (new TextDecoder("utf-8")).decode(r.value)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue