|
|
@@ -18,11 +18,11 @@
|
|
|
* along with SingleFile. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
-/* global browser, fetch */
|
|
|
+/* global browser, fetch, XPCNativeWrapper, wrappedJSObject */
|
|
|
|
|
|
this.superFetch = this.superFetch || (() => {
|
|
|
|
|
|
- return {
|
|
|
+ const superFetch = {
|
|
|
fetch: async url => {
|
|
|
try {
|
|
|
return await fetch(url);
|
|
|
@@ -38,6 +38,12 @@ this.superFetch = this.superFetch || (() => {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+ if (typeof XPCNativeWrapper != "undefined" && typeof wrappedJSObject != "undefined") {
|
|
|
+ superFetch.hostFetch = async url => {
|
|
|
+ return await XPCNativeWrapper(wrappedJSObject.fetch)(url);
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return superFetch;
|
|
|
|
|
|
async function sendMessage(message) {
|
|
|
const response = await browser.runtime.sendMessage(message);
|