Infocatcher / Sidebars_List

Adds drop-down list to switch sidebars, restartless extension for Firefox
https://addons.mozilla.org/firefox/addon/sidebars-list/
Other
1 stars 1 forks source link

[e10s] Compatibility with Electrolysis (multi-process mode) #8

Closed Infocatcher closed 9 years ago

Infocatcher commented 9 years ago

At least we have bug here:

    _setContextCommands: function() {
        var sbData = this.getSbData();
        var tabData = {
            uri: content.location.href, // TypeError: content is null
            title: content.document.title
        };
Infocatcher commented 9 years ago

Also "Open Sidebar in Tab" is useless due to bug 1098808 – cannot view chrome:// xul urls under e10s.

Infocatcher commented 9 years ago

Also doesn't detect changes inside remote tabs:

    initContext: function() {
        ...
        this.browser.addEventListener("load", this.setContextCommands, true);
Infocatcher commented 9 years ago

Trick to load some chrome:// URIs in tab:

var aboutProxy = {
    contractID: "@mozilla.org/network/protocol/about;1?what=sidebarslist-proxy",
    classDescription: "about-sidebarslist-proxy",
    classID: Components.ID("{9afa6f65-488c-4ff7-9df8-e5f008e67334}"),
    // nsIAboutModule
    newChannel: function(aURI) {
        return Services.io.newChannel("chrome://sidebarslist/content/aboutProxy.xul", null, null);
    },
    getURIFlags: function(aURI) {
        return 0;
    },
    // nsISupports
    QueryInterface: function(iid) {
        if(iid.equals(Components.interfaces.nsISupports) || iid.equals(Components.interfaces.nsIFactory))
            return this;
        throw Components.results.NS_ERROR_NO_INTERFACE;
    },
    // nsIFactory
    createInstance: function(outer, iid) {
        if(!outer)
            return this;
        throw Components.results.NS_ERROR_NO_AGGREGATION;
    }
};

var sbListLoader = {
    initialized: false,
    get cm() {
        delete this.cm;
        return this.cm = Components.manager
            .QueryInterface(Components.interfaces.nsIComponentRegistrar);
    },
    init: function(reason) {
        if(this.initialized)
            return;
        this.initialized = true;

        var ws = Services.wm.getEnumerator("navigator:browser");
        while(ws.hasMoreElements())
            this.initWindow(ws.getNext(), reason);

        Services.ww.registerNotification(this);
        this.cm.registerFactory(aboutProxy.classID, aboutProxy.classDescription, aboutProxy.contractID, aboutProxy);
    },
    destroy: function(reason) {
        if(!this.initialized)
            return;
        this.initialized = false;

        var ws = Services.wm.getEnumerator("navigator:browser");
        while(ws.hasMoreElements())
            this.destroyWindow(ws.getNext(), reason);

        Services.ww.unregisterNotification(this);
        this.cm.unregisterFactory(aboutProxy.classID, aboutProxy);
    },

aboutProxy.xul:

<?xml version="1.0"?>
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    <browser id="browser" type="chrome" autoscroll="true" disablehistory="true" flex="1" />
    <script type="application/javascript">
    <![CDATA[
        var browser = document.getElementById("browser");
        if(location.hash) {
            var url = location.hash.substr(1);
            if(url.substr(0, 9) == "chrome://")
                browser.loadURI(url);
        }
    ]]>
    </script>
</page>

But at least doesn't work correctly for chrome://browser/content/bookmarks/bookmarksPanel.xul