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

Unified Diff: ext/common.js

Issue 29573905: Issue 4580 - Replace ext.devtools with devtools Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Use Location.pathname Created Oct. 18, 2017, 12:23 a.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
Index: ext/common.js
===================================================================
--- a/ext/common.js
+++ b/ext/common.js
@@ -156,16 +156,56 @@
let rawCatalog = JSON.parse(xhr.responseText);
for (let msgId in rawCatalog)
{
if (!(msgId in catalog))
catalog[msgId] = parseMessage(rawCatalog[msgId]);
}
};
+ /* Polyfills */
Manish Jethani 2017/10/18 00:26:53 So now a lot of this code will move into polyfill.
+
+ if (!("runtime" in chrome))
+ chrome.runtime = {};
+
+ chrome.runtime.onConnect = {
+ addListener(callback)
+ {
+ window.addEventListener("message", event =>
+ {
+ if (event.data.type == "connect")
+ {
+ callback({
+ postMessage(message)
+ {
+ event.source.postMessage({
+ type: "message",
+ messageId: -1,
+ payload: message
+ }, "*");
+ }
+ });
+ }
+ });
+ }
+ };
+
+ if (top.location.pathname == "/devtools-panel.html")
+ {
+ chrome.devtools = {
+ panels: {
+ openResource() {}
+ },
+
+ inspectedWindow: {
+ reload() {}
+ }
+ };
+ }
+
chrome.i18n = {
getUILanguage()
{
return locales[0].replace(/_/g, "-");
},
getMessage(msgId, substitutions)
{
while (true)

Powered by Google App Engine
This is Rietveld