Index: ext/content.js |
=================================================================== |
--- a/ext/content.js |
+++ b/ext/content.js |
@@ -67,7 +67,6 @@ |
browser.runtime.sendMessage = (message, responseCallback) => |
{ |
let messageId = ++maxMessageId; |
- |
ext.backgroundPage._sendRawMessage({ |
type: "message", |
messageId, |
@@ -96,4 +95,19 @@ |
}); |
} |
}; |
+ |
+ if (!("tabs" in browser)) |
+ browser.tabs = new Map([[0, {url: "example.com"}]]); |
+ |
+ browser.tabs.get = (...args) => |
+ { |
+ let result = Map.prototype.get.apply(browser.tabs, args); |
+ return new Promise((resolve, reject) => |
+ { |
+ if (result) |
+ resolve(result); |
+ else |
+ reject(new Error("Tab cannot be found")); |
+ }); |
+ } |
}()); |