Pier Angelo Vendrame pushed to branch tor-browser-140.10.0esr-15.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
2e24cfd0
by Pier Angelo Vendrame at 2026-04-16T09:04:35+02:00
5 changed files:
- dom/xml/nsXMLContentSink.cpp
- + dom/xml/test/file_bug1666613.xml
- dom/xml/test/mochitest.toml
- + dom/xml/test/test_bug1666613.html
- layout/style/res/ua.css
Changes:
| ... | ... | @@ -54,6 +54,7 @@ |
| 54 | 54 | #include "mozilla/dom/ScriptLoader.h"
|
| 55 | 55 | #include "mozilla/dom/txMozillaXSLTProcessor.h"
|
| 56 | 56 | #include "mozilla/dom/nsCSPUtils.h"
|
| 57 | +#include "mozilla/intl/LocaleService.h"
|
|
| 57 | 58 | #include "mozilla/CycleCollectedJSContext.h"
|
| 58 | 59 | #include "mozilla/LoadInfo.h"
|
| 59 | 60 | #include "mozilla/UseCounter.h"
|
| ... | ... | @@ -1370,12 +1371,6 @@ nsXMLContentSink::ReportError(const char16_t* aErrorText, |
| 1370 | 1371 | }
|
| 1371 | 1372 | |
| 1372 | 1373 | // prepare to set <parsererror> as the document root
|
| 1373 | - rv = HandleProcessingInstruction(
|
|
| 1374 | - u"xml-stylesheet",
|
|
| 1375 | - u"href=\"chrome://global/locale/intl.css\" type=\"text/css\"");
|
|
| 1376 | - NS_ENSURE_SUCCESS(rv, rv);
|
|
| 1377 | - |
|
| 1378 | - const char16_t* noAtts[] = {0, 0};
|
|
| 1379 | 1374 | |
| 1380 | 1375 | constexpr auto errorNs =
|
| 1381 | 1376 | u"http://www.mozilla.org/newlayout/xml/parsererror.xml"_ns;
|
| ... | ... | @@ -1384,7 +1379,12 @@ nsXMLContentSink::ReportError(const char16_t* aErrorText, |
| 1384 | 1379 | parsererror.Append((char16_t)0xFFFF);
|
| 1385 | 1380 | parsererror.AppendLiteral("parsererror");
|
| 1386 | 1381 | |
| 1387 | - rv = HandleStartElement(parsererror.get(), noAtts, 0, (uint32_t)-1, 0);
|
|
| 1382 | + const char16_t* dirAttr[] = {u"dir", u"ltr", 0, 0};
|
|
| 1383 | + if (intl::LocaleService::GetInstance()->IsAppLocaleRTL() &&
|
|
| 1384 | + !mDocument->ShouldResistFingerprinting(RFPTarget::JSLocale)) {
|
|
| 1385 | + dirAttr[1] = u"rtl";
|
|
| 1386 | + }
|
|
| 1387 | + rv = HandleStartElement(parsererror.get(), dirAttr, 0, 2, 0);
|
|
| 1388 | 1388 | NS_ENSURE_SUCCESS(rv, rv);
|
| 1389 | 1389 | |
| 1390 | 1390 | rv = HandleCharacterData(aErrorText, NS_strlen(aErrorText), false);
|
| ... | ... | @@ -1394,6 +1394,7 @@ nsXMLContentSink::ReportError(const char16_t* aErrorText, |
| 1394 | 1394 | sourcetext.Append((char16_t)0xFFFF);
|
| 1395 | 1395 | sourcetext.AppendLiteral("sourcetext");
|
| 1396 | 1396 | |
| 1397 | + const char16_t* noAtts[] = {0, 0};
|
|
| 1397 | 1398 | rv = HandleStartElement(sourcetext.get(), noAtts, 0, (uint32_t)-1, 0);
|
| 1398 | 1399 | NS_ENSURE_SUCCESS(rv, rv);
|
| 1399 | 1400 |
| 1 | +<invalid |
| ... | ... | @@ -4,6 +4,7 @@ support-files = [ |
| 4 | 4 | "file_bug293347xslt.xml",
|
| 5 | 5 | "file_bug343870.xml",
|
| 6 | 6 | "file_bug691215.xml",
|
| 7 | + "file_bug1666613.xml",
|
|
| 7 | 8 | ]
|
| 8 | 9 | |
| 9 | 10 | ["test_bug232004.xhtml"]
|
| ... | ... | @@ -19,3 +20,5 @@ skip-if = [ |
| 19 | 20 | "http2",
|
| 20 | 21 | "http3",
|
| 21 | 22 | ]
|
| 23 | + |
|
| 24 | +["test_bug1666613.html"] |
| 1 | +<!DOCTYPE HTML>
|
|
| 2 | +<html>
|
|
| 3 | +<head>
|
|
| 4 | + <title>Test for Bug 1666613</title>
|
|
| 5 | + <script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
| 6 | + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
| 7 | + <style>iframe { width: 90%; }</style>
|
|
| 8 | +</head>
|
|
| 9 | +<body>
|
|
| 10 | +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1666613">Mozilla Bug 691215</a>
|
|
| 11 | +<p id="display"></p>
|
|
| 12 | +<script class="testbody" type="text/javascript">
|
|
| 13 | + |
|
| 14 | +SimpleTest.waitForExplicitFinish();
|
|
| 15 | + |
|
| 16 | +function checkDir(expected) {
|
|
| 17 | + return new Promise(resolve => {
|
|
| 18 | + let iframe = document.createElement("iframe");
|
|
| 19 | + document.body.append(iframe);
|
|
| 20 | + iframe.onload = () => {
|
|
| 21 | + let parserError = iframe.contentDocument.documentElement;
|
|
| 22 | + is(parserError.getAttribute("dir"), expected);
|
|
| 23 | + resolve();
|
|
| 24 | + };
|
|
| 25 | + iframe.src = "file_bug1666613.xml";
|
|
| 26 | + });
|
|
| 27 | +}
|
|
| 28 | + |
|
| 29 | +async function sanityTest() {
|
|
| 30 | + await checkDir("ltr");
|
|
| 31 | + await pseudoBidiTest();
|
|
| 32 | +}
|
|
| 33 | + |
|
| 34 | +async function pseudoBidiTest() {
|
|
| 35 | + await SpecialPowers.pushPrefEnv({
|
|
| 36 | + set: [["intl.l10n.pseudo", "bidi"]]
|
|
| 37 | + });
|
|
| 38 | + await checkDir("rtl");
|
|
| 39 | + SimpleTest.finish();
|
|
| 40 | +}
|
|
| 41 | + |
|
| 42 | +sanityTest();
|
|
| 43 | +</script>
|
|
| 44 | +</body>
|
|
| 45 | +</html> |
| ... | ... | @@ -434,6 +434,10 @@ parsererror|parsererror { |
| 434 | 434 | color: black;
|
| 435 | 435 | }
|
| 436 | 436 | |
| 437 | +parsererror|parsererror[dir="rtl"] {
|
|
| 438 | + direction: rtl;
|
|
| 439 | +}
|
|
| 440 | + |
|
| 437 | 441 | parsererror|sourcetext {
|
| 438 | 442 | display: block;
|
| 439 | 443 | white-space: pre;
|
| ... | ... | @@ -443,6 +447,7 @@ parsererror|sourcetext { |
| 443 | 447 | color: red;
|
| 444 | 448 | font-weight: bold;
|
| 445 | 449 | font-size: 12pt;
|
| 450 | + direction: ltr;
|
|
| 446 | 451 | }
|
| 447 | 452 | |
| 448 | 453 | /* Custom content container in the CanvasFrame, positioned on top of everything
|