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: Created March 7, 2018, 4:06 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') | issue-reporter.html » ('J')
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,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);
a.giammarchi 2018/03/07 17:11:04 if you can use `Map.prototype.get.apply` with `bro
a.giammarchi 2018/03/07 17:17:49 actually, on a second thought, I don't understand
saroyanm 2018/03/08 15:14:27 This implementation is just use uses prototype.get
a.giammarchi 2018/03/08 17:27:34 it's not so clear from the code. Maybe a comment m
saroyanm 2018/03/08 18:16:47 Noted, I'll add one.
saroyanm 2018/03/12 15:45:21 Done.
+ return new Promise((resolve, reject) =>
a.giammarchi 2018/03/07 17:11:04 If I understand correctly result is synchronous so
saroyanm 2018/03/08 15:14:27 This is the Mock implmenetation of tabs.get -> htt
a.giammarchi 2018/03/08 17:27:34 when the result is already known, there is no diff
saroyanm 2018/03/08 18:16:47 Sorry I think I misread your initial I though you
saroyanm 2018/03/12 15:45:21 Done.
+ {
+ if (result)
+ resolve(result);
+ else
+ reject(new Error("Tab cannot be found"));
+ });
+ }
}());
« no previous file with comments | « background.js ('k') | issue-reporter.html » ('j') | issue-reporter.html » ('J')

Powered by Google App Engine
This is Rietveld