Index: chrome/devtools.js |
diff --git a/chrome/devtools.js b/chrome/devtools.js |
index 255aeb387bfa8db9e15005390587874a782f4a1b..f8aa5fa3566c8aaaae762cff8d1ef969f60e4599 100644 |
--- a/chrome/devtools.js |
+++ b/chrome/devtools.js |
@@ -17,16 +17,45 @@ |
"use strict"; |
+let panelWindow = null; |
+ |
chrome.runtime.sendMessage( |
{ |
type: "prefs.get", |
key: "show_devtools_panel" |
}, |
- function(enabled) |
+ enabled => |
{ |
if (enabled) |
- chrome.devtools.panels.create("Adblock Plus", |
- "icons/detailed/abp-48.png", |
- "devtools-panel.html"); |
+ { |
+ chrome.devtools.panels.create( |
+ "Adblock Plus", |
+ "icons/detailed/abp-48.png", |
+ "devtools-panel.html", |
+ panel => |
+ { |
+ panel.onShown.addListener(window => |
+ { |
+ panelWindow = window; |
+ }); |
+ |
+ panel.onHidden.addListener(window => |
+ { |
+ panelWindow = null; |
+ }); |
+ |
+ panel.onSearch.addListener((eventName, queryString) => |
+ { |
+ if (panelWindow) |
+ { |
+ panelWindow.postMessage({ |
+ type: eventName, |
+ queryString: queryString |
+ }, "*"); |
+ } |
+ }); |
+ } |
+ ); |
+ } |
} |
); |