Add workaround to run CAA on Waterfox in multi-process mode
Este commit está contenido en:
29
bootstrap.js
vendido
29
bootstrap.js
vendido
@@ -161,27 +161,46 @@ let caaIn = function (w) {
|
|||||||
m = null;
|
m = null;
|
||||||
},
|
},
|
||||||
run : function () {
|
run : function () {
|
||||||
if (Services.ppmm.childCount > 1) {
|
function isRemote (win) {
|
||||||
Services.prompt.alert(null, "Classic Add-ons Archive", "Multi-process mode is not supported now,\nplease disable it and restart the browser.");
|
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;
|
return;
|
||||||
}
|
}
|
||||||
let isOpen = false;
|
let isOpen = false, ne10win = null;
|
||||||
let winenu = Services.wm.getEnumerator("navigator:browser");
|
let winenu = Services.wm.getEnumerator("navigator:browser");
|
||||||
loop: while (winenu.hasMoreElements()) {
|
loop: while (winenu.hasMoreElements()) {
|
||||||
let window = winenu.getNext().QueryInterface(Ci.nsIDOMWindow);
|
let window = winenu.getNext().QueryInterface(Ci.nsIDOMWindow);
|
||||||
for (let tab of window.gBrowser.tabs) {
|
for (let tab of window.gBrowser.tabs) {
|
||||||
if (tab.linkedBrowser.currentURI.scheme == "caa") {
|
if (tab.linkedBrowser.currentURI.scheme == "caa") {
|
||||||
window.focus()
|
window.focus();
|
||||||
window.gBrowser.selectedTab = tab;
|
window.gBrowser.selectedTab = tab;
|
||||||
isOpen = true;
|
isOpen = true;
|
||||||
break loop;
|
break loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (e10s && ne10win === null) {
|
||||||
|
if (!isRemote(window)) {
|
||||||
|
ne10win = window;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
let mrw = Services.wm.getMostRecentWindow("navigator:browser");
|
let mrw = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
let url = Services.prefs.getBranch(branch).getCharPref("url");
|
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") {
|
if (url == "caa:about") {
|
||||||
Services.prefs.getBranch(branch).setCharPref("url", "caa:");
|
Services.prefs.getBranch(branch).setCharPref("url", "caa:");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
let EXPORTED_SYMBOLS = ["TCloud"];
|
let EXPORTED_SYMBOLS = ["TCloud"];
|
||||||
|
|
||||||
|
var Cu = Components.utils;
|
||||||
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
let TCloud = {
|
let TCloud = {
|
||||||
|
|
||||||
showPage: function(document, db) {
|
showPage: function(document, db) {
|
||||||
let template = this.template;
|
let template = this.template;
|
||||||
|
template = this.processTemplate(template);
|
||||||
document.title = "Tag Cloud :: Classic Add-ons Archive";
|
document.title = "Tag Cloud :: Classic Add-ons Archive";
|
||||||
|
|
||||||
let contfrag = document.createRange().createContextualFragment(template);
|
let contfrag = document.createRange().createContextualFragment(template);
|
||||||
@@ -13,6 +17,15 @@ let TCloud = {
|
|||||||
page.appendChild(frag);
|
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'>∗ " + Services.appinfo.name + " in multi-process mode can't restore <span style='font-style: italic;'>caa:</span> urls after restart ∗</a></div>");
|
||||||
|
} else {
|
||||||
|
template = template.replace("%E10S%", "");
|
||||||
|
}
|
||||||
|
return template;
|
||||||
|
},
|
||||||
|
|
||||||
template: `<html>
|
template: `<html>
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
@@ -47,6 +60,7 @@ let TCloud = {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="primary">
|
<section class="primary">
|
||||||
|
%E10S%
|
||||||
<h1>Most Popular Tags</h1>
|
<h1>Most Popular Tags</h1>
|
||||||
<div class="island hero c listing">
|
<div class="island hero c listing">
|
||||||
|
|
||||||
|
|||||||
Referencia en una nueva incidencia
Block a user