I want to try to improve the way the Firefox console pops up network info dialogs. I tried overlay:
overlay chrome://browser/content/NetworkPanel.xhtml chrome://devtooltweaks/content/netWinOverlay.xul
but it doesn't seem to work. I looked in the source, and the file looks like there's no code to display elements, another form must be calling it. I'm wondering if there is an easy way to add features to this popup window, from a Firefox extension?
--Update--
I found some relevant code in NetworkPanel.jsm:
// Set the document object and update the content once the panel is loaded.
this.iframe.addEventListener("load", function onLoad() {
if (!self.iframe) {
return;
}
self.iframe.removeEventListener("load", onLoad, true);
self.update();
}, true);
Unfortunately it doesn't seem like there's any easy way to create a listener like this from addon code. I tried to do the store-original-function-and-replace trick, it runs, but it doesn't seem to be calling the original function in the right context somehow:
<?xml version="1.0" encoding="utf-8"?>
<overlay id="helloworldOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script>
var origOpenNetPanel = WebConsoleFrame.prototype.openNetworkPanel;
WebConsoleFrame.prototype.openNetworkPanel = function WCF_openNetworkPanel(aNode, aHttpActivity) {
//Run the original, in its natural ('this') environment:
var netPanel = origOpenNetPanel.call(this, aNode, aHttpActivity);
//todo: add modification.
return netPanel;
}
</script>
</overlay>
^ I had originally tried .call(WebConsoleFrame
and .call(WebConsoleFrame.prototype
. Usually this should work, it may be some special circumstance in chrome code?
This code above is working with this overlay:
overlay chrome://browser/content/devtools/webconsole.xul chrome://devtooltweaks/content/netWinOverlay.xul