| 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 */ |
| + |
| + if (!("runtime" in chrome)) |
| + chrome.runtime = {}; |
| + |
| + chrome.runtime.onConnect = { |
| + addListener(callback) |
| + { |
| + window.addEventListener("message", event => |
| + { |
| + if (event.data.type == "connect") |
| + { |
| + callback({ |
|
Manish Jethani
2017/10/12 01:30:03
Call the onConnect handler with a port object [1]
|
| + postMessage(message) |
| + { |
| + event.source.postMessage({ |
| + type: "message", |
| + messageId: -1, |
| + payload: message |
| + }, "*"); |
| + } |
| + }); |
| + } |
| + }); |
| + } |
| + }; |
| + |
| + if (/\/devtools-panel\.html\b/.test(top.location.href)) |
|
Sebastian Noack
2017/10/17 21:40:25
I suppose we could just check for:
top.location
Manish Jethani
2017/10/18 00:26:53
Done.
|
| + { |
| + chrome.devtools = { |
| + panels: { |
| + openResource() {} |
| + }, |
| + |
| + inspectedWindow: { |
| + reload() {} |
| + } |
| + }; |
| + } |
| + |
| chrome.i18n = { |
| getUILanguage() |
| { |
| return locales[0].replace(/_/g, "-"); |
| }, |
| getMessage(msgId, substitutions) |
| { |
| while (true) |