diff --git a/background/open_urls.ts b/background/open_urls.ts index 441465b6e..932ac1c4b 100644 --- a/background/open_urls.ts +++ b/background/open_urls.ts @@ -14,7 +14,7 @@ import { convertToUrl_, createSearchUrl_, hasUsedKeyword_, lastUrlType_, quotedStringRe_, reformatURL_ } from "./normalize_urls" import { findUrlEndingWithPunctuation_, findUrlInText_ } from "./parse_urls" -import { safePost, showHUD, complainLimits, findCPort, isNotVomnibarPage, getCurFrames_ } from "./ports" +import { safePost, showHUD, complainLimits, findCPort, isNotVomnibarPage, getCurFrames_, showHUDEx } from "./ports" import { createSimpleUrlMatcher_, matchSimply_ } from "./exclusions" import { trans_ } from "./i18n" import { makeCommand_ } from "./key_mappings" @@ -594,6 +594,8 @@ export const openUrlWithActions = (url: Urls.Url, workType: Urls.WorkType, sed?: reuse = reuse !== ReuseType.newBg ? ReuseType.newFg : reuse } if (incog != null && incog !== (curIncognito_ === IncognitoType.true)) { reuse = ReuseType.newFg } + OnFirefox && typeof url === "string" && cPort && ( /^file:|^about:(?!blank)/).test(url) + && options.warnFiles !== false && showHUDEx(cPort, "disabledUrlToOpen", 2, []) typeof url !== "string" ? void Promise.resolve(url).then(onEvalUrl_.bind(0, workType, options, tabs)) : /*#__NOINLINE__*/ openShowPage(url, reuse, options) ? 0 diff --git a/i18n/en/background.json b/i18n/en/background.json index e0b16fc41..0735bf078 100644 --- a/i18n/en/background.json +++ b/i18n/en/background.json @@ -9,6 +9,7 @@ "copiedWndInfo": "(info of tabs)", "csCleared": "$1 content settings have been cleared", "delSug": "Succeed to delete a $1", + "disabledUrlToOpen": "Extensions can't open such URLs on Firefox", "discardFail": "Cannot discard the tab", "downloadFail": "Failed in downloading", "downloadTimeout": "Downloading took too long", diff --git a/i18n/fr/background.json b/i18n/fr/background.json index 2b02569c0..57d2adabe 100644 --- a/i18n/fr/background.json +++ b/i18n/fr/background.json @@ -9,6 +9,7 @@ "copiedWndInfo": "(info des onglets)", "csCleared": "Les paramètres du contenu $1 ont été effacés", "delSug": "A réussi à supprimer un $1", + "disabledUrlToOpen": "Firefox n'autorise pas l'extension à ouvrir cette URL", "discardFail": "Ne peut pas décharger l'onglet", "downloadFail": "Échec du téléchargement", "downloadTimeout": "Le téléchargement a pris trop de temps", diff --git a/i18n/zh/background.json b/i18n/zh/background.json index 4bfdc79f6..7d1416284 100644 --- a/i18n/zh/background.json +++ b/i18n/zh/background.json @@ -10,6 +10,7 @@ "copiedWndInfo": "(标签页信息)", "csCleared": "对各网站 $1 功能权限的修改已重置", "delSug": "成功删除所选$1", + "disabledUrlToOpen": "Firefox 不允许扩展打开此网址", "discardFail": "无法丢弃此网页", "downloadFail": "无法下载此对象", "downloadTimeout": "对象下载超时", diff --git a/i18n/zh_TW/background.json b/i18n/zh_TW/background.json index f52d45a0a..b6930c075 100644 --- a/i18n/zh_TW/background.json +++ b/i18n/zh_TW/background.json @@ -10,6 +10,7 @@ "copiedWndInfo": "(分頁信息)", "csCleared": "對各網站 $1 功能權限的修改已重置", "delSug": "成功刪除所選$1", + "disabledUrlToOpen": "Firefox 不允許擴展存取此網址", "discardFail": "無法丟棄此網頁", "downloadFail": "無法下載此對象", "downloadTimeout": "對象下載超時", diff --git a/typings/messages.d.ts b/typings/messages.d.ts index b8ab24ffd..1add51bd1 100644 --- a/typings/messages.d.ts +++ b/typings/messages.d.ts @@ -779,6 +779,7 @@ interface OpenUrlOptions extends UserSedOptions { | "default" reuse?: UserReuseType | null window?: boolean | "popup" | "normal" | null + warnFiles?: true | false | null } interface OpenPageUrlOptions extends OpenUrlOptions {