update Readability/Reader Mode, #566 font blocklist update, M1910951, M1926454 (partial), M1937694, M1936613, M1938548 (for ATSUI), M1917177 (modified), update UAs

This commit is contained in:
Cameron Kaiser 2025-02-14 10:16:58 -08:00
parent f383e9f69a
commit 100ef17991
14 changed files with 1135 additions and 570 deletions

View File

@ -72,6 +72,8 @@ var gTenFourFoxPane = {
"fx78" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0",
"fx91" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Firefox/91.0",
"fx102" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0",
"fx115" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:115.0) Gecko/20100101 Firefox/115.0",
"fx128" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:128.0) Gecko/20100101 Firefox/128.0",
"classilla" : "NokiaN90-1/3.0545.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1 (en-US; rv:9.3.3) Clecko/20141026 Classilla/CFM",
"ie8" : "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)",
"ie11" : "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko",

View File

@ -66,6 +66,8 @@
preference="tenfourfox.ua.template">
<menupopup>
<menuitem label="&TFFuserAgent.default;" value=""/>
<menuitem label="Firefox 128ESR (Intel)" value="fx128"/>
<menuitem label="Firefox 115ESR (Intel)" value="fx115"/>
<menuitem label="Firefox 102ESR (Intel)" value="fx102"/>
<menuitem label="Firefox 91ESR (Intel)" value="fx91"/>
<menuitem label="Firefox 78ESR (Intel)" value="fx78"/>

View File

@ -63,6 +63,8 @@
oncommand="gTenFourFoxSSUAManager.fillUA(event.target);">
<menupopup>
<menuitem label="" value=""/>
<menuitem label="Firefox 128ESR (Intel)" value="fx128"/>
<menuitem label="Firefox 115ESR (Intel)" value="fx115"/>
<menuitem label="Firefox 102ESR (Intel)" value="fx102"/>
<menuitem label="Firefox 91ESR (Intel)" value="fx91"/>
<menuitem label="Firefox 78ESR (Intel)" value="fx78"/>

View File

@ -891,6 +891,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
BLOK("ads.rubiconproject.com") ||
BLOK("eus.rubiconproject.com") ||
BLOK("fastlane.rubiconproject.com") ||
BLOK("micro.rubiconproject.com") ||
BLOK("optimized-by.rubiconproject.com") ||
BLOK("cdn.engine.4dsply.com") ||
@ -1054,6 +1055,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
BLOK("pixel.mathtag.com") ||
BLOK("a.teads.tv") ||
BLOK("p.teads.tv") ||
BLOK("cdn.teads.tv") ||
BLOK("cdata.carambo.la") ||

View File

