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,15 @@ |
}); |
} |
}; |
+ |
+ if (!("tabs" in browser)) |
+ browser.tabs = new Map([[0, {url: "example.com"}]]); |
+ |
+ browser.tabs.get = (...args) => |
+ { |
+ // Extend browser.tabs.get() |
+ let result = Map.prototype.get.apply(browser.tabs, args); |
+ const error = new Error("Tab cannot be found"); |
a.giammarchi
2018/03/12 15:53:08
Nit: when there is a result, there's no actually n
saroyanm
2018/03/12 16:09:52
Done. I'm using one ternary operator to make this
|
+ return result ? Promise.resolve(result) : Promise.reject(error); |
+ }; |
}()); |