Bug 1972282 - Check for spoof English in xsl:sort. a=diannaS

Original Revision: https://phabricator.services.mozilla.com/D254784

Differential Revision: https://phabricator.services.mozilla.com/D258855
This commit is contained in:
Pier Angelo Vendrame
2025-07-28 18:56:46 +00:00
committed by dsmith@mozilla.com
parent 26ad3887ac
commit 448e041655
2 changed files with 9 additions and 0 deletions

View File

@@ -66,6 +66,8 @@ class txXPathNode {
bool operator!=(const txXPathNode& aNode) const { return !(*this == aNode); }
~txXPathNode() { MOZ_COUNT_DTOR(txXPathNode); }
mozilla::dom::Document* OwnerDoc() const { return mNode->OwnerDoc(); }
private:
friend class txXPathNativeNode;
friend class txXPathNodeUtils;

View File

@@ -13,11 +13,14 @@
#include "mozilla/CheckedInt.h"
#include "mozilla/UniquePtrExtensions.h"
#include "nsRFPService.h"
using mozilla::CheckedUint32;
using mozilla::MakeUnique;
using mozilla::MakeUniqueFallible;
using mozilla::RFPTarget;
using mozilla::UniquePtr;
using mozilla::nsRFPService;
/*
* Sorts Nodes as specified by the W3C XSLT 1.0 Recommendation
@@ -74,6 +77,10 @@ nsresult txNodeSorter::addSortElement(Expr* aSelectExpr, Expr* aLangExpr,
if (aLangExpr) {
rv = aLangExpr->evaluateToString(aContext, lang);
NS_ENSURE_SUCCESS(rv, rv);
} else if (aContext->getContextNode()
.OwnerDoc()
->ShouldResistFingerprinting(RFPTarget::JSLocale)) {
CopyUTF8toUTF16(nsRFPService::GetSpoofedJSLocale(), lang);
}
// Case-order