Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/content.js

Issue 29716600: Issue 6292 - Make issue reporter compatible with test server (Closed)
Patch Set: Addressed Andrea's comments Created March 12, 2018, 3:44 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « background.js ('k') | issue-reporter.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ };
}());
« no previous file with comments | « background.js ('k') | issue-reporter.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld