After some investigation on Bugzilla, I discovered that by setting the options URL in install.rdf to arbitrary JavaScript, it can run smoothly. However, a strange issue arises where the window deactivates, as if an invisible dialog has appeared over it, making it impossible to close.
For instance, in my addon here, upon startup, it simply alerts "startup" and then displays an "options" button in the addon manager. When clicked, it triggers a notifyObserver
but transitions into a dialog mode:
You can directly install this addon from the repository using the GitHubExtensionInstaller addon
The code snippet within my options URL:
<em:optionsURL>
javascript:Components.utils.import('resource://gre/modules/Services.jsm');Services.obs.notifyObservers(window, 'hellothisisyourcaptainspeaking', 'options')
</em:optionsURL>
I am looking for a way to prevent entering this invisible dialog mode after clicking the options button. If prevention is not possible, I would like to include code in the options URL to escape this locked-up state.
In my attempt to resolve this issue, I tested the following code without success:
javascript:
Components.utils.import('resource://gre/modules/Services.jsm');
Services.obs.notifyObservers(window, 'hellothisisyourcaptainspeaking', 'options');
var DOMWin = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation).QueryInterface(Components.interfaces.nsIDocShellTreeItem).rootTreeItem.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);
var utils = DOMWin.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.leaveModalState();
You can view this attempt in this commit: GitHub :: Noitdart / PortableTester commit showing trying to exit the dialog mode