Skip to content

Commit 801d240

Browse files
committed
Add some missing patches #53 #55
1 parent 58b5911 commit 801d240

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

bootstrap.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,6 @@ const pfFollowUp = `(function () {
188188
node.constructor.name === "ShadowRoot";
189189
}
190190
}
191-
// Remove "disabled" attribute of "Load diff" buttons
192-
if (/^\\/.+?\\/.+?\\/(commit\\/|pull\\/\\d+\\/files)/.test(location.pathname))
193-
document.addEventListener("DOMContentLoaded", function () {
194-
for (let button of document.getElementsByClassName("load-diff-button"))
195-
button.removeAttribute("disabled");
196-
}, {once: true});
197191
if (window.ShadowRoot === undefined) {
198192
ShadowRoot = class ShadowRoot extends DocumentFragment {
199193
set innerHTML (html) {
@@ -279,8 +273,14 @@ const pfFollowUp = `(function () {
279273
oldCED.call(customElements, name, cls);
280274
};
281275
}
276+
// Remove "disabled" attribute of "Load diff" buttons
277+
if (/^\\/.+?\\/.+?\\/(commit\\/|pull\\/\\d+\\/(commits\\/|files))/.test(location.pathname))
278+
document.addEventListener("DOMContentLoaded", function () {
279+
for (let button of document.getElementsByClassName("load-diff-button"))
280+
button.removeAttribute("disabled");
281+
}, {once: true});
282282
}());`;
283-
const hashFollowUp = "'sha256-4spz5Bj44n1pX/RtKF5P+GTlJvZp6sYPqVNDzrqdpJg='";
283+
const hashFollowUp = "'sha256-sByi/A21oqNGPE00oZdNzS7MH/Axu2zHWHZK1pJ908Y='";
284284
const customElements = `(function(){var n=window.Document.prototype.createElement,p=window.Document.prototype.createElementNS,aa=window.Document.prototype.importNode,ba=window.Document.prototype.prepend,ca=window.Document.prototype.append,da=window.DocumentFragment.prototype.prepend,ea=window.DocumentFragment.prototype.append,q=window.Node.prototype.cloneNode,r=window.Node.prototype.appendChild,t=window.Node.prototype.insertBefore,u=window.Node.prototype.removeChild,v=window.Node.prototype.replaceChild,w=Object.getOwnPropertyDescriptor(window.Node.prototype,
285285
"textContent"),y=window.Element.prototype.attachShadow,z=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),A=window.Element.prototype.getAttribute,B=window.Element.prototype.setAttribute,C=window.Element.prototype.removeAttribute,D=window.Element.prototype.getAttributeNS,E=window.Element.prototype.setAttributeNS,F=window.Element.prototype.removeAttributeNS,G=window.Element.prototype.insertAdjacentElement,H=window.Element.prototype.insertAdjacentHTML,fa=window.Element.prototype.prepend,
286286
ha=window.Element.prototype.append,ia=window.Element.prototype.before,ja=window.Element.prototype.after,ka=window.Element.prototype.replaceWith,la=window.Element.prototype.remove,ma=window.HTMLElement,I=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),na=window.HTMLElement.prototype.insertAdjacentElement,oa=window.HTMLElement.prototype.insertAdjacentHTML;var pa=new Set;"annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ").forEach(function(a){return pa.add(a)});function qa(a){var b=pa.has(a);a=/^[a-z][.0-9_a-z]*-[-.0-9_a-z]*$/.test(a);return!b&&a}var ra=document.contains?document.contains.bind(document):document.documentElement.contains.bind(document.documentElement);
@@ -329,15 +329,15 @@ var httpObserver = {
329329
observe: function (subject, topic, data) {
330330
if ((topic == "http-on-examine-response" || topic == "http-on-examine-cached-response") &&
331331
subject instanceof Ci.nsIHttpChannel && githost.test(subject.URI.host) &&
332-
(subject.responseStatus == 200 || subject.responseStatus == 304)) {
332+
[200, 304, 404].includes(subject.responseStatus)) {
333333
try {
334334
if (subject.URI.host === "camo.githubusercontent.com") {
335335
if (subject.getResponseHeader("Content-Type").indexOf("image/svg") != -1) {
336336
let csp = subject.getResponseHeader("Content-Security-Policy");
337337
csp += " 'self'; style-src 'unsafe-inline'";
338338
subject.setResponseHeader("Content-Security-Policy", csp, false);
339339
}
340-
} else if (subject.responseStatus == 200 &&
340+
} else if ([200, 404].includes(subject.responseStatus) &&
341341
(subject.loadInfo.externalContentPolicyType == Ci.nsIContentPolicy.TYPE_DOCUMENT ||
342342
subject.loadInfo.externalContentPolicyType == Ci.nsIContentPolicy.TYPE_SUBDOCUMENT) &&
343343
subject.getResponseHeader("Content-Type").indexOf("text/html") != -1) {
@@ -364,6 +364,8 @@ var httpObserver = {
364364
newListener.site = "github";
365365
}
366366
newListener.originalListener = subject.setNewListener(newListener);
367+
} else if (subject.responseStatus == 404) {
368+
// pass
367369
} else if (gitlab.test(subject.URI.host) && gitlabjs.test(subject.URI.path)) {
368370
subject.QueryInterface(Ci.nsITraceableChannel);
369371
let newListener = new tracingListener();

0 commit comments

Comments
 (0)