tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 56668479f21564dce7c39ce8aefa3efbe5c30821
parent 6d03e362a133a5db3e194b1bb95c247e641932d3
Author: Alexandru Marc <amarc@mozilla.com>
Date:   Fri, 31 Oct 2025 16:21:54 +0200

Revert "Bug 1636428 - Deprecate accent property from the operator dictionary r=emilio,fredw,layout-reviewers,flod" for causing bc failures @ browser_misused_characters_in_strings.js

This reverts commit e6abf8f3d9f593e1244e2d7e04c704cb40cb5aa8.

Diffstat:
Mbrowser/base/content/test/static/browser_misused_characters_in_strings.js | 33---------------------------------
Mdom/base/nsDeprecatedOperationList.h | 3---
Mdom/base/use_counter_metrics.yaml | 102-------------------------------------------------------------------------------
Mdom/locales/en-US/chrome/dom/dom.properties | 6------
Mlayout/mathml/nsMathMLOperators.cpp | 10+++-------
Mlayout/mathml/nsMathMLmoFrame.cpp | 32+++++---------------------------
Mlayout/mathml/nsMathMLmunderoverFrame.cpp | 14--------------
Mmodules/libpref/init/StaticPrefList.yaml | 6------
Mtesting/web-platform/mozilla/meta/mathml/mathml-console-messages.html.ini | 2+-
Mtesting/web-platform/mozilla/tests/mathml/mathml-console-messages.html | 54++++++------------------------------------------------
10 files changed, 15 insertions(+), 247 deletions(-)

