Fix broken AMO pages on Wayback Machine

Este commit está contenido en:
JustOff
2018-10-07 00:26:37 +03:00
padre 5d53b51c91
commit f92ef05d4e
Se han modificado 2 ficheros con 11 adiciones y 2 borrados

11
bootstrap.js vendido
Ver fichero

@@ -295,7 +295,14 @@ function Factory(component) {
let httpObserver = { let httpObserver = {
observe: function(subject, topic, data) { observe: function(subject, topic, data) {
if (topic == "http-on-examine-response" || topic == "http-on-examine-cached-response") { if (topic == "http-on-modify-request") {
subject.QueryInterface(Ci.nsIHttpChannel);
if (subject.URI.host == "web.archive.org") {
if (/^\/web\/.+?\/(addons\.mozilla\.org\/.+?\/more|addons\.cdn\.mozilla\.net\/.+?\/loading-more\.gif.*?|addons-amo\.cdn\.mozilla\.net\/amo-.+?\.js)$/.test(subject.URI.path)) {
subject.cancel(Cr.NS_BINDING_ABORTED);
}
}
} else if (topic == "http-on-examine-response" || topic == "http-on-examine-cached-response") {
subject.QueryInterface(Ci.nsIHttpChannel); subject.QueryInterface(Ci.nsIHttpChannel);
if (subject.URI.host == storageHost) { if (subject.URI.host == storageHost) {
if (/origin=caa&action=install$/.test(subject.URI.path)) { if (/origin=caa&action=install$/.test(subject.URI.path)) {
@@ -321,10 +328,12 @@ let httpObserver = {
} }
}, },
register: function() { register: function() {
Services.obs.addObserver(this, "http-on-modify-request", false);
Services.obs.addObserver(this, "http-on-examine-response", false); Services.obs.addObserver(this, "http-on-examine-response", false);
Services.obs.addObserver(this, "http-on-examine-cached-response", false); Services.obs.addObserver(this, "http-on-examine-cached-response", false);
}, },
unregister: function() { unregister: function() {
Services.obs.removeObserver(this, "http-on-modify-request");
Services.obs.removeObserver(this, "http-on-examine-response"); Services.obs.removeObserver(this, "http-on-examine-response");
Services.obs.removeObserver(this, "http-on-examine-cached-response"); Services.obs.removeObserver(this, "http-on-examine-cached-response");
} }

Ver fichero

@@ -48,7 +48,7 @@ let Addon = {
data.name = dbQuery.row.name; data.name = dbQuery.row.name;
data.slug = dbQuery.row.slug; data.slug = dbQuery.row.slug;
data.amo = "https://addons.mozilla.org/addon/" + data.slug + "/"; data.amo = "https://addons.mozilla.org/addon/" + data.slug + "/";
data.wbm = "http://web.archive.org/web/*/https://addons.mozilla.org/en-US/firefox/addon/" + data.slug + "/"; data.wbm = "https://web.archive.org/web/*/https://addons.mozilla.org/en-US/firefox/addon/" + data.slug + "/";
data.summary = dbQuery.row.summary.replace(/(?:\r\n|\r|\n)/g, "<br>").replace("$", "&#36;"); data.summary = dbQuery.row.summary.replace(/(?:\r\n|\r|\n)/g, "<br>").replace("$", "&#36;");
if (dbQuery.row.homepage) { if (dbQuery.row.homepage) {
data.homepage = '<li><a class="home" href="' + dbQuery.row.homepage + '">Add-on home page</a></li>'; data.homepage = '<li><a class="home" href="' + dbQuery.row.homepage + '">Add-on home page</a></li>';