Restructure inclusion of file/ftp protocol-specific content scripts.
This commit is contained in:
parent
fd33d7b3ce
commit
06cd1c1e4e
|
@ -46,8 +46,9 @@ if (MANIFEST_VER.includes(3)) {
|
|||
/^(?:<all_urls>|webRequestBlocking)$/
|
||||
.test(p)
|
||||
);
|
||||
const excludedScriptsRx = /\bcontent\/(?:embeddingDocument|dirindex)\.js$/;
|
||||
for (const cs of json.content_scripts) {
|
||||
cs.js = cs.js.filter(js => !js.includes("content/embeddingDocument.js"))
|
||||
cs.js = cs.js.filter(path => !excludedScriptsRx.test(path));
|
||||
}
|
||||
delete json.browser_action;
|
||||
delete json.commands._execute_browser_action
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (UA.isMozilla) (() => {
|
||||
if (FILE_OR_FTP && UA.isMozilla) (() => {
|
||||
// see https://searchfox.org/mozilla-central/rev/76c1ff5f0de23366fe952ab228610ee695a56e68/netwerk/streamconv/converters/nsIndexedToHTML.cpp#334
|
||||
'use strict';
|
||||
var gTable, gOrderBy, gTBody, gRows, gUI_showHidden;
|
|
@ -18,8 +18,9 @@
|
|||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
const FILE_OR_FTP = /^(?:file|ftp):$/.test(location.protocol);
|
||||
{
|
||||
'use strict';
|
||||
let listenersMap = new Map();
|
||||
let backlog = new Set();
|
||||
|
||||
|
@ -155,7 +156,7 @@
|
|||
if (!(UA.isMozilla || perms.capabilities.includes("script")) &&
|
||||
/^file:\/\/\/(?:[^#?]+\/)?$/.test(document.URL)) {
|
||||
// Allow Chromium browser UI scripts for directory navigation
|
||||
// (for Firefox we rely on emulation in content/ftp.js).
|
||||
// (for Firefox we rely on emulation in content/dirindex.js).
|
||||
perms.capabilities.push("script");
|
||||
}
|
||||
this.capabilities = new Set(perms.capabilities);
|
||||
|
@ -177,6 +178,10 @@
|
|||
globalThis.ns_setupCallBack = ns.domPolicy
|
||||
? () => {}
|
||||
: ({domPolicy}) => {
|
||||
|
||||
ns.domPolicy = domPolicy;
|
||||
if (ns.setup) {
|
||||
if (ns.syncSetup) ns.syncSetup(domPolicy);
|
||||
else ns.setup(domPolicy);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(window.ns || (window.ns = {})).syncFetchPolicy = function() {
|
||||
if (FILE_OR_FTP) {
|
||||
(globalThis.ns ||= {}).syncFetchPolicy = function() {
|
||||
|
||||
ns.pendingSyncFetchPolicy = false;
|
||||
ns.syncFetchPolicy = () => {};
|
||||
|
@ -219,8 +220,9 @@
|
|||
}
|
||||
|
||||
ns.fetchLikeNoTomorrow(url, syncSetup);
|
||||
};
|
||||
};
|
||||
|
||||
if (ns.pendingSyncFetchPolicy) {
|
||||
if (ns.pendingSyncFetchPolicy) {
|
||||
ns.syncFetchPolicy();
|
||||
}
|
||||
}
|
|
@ -116,7 +116,10 @@
|
|||
"/nscl/content/WebGLHook.js",
|
||||
"/nscl/content/promptHook.js",
|
||||
"content/embeddingDocument.js",
|
||||
"content/content.js"
|
||||
"content/content.js",
|
||||
"content/dirindex.js",
|
||||
"/nscl/content/DocumentFreezer.js",
|
||||
"content/syncFetchPolicy.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -134,18 +137,6 @@
|
|||
"/nscl/main/WebGLHook.main.js",
|
||||
"/nscl/main/prefetchCSSResources.main.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"run_at": "document_start",
|
||||
"matches": ["file://*/*", "ftp://*/*"],
|
||||
"match_about_blank": true,
|
||||
"match_origin_as_fallback": true,
|
||||
"all_frames": true,
|
||||
"js": [
|
||||
"content/ftp.js",
|
||||
"/nscl/content/DocumentFreezer.js",
|
||||
"content/syncFetchPolicy.js"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
|
|
Loading…
Reference in New Issue