diff --git a/browser/base/content/test/static/browser_misused_characters_in_strings.js b/browser/base/content/test/static/browser_misused_characters_in_strings.js @@ -57,39 +57,6 @@ let gExceptionsList = [ key: "MathML_DeprecatedMathVariantWarning", type: "single-quote", }, - { - file: "dom.properties", - key: "MathML_DeprecatedMoExplicitAccentWarning", - type: "single-quote", - }, - // dom.properties is packaged twice so we need to have two exceptions for this string. - { - file: "dom.properties", - key: "MathML_DeprecatedMoExplicitAccentWarning", - type: "single-quote", - }, - { - file: "dom.properties", - key: "MathML_DeprecatedMoverNonExplicitAccentWarning", - type: "single-quote", - }, - // dom.properties is packaged twice so we need to have two exceptions for this string. - { - file: "dom.properties", - key: "MathML_DeprecatedMoverNonExplicitAccentWarning", - type: "single-quote", - }, - { - file: "dom.properties", - key: "MathML_DeprecatedMunderNonExplicitAccentunderWarning", - type: "single-quote", - }, - // dom.properties is packaged twice so we need to have two exceptions for this string. - { - file: "dom.properties", - key: "MathML_DeprecatedMunderNonExplicitAccentunderWarning", - type: "single-quote", - }, // These error messages contain references to the CSP keywords like 'unsafe-eval', // and those keywords contain actual single-quotes: https://w3c.github.io/webappsec-csp/#grammardef-keyword-source { diff --git a/dom/base/nsDeprecatedOperationList.h b/dom/base/nsDeprecatedOperationList.h @@ -47,9 +47,6 @@ DEPRECATED_OPERATION(InitMouseEvent) DEPRECATED_OPERATION(InitNSMouseEvent) DEPRECATED_OPERATION(MathML_DeprecatedMathSpaceValue2) DEPRECATED_OPERATION(MathML_DeprecatedMathVariant) -DEPRECATED_OPERATION(MathML_DeprecatedMoExplicitAccent) -DEPRECATED_OPERATION(MathML_DeprecatedMoverNonExplicitAccent) -DEPRECATED_OPERATION(MathML_DeprecatedMunderNonExplicitAccentunder) DEPRECATED_OPERATION(FormSubmissionUntrustedEvent) DEPRECATED_OPERATION(ElementSetCapture) DEPRECATED_OPERATION(ElementReleaseCapture) diff --git a/dom/base/use_counter_metrics.yaml b/dom/base/use_counter_metrics.yaml @@ -15642,57 +15642,6 @@ use.counter.deprecated_ops.page: send_in_pings: - use-counters - math_ml__deprecated_mo_explicit_accent: - type: counter - description: > - Whether a page used MathML_DeprecatedMoExplicitAccent. - Compare against `use.counter.top_level_content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - - math_ml__deprecated_mover_non_explicit_accent: - type: counter - description: > - Whether a page used MathML_DeprecatedMoverNonExplicitAccent. - Compare against `use.counter.top_level_content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - - math_ml__deprecated_munder_non_explicit_accentunder: - type: counter - description: > - Whether a page used MathML_DeprecatedMunderNonExplicitAccentunder. - Compare against `use.counter.top_level_content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - form_submission_untrusted_event: type: counter description: > @@ -16460,57 +16409,6 @@ use.counter.deprecated_ops.doc: send_in_pings: - use-counters - math_ml__deprecated_mo_explicit_accent: - type: counter - description: > - Whether a document used MathML_DeprecateMoExplicitAccent. - Compare against `use.counter.content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - - math_ml__deprecated_mover_non_explicit_accent: - type: counter - description: > - Whether a document used MathML_DeprecatedMoverNonExplicitAccent. - Compare against `use.counter.content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - - math_ml__deprecated_munder_non_explicit_accentunder: - type: counter - description: > - Whether a document used MathML_DeprecatedMunderNonExplicitAccentunder. - Compare against `use.counter.content_documents_destroyed` - to calculate the rate. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1852098 - notification_emails: - - dom-core@mozilla.com - - emilio@mozilla.com - expires: never - send_in_pings: - - use-counters - form_submission_untrusted_event: type: counter description: > diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties @@ -404,12 +404,6 @@ InitNSMouseEventWarning=initNSMouseEvent() is deprecated. Use the MouseEvent() c MathML_DeprecatedMathSpaceValue2Warning=MathML length value “%S” is deprecated and will be removed at a future date. # LOCALIZATION NOTE: Do not translate mathvariant or MathML. %S is the deprecated value of the mathvariant attribute. MathML_DeprecatedMathVariantWarning=“mathvariant='%S'” on MathML elements is deprecated and will be removed at a future date. -# LOCALIZATION NOTE: Do not translate accent and mo (it's the name of a MathML element). %1$S is either accent or accentunder. %2$S is the name of the parent frame. -MathML_DeprecatedMoExplicitAccentWarning=Setting the accent attribute on mo elements is deprecated. Use the %1$S attribute on %2$S instead. -# LOCALIZATION NOTE: Do not translate accent. %S is either mover or munderover. -MathML_DeprecatedMoverNonExplicitAccentWarning=Inferring the accent property from the core operator is deprecated. Consider adding an explicit accent attribute to %S. -# LOCALIZATION NOTE: Do not translate accentunder. %S is either munder or munderover. -MathML_DeprecatedMunderNonExplicitAccentunderWarning=Inferring the accentunder property from the core operator is deprecated. Consider adding an explicit accentunder attribute to %S. FormSubmissionUntrustedEventWarning=Form submission via untrusted submit event is deprecated and will be removed at a future date. WebShareAPI_Failed=The share operation has failed. diff --git a/layout/mathml/nsMathMLOperators.cpp b/layout/mathml/nsMathMLOperators.cpp @@ -6,7 +6,6 @@ #include "nsMathMLOperators.h" -#include "mozilla/StaticPrefs_mathml.h" #include "mozilla/intl/UnicodeProperties.h" #include "nsCOMPtr.h" #include "nsCRT.h" @@ -17,8 +16,6 @@ #include "nsTArray.h" #include "nsTHashMap.h" -using namespace mozilla; - // operator dictionary entry struct OperatorData { OperatorData(void) : mFlags(0), mLeadingSpace(0.0f), mTrailingSpace(0.0f) {} @@ -59,8 +56,7 @@ static void SetBooleanProperty(OperatorData* aOperatorData, nsString aName) { aOperatorData->mFlags |= NS_MATHML_OPERATOR_STRETCHY; } else if (aName.EqualsLiteral("fence")) { aOperatorData->mFlags |= NS_MATHML_OPERATOR_FENCE; - } else if (!StaticPrefs::mathml_operator_dictionary_accent_disabled() && - aName.EqualsLiteral("accent")) { + } else if (aName.EqualsLiteral("accent")) { aOperatorData->mFlags |= NS_MATHML_OPERATOR_ACCENT; } else if (aName.EqualsLiteral("largeop")) { aOperatorData->mFlags |= NS_MATHML_OPERATOR_LARGEOP; @@ -431,7 +427,7 @@ bool nsMathMLOperators::LookupOperatorWithFallback(const nsString& aOperator, /* static */ bool nsMathMLOperators::IsMirrorableOperator(const nsString& aOperator) { if (auto codePoint = ToUnicodeCodePoint(aOperator)) { - return intl::UnicodeProperties::IsMirrored(codePoint); + return mozilla::intl::UnicodeProperties::IsMirrored(codePoint); } return false; } @@ -440,7 +436,7 @@ bool nsMathMLOperators::IsMirrorableOperator(const nsString& aOperator) { nsString nsMathMLOperators::GetMirroredOperator(const nsString& aOperator) { nsString result; if (auto codePoint = ToUnicodeCodePoint(aOperator)) { - result.Assign(intl::UnicodeProperties::CharMirror(codePoint)); + result.Assign(mozilla::intl::UnicodeProperties::CharMirror(codePoint)); } return result; } diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp @@ -11,12 +11,10 @@ #include "gfxContext.h" #include "mozilla/PresShell.h" #include "mozilla/StaticPrefs_mathml.h" -#include "mozilla/dom/Document.h" #include "mozilla/dom/MathMLElement.h" #include "nsCSSValue.h" #include "nsContentUtils.h" #include "nsFrameSelection.h" -#include "nsGkAtoms.h" #include "nsLayoutUtils.h" #include "nsPresContext.h" @@ -227,31 +225,11 @@ void nsMathMLmoFrame::ProcessOperatorData() { } // see if the accent attribute is there - if (mContent->AsElement()->GetAttr(nsGkAtoms::accent, value)) { - [&]() { - AutoTArray<nsString, 2> params; - auto parentName = GetParent()->GetContent()->NodeInfo()->NameAtom(); - if (parentName == nsGkAtoms::mover) { - params.AppendElement(u"accent"); - params.AppendElement(u"mover"); - } else if (parentName == nsGkAtoms::munder) { - params.AppendElement(u"accentunder"); - params.AppendElement(u"munder"); - } else if (parentName == nsGkAtoms::munderover) { - params.AppendElement(u"accent/accentunder"); - params.AppendElement(u"munderover"); - } else { - return; - } - PresContext()->Document()->WarnOnceAbout( - dom::DeprecatedOperations::eMathML_DeprecatedMoExplicitAccent, - false, params); - }(); - if (value.LowerCaseEqualsLiteral("true")) { - mEmbellishData.flags |= NS_MATHML_EMBELLISH_ACCENT; - } else if (value.LowerCaseEqualsLiteral("false")) { - mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_ACCENT; - } + mContent->AsElement()->GetAttr(nsGkAtoms::accent, value); + if (value.LowerCaseEqualsLiteral("true")) { + mEmbellishData.flags |= NS_MATHML_EMBELLISH_ACCENT; + } else if (value.LowerCaseEqualsLiteral("false")) { + mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_ACCENT; } // see if the movablelimits attribute is there diff --git a/layout/mathml/nsMathMLmunderoverFrame.cpp b/layout/mathml/nsMathMLmunderoverFrame.cpp @@ -15,7 +15,6 @@ #include "mozilla/StaticPrefs_mathml.h" #include "mozilla/dom/Document.h" #include "mozilla/dom/MathMLElement.h" -#include "nsIMathMLFrame.h" #include "nsLayoutUtils.h" #include "nsMathMLmmultiscriptsFrame.h" #include "nsPresContext.h" @@ -232,13 +231,6 @@ XXX The winner is the outermost setting in conflicting settings like these: } else if (value.LowerCaseEqualsLiteral("false")) { mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_ACCENTUNDER; } - } else if (NS_MATHML_EMBELLISH_IS_ACCENTUNDER(mEmbellishData.flags)) { - AutoTArray<nsString, 1> params; - params.AppendElement(mContent->NodeInfo()->NodeName()); - PresContext()->Document()->WarnOnceAbout( - dom::DeprecatedOperations:: - eMathML_DeprecatedMunderNonExplicitAccentunder, - false, params); } } @@ -260,12 +252,6 @@ XXX The winner is the outermost setting in conflicting settings like these: } else if (value.LowerCaseEqualsLiteral("false")) { mEmbellishData.flags &= ~NS_MATHML_EMBELLISH_ACCENTOVER; } - } else if (NS_MATHML_EMBELLISH_IS_ACCENTOVER(mEmbellishData.flags)) { - AutoTArray<nsString, 1> params; - params.AppendElement(mContent->NodeInfo()->NodeName()); - PresContext()->Document()->WarnOnceAbout( - dom::DeprecatedOperations::eMathML_DeprecatedMoverNonExplicitAccent, - false, params); } } diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml @@ -11097,12 +11097,6 @@ value: true mirror: always -# Whether to remove the accent property from the operator dictionary. -- name: mathml.operator_dictionary_accent.disabled - type: bool - value: false - mirror: always - # Whether to disable the MathML3 support for the mathvariant attribute. For # MathML Core, support is restricted to the <mi> element and to value "normal". # Corresponding automatic italicization on single-char <mi> element is also diff --git a/testing/web-platform/mozilla/meta/mathml/mathml-console-messages.html.ini b/testing/web-platform/mozilla/meta/mathml/mathml-console-messages.html.ini @@ -1,2 +1,2 @@ [mathml-console-messages.html] - prefs: [dom.use_components_shim:false, mathml.legacy_mathvariant_attribute.disabled: false, mathml.mathspace_names.disabled: false, mathml.operator_dictionary_accent.disabled: false] + prefs: [dom.use_components_shim:false, mathml.legacy_mathvariant_attribute.disabled: false, mathml.mathspace_names.disabled: false] diff --git a/testing/web-platform/mozilla/tests/mathml/mathml-console-messages.html b/testing/web-platform/mozilla/tests/mathml/mathml-console-messages.html @@ -39,14 +39,16 @@ function testMessageForMarkup(markup, regexp, level) { promise_test(async function() { let messages = await retrieveConsoleMessagesFor(markup); + + // Sometimes MathML messages are logged several times, so just + // ensure there is at least one. assert_greater_than_equal(messages.length, 1); - // Try to match any element in messages against the provided regexp. - let found = messages.find(m => regexp.test(m.errorMessage)); - assert_true(!!found, `regexp ${regexp} not found in array ${messages.map(m => m.errorMessage)}`); + // Compare against the regexp. + assert_regexp_match(messages[0].errorMessage, regexp); // Check whether this is a warning or an error. - assert_equals(found.isWarning, level == MessageLevel.WARNING); + assert_equals(messages[0].isWarning, level == MessageLevel.WARNING); }, `Message for ${markup}`); } @@ -239,49 +241,5 @@ new RegExp(`mathvariant='${value}'” .* deprecated`), MessageLevel.WARNING); }); - - - // MathML_DeprecatedMoExplicitAccent - testNoMessageForMarkup(`<math><mrow><mo accent="true">x</mo></mrow></math>`); - [ - ["mover", "accent", `<mover><mi>A</mi><mo accent="true">x</mo></mover>`], - ["munder", "accentunder", `<munder><mi>A</mi><mo accent="true">x</mo></munder>`], - ["munderover", "accent/accentunder", `<munderover><mi>A</mi><mo accent="true">x</mo><mo>y</mo></munderover>`], - ["munderover", "accent/accentunder", `<munderover><mi>A</mi><mo>x</mo><mo accent="true">y</mo></munderover>`], - ["munderover", "accent/accentunder", `<munderover><mi>A</mi><mo accent="true">x</mo><mo accent="true">y</mo></munderover>`], - ].forEach(([name, accent, markup]) => { - testMessageForMarkup( - `<math><${markup}></math>`, - new RegExp(`Setting the accent attribute on mo elements is deprecated. Use the ${accent} attribute on ${name} instead.`), - MessageLevel.WARNING); - }); - - - // MathML_DeprecatedMoverNonExplicitAccent - // MathML_DeprecatedMunderNonExplicitAccentunder - [ "mover", "munder" ].forEach((name) => { - testNoMessageForMarkup(`<math><${name}><mi>A</mi><mo>x</mo></${name}></math>`); - }); - testNoMessageForMarkup(`<math><munderover><mi>A</mi><mo>x</mo><mo>y</mo></munderover></math>`); - [ - // Inferring the accent from the operator dictionary. - ["mover", "accent", `<mover><mi>B</mi><mo>^</mo></mover>`], - ["munder", "accentunder", `<munder><mi>B</mi><mo>^</mo></munder>`], - ["munderover", "accent", `<munderover><mi>B</mi><mo>x</mo><mo>^</mo></munderover>`], - ["munderover", "accentunder", `<munderover><mi>B</mi><mo>^</mo><mo>x</mo></munderover>`], - // Inferring the accent from `accent="true"`. - // The last test triggers both accent and accentunder warnings, so we check it twice. - ["mover", "accent", `<mover><mi>C</mi><mo accent="true">x</mo></mover>`], - ["munder", "accentunder", `<munder><mi>C</mi><mo accent="true">x</mo></munder>`], - ["munderover", "accent", `<munderover><mi>C</mi><mo>x</mo><mo accent="true">y</mo></munderover>`], - ["munderover", "accentunder", `<munderover><mi>C</mi><mo accent="true">x</mo><mo>y</mo></munderover>`], - ["munderover", "accent", `<munderover><mi>C</mi><mo accent="true">x</mo><mo accent="true">y</mo></munderover>`], - ["munderover", "accentunder", `<munderover><mi>D</mi><mo accent="true">x</mo><mo accent="true">y</mo></munderover>`], - ].forEach(([name, accent, markup]) => { - testMessageForMarkup( - `<math><${markup}></math>`, - new RegExp(`Inferring the ${accent} property from the core operator is deprecated. Consider adding an explicit ${accent} attribute to ${name}.`), - MessageLevel.WARNING); - }); </script> </body>