@ -299,6 +299,7 @@ StructuredCloneHolder::Read(nsISupports* aParent,
mParent = aParent;
if (!StructuredCloneHolderBase::Read(aCx, aValue)) {
mTransferredPorts.Clear();
JS_ClearPendingException(aCx);
aRv.Throw(NS_ERROR_DOM_DATA_CLONE_ERR);
}
@ -1074,7 +1075,6 @@ StructuredCloneHolder::CustomReadTransferHandler(JSContext* aCx,
OffscreenCanvasCloneData* data =
static_cast<OffscreenCanvasCloneData*>(aContent);
RefPtr<OffscreenCanvas> canvas = OffscreenCanvas::CreateFromCloneData(data);
delete data;
JS::Rooted<JS::Value> value(aCx);
if (!GetOrCreateDOMReflector(aCx, canvas, &value)) {
@ -1082,6 +1082,7 @@ StructuredCloneHolder::CustomReadTransferHandler(JSContext* aCx,
return false;
}
delete data;
aReturnObject.set(&value.toObject());
return true;
}

View File

@ -560,7 +560,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
if (loadAsHtml5 && view) {
// mDocumentURI hasn't been set, yet, so get the URI from the channel
nsCOMPtr<nsIURI> uri;
aChannel->GetOriginalURI(getter_AddRefs(uri));
aChannel->GetURI(getter_AddRefs(uri));
// Adapted from nsDocShell:
// GetSpec can be expensive for some URIs, so check the scheme first.
bool isAbout = false;

View File

@ -595,6 +595,10 @@ txMozillaXSLTProcessor::ImportStylesheet(nsIDOMNode *aStyle)
NS_ENSURE_TRUE(!mStylesheetDocument && !mStylesheet,
NS_ERROR_NOT_IMPLEMENTED);
MOZ_ASSERT(!mEmbeddedStylesheetRoot);
mCompileResult = NS_OK;
nsCOMPtr<nsINode> node = do_QueryInterface(aStyle);
if (!node || !nsContentUtils::SubjectPrincipalOrSystemIfNativeCaller()->Subsumes(node->NodePrincipal())) {
return NS_ERROR_DOM_SECURITY_ERR;

View File

@ -220,9 +220,11 @@ struct writeBuf
#ifdef __ppc__
#define TAG_CFF 0x43464620
#define TAG_CFF2 0x43464632
#define TAG_HEAD 0x68656164
#else
#define TAG_CFF 0x20464643
#define TAG_CFF2 0x32464643
#define TAG_HEAD 0x64616568
#endif
@ -292,7 +294,7 @@ ScaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton)
TableRecord *records = new TableRecord[count];
for (uint32_t i=3; i<(sizer/4); i+=4) { // Skip header
uint32_t tag = wtable[i];
if (tag == TAG_CFF)
if (tag == TAG_CFF || tag == TAG_CFF2)
CFF = true;
// We know the length from the directory, so we can simply import
// the data. We assume the table exists, and OMG if it doesn't.

View File

@ -345,6 +345,8 @@ gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
HTTP_OR_HTTPS_SUBDIR("www.theatlantic.com", "/packages/fonts/garamond/AGaramondPro");
HTTP_OR_HTTPS_SUBDIR("www.theatlantic.com", "/packages/fonts/goldwyn/goldwyn");
HTTP_OR_HTTPS_SUBDIR("www.theatlantic.com", "/packages/fonts/atlantic/Atlantic-Serif");
HTTP_OR_HTTPS_SUBDIR("www.theatlantic.com", "/packages/fonts/atlantic/AtlanticCondensed");
HTTP_OR_HTTPS_SUBDIR("www.theatlantic.com", "/packages/fonts/logic/LogicMonospace");
HTTP_OR_HTTPS_SUBDIR("www.kulturstiftung-des-bundes.de", "/typo3conf/ext/base_ksb/Resources/Public/");
@ -356,6 +358,8 @@ gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
HTTP_OR_HTTPS_SUBDIR("som.yale.edu","/themes/custom/som/fonts/neuehaasunica/NeueHaasUnicaBlack");
HTTP_OR_HTTPS_SUBDIR("www.statnews.com","/wp-content/themes/stat/fonts/Utopia");
// Check hostname and subpatterns (TenFourFox issue 477).
HOST_AND_KEY("www.latimes.com", "/fonts/KisFBDisplay-");
HOST_AND_KEY("www.nerdwallet.com", "Gotham-Book--critical");

View File

@ -87,6 +87,7 @@ nsTreeBodyFrame::CancelImageRequests()
// If our imgIRequest object was registered with the refresh driver
// then we need to deregister it.
nsTreeImageCacheEntry entry = iter.UserData();
static_cast<nsTreeImageListener*>(entry.listener.get())->ClearFrame();
nsLayoutUtils::DeregisterImageRequest(PresContext(), entry.request,
nullptr);
entry.request->CancelAndForgetObserver(NS_BINDING_ABORTED);
@ -2136,28 +2137,10 @@ nsTreeBodyFrame::GetImage(int32_t aRowIndex, nsTreeColumn* aCol, bool aUseContex
// Look the image up in our cache.
nsTreeImageCacheEntry entry;
if (mImageCache.Get(imageSrc, &entry)) {
// Find out if the image has loaded.
uint32_t status;
imgIRequest *imgReq = entry.request;
imgReq->GetImageStatus(&status);
imgReq->GetImage(aResult); // We hand back the image here. The GetImage call addrefs *aResult.
bool animated = true; // Assuming animated is the safe option
// We can only call GetAnimated if we're decoded
if (*aResult && (status & imgIRequest::STATUS_DECODE_COMPLETE))
(*aResult)->GetAnimated(&animated);
if ((!(status & imgIRequest::STATUS_LOAD_COMPLETE)) || animated) {
// We either aren't done loading, or we're animating. Add our row as a listener for invalidations.
nsCOMPtr<imgINotificationObserver> obs;
imgReq->GetNotificationObserver(getter_AddRefs(obs));
if (obs) {
static_cast<nsTreeImageListener*> (obs.get())->AddCell(aRowIndex, aCol);
}
return NS_OK;
}
entry.request->GetImage(aResult);
static_cast<nsTreeImageListener*>(entry.listener.get())
->AddCell(aRowIndex, aCol);
return NS_OK;
}
if (!*aResult) {

View File

@ -4149,7 +4149,7 @@ pref("image.decode-immediately.enabled", false);
pref("image.downscale-during-decode.enabled", true);
// The default Accept header sent for images loaded over HTTP(S)
pref("image.http.accept", "image/png,image/*;q=0.8,*/*;q=0.5");
pref("image.http.accept", "image/png,image/svg+xml,image/webp,*/*;q=0.8");
// The threshold for inferring that changes to an <img> element's |src|
// attribute by JavaScript represent an animation, in milliseconds. If the |src|

View File

@ -1,4 +1,3 @@
/* eslint-env es6:false */
/*
* Copyright (c) 2010 Arc90 Inc
*
@ -23,16 +22,23 @@
var REGEXPS = {
// NOTE: These two regular expressions are duplicated in
// Readability.js. Please keep both copies in sync.
unlikelyCandidates: /-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,
unlikelyCandidates:
/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,
okMaybeItsACandidate: /and|article|body|column|content|main|shadow/i,
};
function isNodeVisible(node) {
// Have to null-check node.style and node.className.indexOf to deal with SVG and MathML nodes.
return (!node.style || node.style.display != "none")
&& !node.hasAttribute("hidden")
// Have to null-check node.style and node.className.includes to deal with SVG and MathML nodes.
return (
(!node.style || node.style.display != "none") &&
!node.hasAttribute("hidden") &&
//check for "fallback-image" so that wikimedia math images are displayed
&& (!node.hasAttribute("aria-hidden") || node.getAttribute("aria-hidden") != "true" || (node.className && node.className.indexOf && node.className.indexOf("fallback-image") !== -1));
(!node.hasAttribute("aria-hidden") ||
node.getAttribute("aria-hidden") != "true" ||
(node.className &&
node.className.includes &&
node.className.includes("fallback-image")))
);
}
/**
@ -50,10 +56,14 @@ function isProbablyReaderable(doc, options = {}) {
options = { visibilityChecker: options };
}
var defaultOptions = { minScore: 20, minContentLength: 140, visibilityChecker: isNodeVisible };
var defaultOptions = {
minScore: 20,
minContentLength: 140,
visibilityChecker: isNodeVisible,
};
options = Object.assign(defaultOptions, options);
var nodes = doc.querySelectorAll("p, pre");
var nodes = doc.querySelectorAll("p, pre, article");
// Get <div> nodes which have <br> node(s) and append them into the `nodes` variable.
// Some articles' DOM structures might look like
@ -80,8 +90,10 @@ function isProbablyReaderable(doc, options = {}) {
}
var matchString = node.className + " " + node.id;
if (REGEXPS.unlikelyCandidates.test(matchString) &&
!REGEXPS.okMaybeItsACandidate.test(matchString)) {
if (
REGEXPS.unlikelyCandidates.test(matchString) &&
!REGEXPS.okMaybeItsACandidate.test(matchString)
) {
return false;
}
@ -104,5 +116,7 @@ function isProbablyReaderable(doc, options = {}) {
}
if (typeof module === "object") {
/* eslint-disable-next-line no-redeclare */
/* global module */
module.exports = isProbablyReaderable;
}

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,8 @@ body.serif .remove-button {
}
#container {
max-width: 30em;
//max-width: 30em;
max-width: 80%;
margin: 0 auto;
}