diff --git a/bootstrap.js b/bootstrap.js index 87fb943..93e552b 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -161,27 +161,46 @@ let caaIn = function (w) { m = null; }, run : function () { - if (Services.ppmm.childCount > 1) { - Services.prompt.alert(null, "Classic Add-ons Archive", "Multi-process mode is not supported now,\nplease disable it and restart the browser."); + function isRemote (win) { + let loadContext = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsILoadContext); + return loadContext.useRemoteTabs; + } + let e10s = isRemote(Services.wm.getMostRecentWindow("navigator:browser")); + if (e10s && Services.appinfo.name != "Waterfox") { + Services.prompt.alert(null, "Classic Add-ons Archive", "Multi-process mode is not supported now,\nplease disable it and restart " + Services.appinfo.name + "."); return; } - let isOpen = false; + let isOpen = false, ne10win = null; let winenu = Services.wm.getEnumerator("navigator:browser"); loop: while (winenu.hasMoreElements()) { let window = winenu.getNext().QueryInterface(Ci.nsIDOMWindow); for (let tab of window.gBrowser.tabs) { if (tab.linkedBrowser.currentURI.scheme == "caa") { - window.focus() + window.focus(); window.gBrowser.selectedTab = tab; isOpen = true; break loop; } } + if (e10s && ne10win === null) { + if (!isRemote(window)) { + ne10win = window; + } + } } if (!isOpen) { let mrw = Services.wm.getMostRecentWindow("navigator:browser"); let url = Services.prefs.getBranch(branch).getCharPref("url"); - mrw.gBrowser.selectedTab = mrw.gBrowser.addTab(url); + if (!e10s) { + mrw.gBrowser.selectedTab = mrw.gBrowser.addTab(url); + } else { + if (ne10win === null) { + mrw.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no,non-remote", url); + } else { + ne10win.focus(); + ne10win.gBrowser.selectedTab = ne10win.gBrowser.addTab(url); + } + } if (url == "caa:about") { Services.prefs.getBranch(branch).setCharPref("url", "caa:"); } diff --git a/content/tcloud.js b/content/tcloud.js index 9a5cae6..c896ac9 100644 --- a/content/tcloud.js +++ b/content/tcloud.js @@ -1,10 +1,14 @@ "use strict"; let EXPORTED_SYMBOLS = ["TCloud"]; +var Cu = Components.utils; +Cu.import("resource://gre/modules/Services.jsm"); + let TCloud = { showPage: function(document, db) { let template = this.template; + template = this.processTemplate(template); document.title = "Tag Cloud :: Classic Add-ons Archive"; let contfrag = document.createRange().createContextualFragment(template); @@ -13,6 +17,15 @@ let TCloud = { page.appendChild(frag); }, + processTemplate: function(template) { + if (Services.appinfo.browserTabsRemoteAutostart) { + template = template.replace("%E10S%", "
"); + } else { + template = template.replace("%E10S%", ""); + } + return template; + }, + template: `