Fix broken AMO pages on Wayback Machine
Este commit está contenido en:
11
bootstrap.js
vendido
11
bootstrap.js
vendido
@@ -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");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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("$", "$");
|
data.summary = dbQuery.row.summary.replace(/(?:\r\n|\r|\n)/g, "<br>").replace("$", "$");
|
||||||
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>';
|
||||||
|
|||||||
Referencia en una nueva incidencia
Block a user