mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-13 12:45:36 +07:00
Upgrade deps
* polyfill to 0.12.0 * Pickr to 1.9.1 * jQuery to 3.7.1
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
factory(mod);
|
||||
global.browser = mod.exports;
|
||||
}
|
||||
})(this, function (module) {
|
||||
/* webextension-polyfill - v0.4.0 - Wed Feb 06 2019 11:58:31 */
|
||||
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (module) {
|
||||
/* webextension-polyfill - v0.12.0 - Tue May 14 2024 18:01:29 */
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
@@ -19,9 +19,11 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
if (typeof browser === "undefined" || Object.getPrototypeOf(browser) !== Object.prototype) {
|
||||
if (!(globalThis.chrome && globalThis.chrome.runtime && globalThis.chrome.runtime.id)) {
|
||||
throw new Error("This script should only be loaded in a browser extension.");
|
||||
}
|
||||
if (!(globalThis.browser && globalThis.browser.runtime && globalThis.browser.runtime.id)) {
|
||||
const CHROME_SEND_MESSAGE_CALLBACK_NO_RESPONSE_MESSAGE = "The message port closed before a response was received.";
|
||||
const SEND_RESPONSE_DEPRECATION_WARNING = "Returning a Promise is the preferred way to send a reply from an onMessage/onMessageExternal listener, as the sendResponse will be removed from the specs (See https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage)";
|
||||
|
||||
// Wrapping the bulk of this polyfill in a one-time-use function is a minor
|
||||
// optimization for Firefox. Since Spidermonkey does not fully parse the
|
||||
@@ -250,6 +252,12 @@
|
||||
"minArgs": 3,
|
||||
"maxArgs": 3,
|
||||
"singleCallbackArg": true
|
||||
},
|
||||
"elements": {
|
||||
"createSidebarPane": {
|
||||
"minArgs": 1,
|
||||
"maxArgs": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -456,10 +464,6 @@
|
||||
"minArgs": 0,
|
||||
"maxArgs": 0
|
||||
},
|
||||
"getBrowserInfo": {
|
||||
"minArgs": 0,
|
||||
"maxArgs": 0
|
||||
},
|
||||
"getPlatformInfo": {
|
||||
"minArgs": 0,
|
||||
"maxArgs": 0
|
||||
@@ -596,6 +600,14 @@
|
||||
"minArgs": 0,
|
||||
"maxArgs": 1
|
||||
},
|
||||
"goBack": {
|
||||
"minArgs": 0,
|
||||
"maxArgs": 1
|
||||
},
|
||||
"goForward": {
|
||||
"minArgs": 0,
|
||||
"maxArgs": 1
|
||||
},
|
||||
"highlight": {
|
||||
"minArgs": 1,
|
||||
"maxArgs": 1
|
||||
@@ -694,7 +706,6 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (Object.keys(apiMetadata).length === 0) {
|
||||
throw new Error("api-metadata.json has not been included in browser-polyfill");
|
||||
}
|
||||
@@ -714,12 +725,10 @@
|
||||
super(items);
|
||||
this.createItem = createItem;
|
||||
}
|
||||
|
||||
get(key) {
|
||||
if (!this.has(key)) {
|
||||
this.set(key, this.createItem(key));
|
||||
}
|
||||
|
||||
return super.get(key);
|
||||
}
|
||||
}
|
||||
@@ -751,13 +760,17 @@
|
||||
* promise.
|
||||
* @param {function} promise.resolve
|
||||
* The promise's resolution function.
|
||||
* @param {function} promise.rejection
|
||||
* @param {function} promise.reject
|
||||
* The promise's rejection function.
|
||||
* @param {object} metadata
|
||||
* Metadata about the wrapped method which has created the callback.
|
||||
* @param {integer} metadata.maxResolvedArgs
|
||||
* The maximum number of arguments which may be passed to the
|
||||
* callback created by the wrapped async function.
|
||||
* @param {boolean} metadata.singleCallbackArg
|
||||
* Whether or not the promise is resolved with only the first
|
||||
* argument of the callback, alternatively an array of all the
|
||||
* callback arguments is resolved. By default, if the callback
|
||||
* function is invoked with only a single argument, that will be
|
||||
* resolved to the promise, while all arguments will be resolved as
|
||||
* an array if multiple are given.
|
||||
*
|
||||
* @returns {function}
|
||||
* The generated callback function.
|
||||
@@ -765,7 +778,7 @@
|
||||
const makeCallback = (promise, metadata) => {
|
||||
return (...callbackArgs) => {
|
||||
if (extensionAPIs.runtime.lastError) {
|
||||
promise.reject(extensionAPIs.runtime.lastError);
|
||||
promise.reject(new Error(extensionAPIs.runtime.lastError.message));
|
||||
} else if (metadata.singleCallbackArg || callbackArgs.length <= 1 && metadata.singleCallbackArg !== false) {
|
||||
promise.resolve(callbackArgs[0]);
|
||||
} else {
|
||||
@@ -773,7 +786,6 @@
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const pluralizeArguments = numArgs => numArgs == 1 ? "argument" : "arguments";
|
||||
|
||||
/**
|
||||
@@ -791,9 +803,13 @@
|
||||
* The maximum number of arguments which may be passed to the
|
||||
* function. If called with more than this number of arguments, the
|
||||
* wrapper will raise an exception.
|
||||
* @param {integer} metadata.maxResolvedArgs
|
||||
* The maximum number of arguments which may be passed to the
|
||||
* callback created by the wrapped async function.
|
||||
* @param {boolean} metadata.singleCallbackArg
|
||||
* Whether or not the promise is resolved with only the first
|
||||
* argument of the callback, alternatively an array of all the
|
||||
* callback arguments is resolved. By default, if the callback
|
||||
* function is invoked with only a single argument, that will be
|
||||
* resolved to the promise, while all arguments will be resolved as
|
||||
* an array if multiple are given.
|
||||
*
|
||||
* @returns {function(object, ...*)}
|
||||
* The generated wrapper function.
|
||||
@@ -803,35 +819,37 @@
|
||||
if (args.length < metadata.minArgs) {
|
||||
throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`);
|
||||
}
|
||||
|
||||
if (args.length > metadata.maxArgs) {
|
||||
throw new Error(`Expected at most ${metadata.maxArgs} ${pluralizeArguments(metadata.maxArgs)} for ${name}(), got ${args.length}`);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (metadata.fallbackToNoCallback) {
|
||||
// This API method has currently no callback on Chrome, but it return a promise on Firefox,
|
||||
// and so the polyfill will try to call it with a callback first, and it will fallback
|
||||
// to not passing the callback if the first call fails.
|
||||
try {
|
||||
target[name](...args, makeCallback({ resolve, reject }, metadata));
|
||||
target[name](...args, makeCallback({
|
||||
resolve,
|
||||
reject
|
||||
}, metadata));
|
||||
} catch (cbError) {
|
||||
console.warn(`${name} API method doesn't seem to support the callback parameter, ` + "falling back to call it without a callback: ", cbError);
|
||||
|
||||
target[name](...args);
|
||||
|
||||
// Update the API method metadata, so that the next API calls will not try to
|
||||
// use the unsupported callback anymore.
|
||||
metadata.fallbackToNoCallback = false;
|
||||
metadata.noCallback = true;
|
||||
|
||||
resolve();
|
||||
}
|
||||
} else if (metadata.noCallback) {
|
||||
target[name](...args);
|
||||
resolve();
|
||||
} else {
|
||||
target[name](...args, makeCallback({ resolve, reject }, metadata));
|
||||
target[name](...args, makeCallback({
|
||||
resolve,
|
||||
reject
|
||||
}, metadata));
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -863,7 +881,6 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
let hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
|
||||
|
||||
/**
|
||||
@@ -895,18 +912,14 @@
|
||||
has(proxyTarget, prop) {
|
||||
return prop in target || prop in cache;
|
||||
},
|
||||
|
||||
get(proxyTarget, prop, receiver) {
|
||||
if (prop in cache) {
|
||||
return cache[prop];
|
||||
}
|
||||
|
||||
if (!(prop in target)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let value = target[prop];
|
||||
|
||||
if (typeof value === "function") {
|
||||
// This is a method on the underlying object. Check if we need to do
|
||||
// any wrapping.
|
||||
@@ -929,6 +942,9 @@
|
||||
// of. Create a sub-object wrapper for it with the appropriate child
|
||||
// metadata.
|
||||
value = wrapObject(value, wrappers[prop], metadata[prop]);
|
||||
} else if (hasOwnProperty(metadata, "*")) {
|
||||
// Wrap all properties in * namespace.
|
||||
value = wrapObject(value, wrappers[prop], metadata["*"]);
|
||||
} else {
|
||||
// We don't need to do any wrapping for this property,
|
||||
// so just forward all access to the underlying object.
|
||||
@@ -942,14 +958,11 @@
|
||||
target[prop] = value;
|
||||
}
|
||||
});
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
cache[prop] = value;
|
||||
return value;
|
||||
},
|
||||
|
||||
set(proxyTarget, prop, value, receiver) {
|
||||
if (prop in cache) {
|
||||
cache[prop] = value;
|
||||
@@ -958,11 +971,9 @@
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
defineProperty(proxyTarget, prop, desc) {
|
||||
return Reflect.defineProperty(cache, prop, desc);
|
||||
},
|
||||
|
||||
deleteProperty(proxyTarget, prop) {
|
||||
return Reflect.deleteProperty(cache, prop);
|
||||
}
|
||||
@@ -1002,19 +1013,36 @@
|
||||
addListener(target, listener, ...args) {
|
||||
target.addListener(wrapperMap.get(listener), ...args);
|
||||
},
|
||||
|
||||
hasListener(target, listener) {
|
||||
return target.hasListener(wrapperMap.get(listener));
|
||||
},
|
||||
|
||||
removeListener(target, listener) {
|
||||
target.removeListener(wrapperMap.get(listener));
|
||||
}
|
||||
});
|
||||
const onRequestFinishedWrappers = new DefaultWeakMap(listener => {
|
||||
if (typeof listener !== "function") {
|
||||
return listener;
|
||||
}
|
||||
|
||||
// Keep track if the deprecation warning has been logged at least once.
|
||||
let loggedSendResponseDeprecationWarning = false;
|
||||
|
||||
/**
|
||||
* Wraps an onRequestFinished listener function so that it will return a
|
||||
* `getContent()` property which returns a `Promise` rather than using a
|
||||
* callback API.
|
||||
*
|
||||
* @param {object} req
|
||||
* The HAR entry object representing the network request.
|
||||
*/
|
||||
return function onRequestFinished(req) {
|
||||
const wrappedReq = wrapObject(req, {} /* wrappers */, {
|
||||
getContent: {
|
||||
minArgs: 0,
|
||||
maxArgs: 0
|
||||
}
|
||||
});
|
||||
listener(wrappedReq);
|
||||
};
|
||||
});
|
||||
const onMessageWrappers = new DefaultWeakMap(listener => {
|
||||
if (typeof listener !== "function") {
|
||||
return listener;
|
||||
@@ -1039,26 +1067,19 @@
|
||||
*/
|
||||
return function onMessage(message, sender, sendResponse) {
|
||||
let didCallSendResponse = false;
|
||||
|
||||
let wrappedSendResponse;
|
||||
let sendResponsePromise = new Promise(resolve => {
|
||||
wrappedSendResponse = function (response) {
|
||||
if (!loggedSendResponseDeprecationWarning) {
|
||||
console.warn(SEND_RESPONSE_DEPRECATION_WARNING, new Error().stack);
|
||||
loggedSendResponseDeprecationWarning = true;
|
||||
}
|
||||
didCallSendResponse = true;
|
||||
resolve(response);
|
||||
};
|
||||
});
|
||||
|
||||
let result;
|
||||
try {
|
||||
result = listener(message, sender, wrappedSendResponse);
|
||||
} catch (err) {
|
||||
result = Promise.reject(err);
|
||||
}
|
||||
|
||||
const isResultThenable = result !== true && isThenable(result);
|
||||
|
||||
// If the listener didn't returned true or a Promise, or called
|
||||
@@ -1085,7 +1106,6 @@
|
||||
} else {
|
||||
message = "An unexpected error occurred";
|
||||
}
|
||||
|
||||
sendResponse({
|
||||
__mozWebExtensionPolyfillReject__: true,
|
||||
message
|
||||
@@ -1109,8 +1129,10 @@
|
||||
return true;
|
||||
};
|
||||
});
|
||||
|
||||
const wrappedSendMessageCallback = ({ reject, resolve }, reply) => {
|
||||
const wrappedSendMessageCallback = ({
|
||||
reject,
|
||||
resolve
|
||||
}, reply) => {
|
||||
if (extensionAPIs.runtime.lastError) {
|
||||
// Detect when none of the listeners replied to the sendMessage call and resolve
|
||||
// the promise to undefined as in Firefox.
|
||||
@@ -1118,7 +1140,7 @@
|
||||
if (extensionAPIs.runtime.lastError.message === CHROME_SEND_MESSAGE_CALLBACK_NO_RESPONSE_MESSAGE) {
|
||||
resolve();
|
||||
} else {
|
||||
reject(extensionAPIs.runtime.lastError);
|
||||
reject(new Error(extensionAPIs.runtime.lastError.message));
|
||||
}
|
||||
} else if (reply && reply.__mozWebExtensionPolyfillReject__) {
|
||||
// Convert back the JSON representation of the error into
|
||||
@@ -1128,52 +1150,68 @@
|
||||
resolve(reply);
|
||||
}
|
||||
};
|
||||
|
||||
const wrappedSendMessage = (name, metadata, apiNamespaceObj, ...args) => {
|
||||
if (args.length < metadata.minArgs) {
|
||||
throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`);
|
||||
}
|
||||
|
||||
if (args.length > metadata.maxArgs) {
|
||||
throw new Error(`Expected at most ${metadata.maxArgs} ${pluralizeArguments(metadata.maxArgs)} for ${name}(), got ${args.length}`);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const wrappedCb = wrappedSendMessageCallback.bind(null, { resolve, reject });
|
||||
const wrappedCb = wrappedSendMessageCallback.bind(null, {
|
||||
resolve,
|
||||
reject
|
||||
});
|
||||
args.push(wrappedCb);
|
||||
apiNamespaceObj.sendMessage(...args);
|
||||
});
|
||||
};
|
||||
|
||||
const staticWrappers = {
|
||||
devtools: {
|
||||
network: {
|
||||
onRequestFinished: wrapEvent(onRequestFinishedWrappers)
|
||||
}
|
||||
},
|
||||
runtime: {
|
||||
onMessage: wrapEvent(onMessageWrappers),
|
||||
onMessageExternal: wrapEvent(onMessageWrappers),
|
||||
sendMessage: wrappedSendMessage.bind(null, "sendMessage", { minArgs: 1, maxArgs: 3 })
|
||||
sendMessage: wrappedSendMessage.bind(null, "sendMessage", {
|
||||
minArgs: 1,
|
||||
maxArgs: 3
|
||||
})
|
||||
},
|
||||
tabs: {
|
||||
sendMessage: wrappedSendMessage.bind(null, "sendMessage", { minArgs: 2, maxArgs: 3 })
|
||||
sendMessage: wrappedSendMessage.bind(null, "sendMessage", {
|
||||
minArgs: 2,
|
||||
maxArgs: 3
|
||||
})
|
||||
}
|
||||
};
|
||||
const settingMetadata = {
|
||||
clear: { minArgs: 1, maxArgs: 1 },
|
||||
get: { minArgs: 1, maxArgs: 1 },
|
||||
set: { minArgs: 1, maxArgs: 1 }
|
||||
clear: {
|
||||
minArgs: 1,
|
||||
maxArgs: 1
|
||||
},
|
||||
get: {
|
||||
minArgs: 1,
|
||||
maxArgs: 1
|
||||
},
|
||||
set: {
|
||||
minArgs: 1,
|
||||
maxArgs: 1
|
||||
}
|
||||
};
|
||||
apiMetadata.privacy = {
|
||||
network: {
|
||||
networkPredictionEnabled: settingMetadata,
|
||||
webRTCIPHandlingPolicy: settingMetadata
|
||||
"*": settingMetadata
|
||||
},
|
||||
services: {
|
||||
passwordSavingEnabled: settingMetadata
|
||||
"*": settingMetadata
|
||||
},
|
||||
websites: {
|
||||
hyperlinkAuditingEnabled: settingMetadata,
|
||||
referrersEnabled: settingMetadata
|
||||
"*": settingMetadata
|
||||
}
|
||||
};
|
||||
|
||||
return wrapObject(extensionAPIs, staticWrappers, apiMetadata);
|
||||
};
|
||||
|
||||
@@ -1181,6 +1219,7 @@
|
||||
// `module` variable available.
|
||||
module.exports = wrapAPIs(chrome);
|
||||
} else {
|
||||
module.exports = browser;
|
||||
module.exports = globalThis.browser;
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=browser-polyfill.js.map
|
||||
|
||||
3
css/pickr.nano.min.css
vendored
3
css/pickr.nano.min.css
vendored
File diff suppressed because one or more lines are too long
2
external_js/jquery-3.7.1.min.js
vendored
Normal file
2
external_js/jquery-3.7.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
external_js/pickr.min.js
vendored
6
external_js/pickr.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -112,7 +112,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<!-- Optional JavaScript -->
|
||||
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||
<script src="../browser-polyfill.js"></script>
|
||||
<script src="../external_js/jquery-3.6.0.min.js"></script>
|
||||
<script src="../external_js/jquery-3.7.1.min.js"></script>
|
||||
<script src="../external_js/datatables.min.js"></script>
|
||||
<script src="../core_js/log.js"></script>
|
||||
<script src="../core_js/write_version.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user