#654: lozad and yt workarounds

This commit is contained in:
Cameron Kaiser 2022-02-24 14:20:09 -08:00
parent 861ae8f628
commit 5e969c18d9
2 changed files with 17 additions and 0 deletions

View File

@ -396,6 +396,21 @@ var AboutReaderListener = {
}
break;
case "DOMContentLoaded":
// Post-load fixups can go here.
// TenFourFox issue 654: defeat lozad.js lazy image loading.
Array.forEach(content.document.getElementsByTagName('img'),
function(i) {
try {
// Convert data-src to src.
if (i.getAttribute("data-src")) {
i.src = i.getAttribute("data-src");
i.setAttribute("data-loaded") = "true";
}
} catch(e) { }
});
// Do this last.
this.updateReaderButton();
break;

View File

@ -438,6 +438,8 @@ nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request,
!hostLine.EqualsLiteral("imgur.com") &&
!hostLine.EqualsLiteral("github.com") &&
!hostLine.EqualsLiteral("gist.github.com") &&
!hostLine.EqualsLiteral("youtube.com") &&
!hostLine.EqualsLiteral("www.youtube.com") &&
1)) {
rv = request->SetHeader(nsHttp::User_Agent, UserAgent(),
false, nsHttpHeaderArray::eVarietyDefault);