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) |