From 5e969c18d9a94b2b5ae3a2619628d9d309c0a697 Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Thu, 24 Feb 2022 14:20:09 -0800 Subject: [PATCH] #654: lozad and yt workarounds --- browser/base/content/tab-content.js | 15 +++++++++++++++ netwerk/protocol/http/nsHttpHandler.cpp | 2 ++ 2 files changed, 17 insertions(+) diff --git a/browser/base/content/tab-content.js b/browser/base/content/tab-content.js index faade1aed..839258793 100644 --- a/browser/base/content/tab-content.js +++ b/browser/base/content/tab-content.js @@ -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; diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index edc80ed42..13ffe6113 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -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);