Index: lib/inspectorObserver.js |
=================================================================== |
--- a/lib/inspectorObserver.js |
+++ b/lib/inspectorObserver.js |
@@ -44,20 +44,34 @@ let InspectorObserver = |
return; |
let tooltiptext = InspectorObserver.inspectorButtonTooltip; |
button = panelWindow.document.createElement("toolbarbutton"); |
button.setAttribute("id", "ehh-inspector-toolbarbutton"); |
button.setAttribute("class", "devtools-toolbarbutton"); |
button.setAttribute("tooltiptext", tooltiptext); |
button.setAttribute("tabindex", "0"); |
- button.addEventListener("command", function() |
+ button.addEventListener("command", () => |
{ |
- panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul", "_blank", |
- "chrome,centerscreen,resizable,dialog=no", panel.selection.node); |
+ let node = panel.selection.node; |
+ let doc = null; |
+ let domain = null; |
Thomas Greiner
2015/07/28 13:52:18
This variable should be named "host" from looking
|
+ if (!node) |
+ { |
+ // No local node available, but maybe a wrapper around a remote one |
+ let {Services} = Cu.import("resource://gre/modules/Services.jsm"); |
+ node = panel.selection.nodeFront; |
+ doc = panel.selection.documentFront; |
+ host = Services.io.newURI(panel.target.url, null, null).host; |
+ } |
+ if (node.nodeType == Ci.nsIDOMNode.ELEMENT_NODE) |
+ { |
+ panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul", "_blank", |
Thomas Greiner
2015/07/28 13:52:18
Detail: Please break these lines accordingly to fi
|
+ "chrome,centerscreen,resizable,dialog=no", node, doc, host); |
+ } |
}, false); |
//Override button style for light DevTools theme |
let style = panelWindow.document.createProcessingInstruction("xml-stylesheet", 'href="chrome://elemhidehelper/skin/devToolsOverlay.css" type="text/css"'); |
panelWindow.document.insertBefore(style, panelWindow.document.firstChild); |
inspectBtn.parentNode.insertBefore(button, inspectBtn); |
} |