How do I access the commands formerly in browser.js on Firefox 45?

In earlier versions of Firefox I used this line:
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/>

It seems that initiating commands from browser.js is no longer possible in Firefox 45. This has caused one of my addons to fail since it makes use of navigation commands such as Browser:ReloadOrDuplicate.

Where are you inserting that line? In an xul overlay? In a dialog? Does that line fail, or just calling the command?

How are you trying to invoke the command? From an XUL element? A command element? Directly from javascript?

Are you running in multiprocess mode? Are you trying to call the command from the content process?

I’m calling the command from an XUL element (a toolbar button) in an XUL overlay. I am not running any of my own Javascript in this extension.

In Firefox 45, the the hamburger menu button becomes non-functional when this line is present. Several toolbar icons also disappear.

I wrote my code over a year ago, when browser.js was still a real file in omni.jar. I am wondering if my code continued to work due to a compatibility layer that has been removed in Firefox 45.

DOM Inspector shows that the commands I am using (such as the one above) remain the same in Firefox 45 as they were in earlier versions. However, it seems they cannot be accessed in the same way.

Have you tried just removing that line? An XUL overlay (on browser.xul?) shouldn’t need it. browser.xul already includes all the scripts it needs, including browser.js. The only scripts you should need to explicitly include are those that are part of your addon. Perhaps it is no longer allowed to include it again.

Also, you don’t actually need browser.js for this. The command element Browser:ReloadOrDuplicate is defined in browser.xul (actually in a file included by browser.xul) and then you don’t need to care where that actually leads (although it currently leads to a function called BrowserReloadOrDuplicate that is in browser.js). Incidentally you could call BrowserReloadOrDuplicate() directly, although making use of a command element is perhaps more reliable.

You’re a genius. If I take that line out the extension works perfectly in Firefox 45 and earlier versions. Thank you :slight_smile: