Add workaround to run CAA on Waterfox in multi-process mode

Este commit está contenido en:
JustOff
2018-10-14 20:52:50 +03:00
padre ef65b7df74
commit a5658100f6
Se han modificado 2 ficheros con 38 adiciones y 5 borrados

27
bootstrap.js vendido
Ver fichero

@@ -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");
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:");
}

Ver fichero

@@ -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%", "<div style='float: right; border: 1px solid #c9ddf2; padding: 3px; margin-top: 2px;'><a style='text-decoration: none;' href='https://github.com/JustOff/ca-archive/issues/2' target='_blank'>&lowast;&#8201;" + Services.appinfo.name + " in multi-process mode can't restore <span style='font-style: italic;'>caa:</span> urls after restart&#8202;&lowast;</a></div>");
} else {
template = template.replace("%E10S%", "");
}
return template;
},
template: `<html>
<body>
<div>
@@ -47,6 +60,7 @@ let TCloud = {
</section>
<section class="primary">
%E10S%
<h1>Most Popular Tags</h1>
<div class="island hero c listing">