From a10c0bceab59a64fa4594948953d3f303ea27728 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Fri, 26 Mar 2021 17:19:27 +0000 Subject: [PATCH 1/8] Issue #1754 - Fix clip path overflow. Resolves #1754. --- .../clip-path/clip-path-circle-021-ref.html | 16 +++++++++++++++ .../clip-path/clip-path-circle-021.html | 20 +++++++++++++++++++ .../svg-integration/clip-path/reftest.list | 1 + layout/svg/nsCSSClipPathInstance.cpp | 10 +++++++--- 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 layout/reftests/svg/svg-integration/clip-path/clip-path-circle-021-ref.html create mode 100644 layout/reftests/svg/svg-integration/clip-path/clip-path-circle-021.html diff --git a/layout/reftests/svg/svg-integration/clip-path/clip-path-circle-021-ref.html b/layout/reftests/svg/svg-integration/clip-path/clip-path-circle-021-ref.html new file mode 100644 index 0000000000..c87ded532f --- /dev/null +++ b/layout/reftests/svg/svg-integration/clip-path/clip-path-circle-021-ref.html @@ -0,0 +1,16 @@ + + + + + CSS Masking: Test clip-path property and circle function on circle 021 + + + + +

The test passes if there is a green circle.

+
+ + diff --git a/layout/reftests/svg/svg-integration/clip-path/clip-path-circle-021.html b/layout/reftests/svg/svg-integration/clip-path/clip-path-circle-021.html new file mode 100644 index 0000000000..a9229e6ea7 --- /dev/null +++ b/layout/reftests/svg/svg-integration/clip-path/clip-path-circle-021.html @@ -0,0 +1,20 @@ + + + + + CSS Masking: Test clip-path property and circle function on circle 021 + + + + + + + + +

The test passes if there is a green circle.

+
+ + diff --git a/layout/reftests/svg/svg-integration/clip-path/reftest.list b/layout/reftests/svg/svg-integration/clip-path/reftest.list index fbc0f37f79..a54e8cbf71 100644 --- a/layout/reftests/svg/svg-integration/clip-path/reftest.list +++ b/layout/reftests/svg/svg-integration/clip-path/reftest.list @@ -38,6 +38,7 @@ default-preferences pref(layout.css.clip-path-shapes.enabled,true) == clip-path-circle-018.html clip-path-circle-010-ref.html == clip-path-circle-019.html clip-path-circle-002-ref.html == clip-path-circle-020.html clip-path-circle-002-ref.html +== clip-path-circle-021.html clip-path-circle-021-ref.html == clip-path-ellipse-001.html clip-path-ellipse-001-ref.html == clip-path-ellipse-002.html clip-path-ellipse-001-ref.html diff --git a/layout/svg/nsCSSClipPathInstance.cpp b/layout/svg/nsCSSClipPathInstance.cpp index e923eaa0e7..ac522c91fa 100644 --- a/layout/svg/nsCSSClipPathInstance.cpp +++ b/layout/svg/nsCSSClipPathInstance.cpp @@ -12,6 +12,7 @@ #include "mozilla/gfx/PathHelpers.h" #include "nsCSSRendering.h" #include "nsIFrame.h" +#include "nsMathUtils.h" #include "nsRenderingContext.h" #include "nsRuleNode.h" @@ -135,8 +136,6 @@ nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget, const nsTArray& coords = basicShape->Coordinates(); MOZ_ASSERT(coords.Length() == 1, "wrong number of arguments"); - float referenceLength = sqrt((aRefBox.width * aRefBox.width + - aRefBox.height * aRefBox.height) / 2.0); nscoord r = 0; if (coords[0].GetUnit() == eStyleUnit_Enumerated) { nscoord horizontal, vertical; @@ -150,7 +149,12 @@ nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget, r = horizontal < vertical ? horizontal : vertical; } } else { - r = nsRuleNode::ComputeCoordPercentCalc(coords[0], referenceLength); + // We resolve percent value for circle() as defined here: + // https://drafts.csswg.org/css-shapes/#funcdef-circle + const double sqrt2 = std::sqrt(2.0); + double referenceLength = NS_hypot(aRefBox.width, aRefBox.height) / sqrt2; + r = nsRuleNode::ComputeCoordPercentCalc(coords[0], + NSToCoordRound(referenceLength)); } nscoord appUnitsPerDevPixel = From be539ad8fc01f0ac4134417f79bee19d3d6a9def Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sun, 28 Mar 2021 10:55:28 +0000 Subject: [PATCH 2/8] Issue #1755 - Add smooth, high-quality and pixelated to CSS image-rendering --- layout/style/nsCSSKeywordList.h | 2 ++ layout/style/nsCSSProps.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index be1691e629..2629127fae 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -305,6 +305,7 @@ CSS_KEY(hebrew, hebrew) CSS_KEY(help, help) CSS_KEY(hidden, hidden) CSS_KEY(hide, hide) +CSS_KEY(high-quality, high_quality) CSS_KEY(highlight, highlight) CSS_KEY(highlighttext, highlighttext) CSS_KEY(historical-forms, historical_forms) @@ -450,6 +451,7 @@ CSS_KEY(pc, pc) CSS_KEY(perspective, perspective) CSS_KEY(petite-caps, petite_caps) CSS_KEY(physical, physical) +CSS_KEY(pixelated, pixelated) CSS_KEY(plaintext, plaintext) CSS_KEY(pointer, pointer) CSS_KEY(polygon, polygon) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index b6ffe7952a..461b3e3ee3 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -2398,8 +2398,11 @@ const KTableEntry nsCSSProps::kFilterFunctionKTable[] = { const KTableEntry nsCSSProps::kImageRenderingKTable[] = { { eCSSKeyword_auto, NS_STYLE_IMAGE_RENDERING_AUTO }, + { eCSSKeyword_high_quality, NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY }, { eCSSKeyword_optimizespeed, NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED }, { eCSSKeyword_optimizequality, NS_STYLE_IMAGE_RENDERING_OPTIMIZEQUALITY }, + { eCSSKeyword_pixelated, NS_STYLE_IMAGE_RENDERING_CRISPEDGES }, + { eCSSKeyword_smooth, NS_STYLE_IMAGE_RENDERING_OPTIMIZESPEED }, { eCSSKeyword__moz_crisp_edges, NS_STYLE_IMAGE_RENDERING_CRISPEDGES }, { eCSSKeyword_UNKNOWN, -1 } }; From 618fa768c829a62929dca972307e9fe285e7d3eb Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 31 Mar 2021 17:57:48 -0500 Subject: [PATCH 3/8] Issue #1757 - Reinstate "dom.details_element.enabled" preference The removal of this preference was botched, all other surrounding plumbing changes appear to be working okay. The ability to use prefs to control this stylesheet might be useful in the future, so perhaps this is one of those "if it ain't broke, don't fix it" bugs where leaving well enough alone in the first place would have been the best choice. --- dom/html/HTMLDetailsElement.cpp | 30 ++++++++++++++++++- dom/html/HTMLDetailsElement.h | 2 ++ dom/html/HTMLSummaryElement.cpp | 12 +++++++- dom/webidl/EventHandler.webidl | 1 + dom/webidl/HTMLDetailsElement.webidl | 2 +- layout/base/nsCSSFrameConstructor.cpp | 8 +++-- layout/generic/crashtests/crashtests.list | 16 +++++----- layout/generic/nsContainerFrame.cpp | 10 ++++--- .../disabled-no-summary-ref.html | 11 +++++++ .../disabled-single-summary-ref.html | 12 ++++++++ layout/reftests/details-summary/reftest.list | 7 +++++ layout/style/nsLayoutStylesheetCache.cpp | 10 +++++-- modules/libpref/init/all.js | 3 ++ .../the-details-element/details.html.ini | 3 ++ .../the-details-element/toggleEvent.html.ini | 3 ++ 15 files changed, 111 insertions(+), 19 deletions(-) create mode 100644 layout/reftests/details-summary/disabled-no-summary-ref.html create mode 100644 layout/reftests/details-summary/disabled-single-summary-ref.html create mode 100644 testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/details.html.ini create mode 100644 testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/toggleEvent.html.ini diff --git a/dom/html/HTMLDetailsElement.cpp b/dom/html/HTMLDetailsElement.cpp index 9d4dd89c2a..74479b8d90 100644 --- a/dom/html/HTMLDetailsElement.cpp +++ b/dom/html/HTMLDetailsElement.cpp @@ -6,11 +6,39 @@ #include "mozilla/dom/HTMLDetailsElement.h" #include "mozilla/dom/HTMLDetailsElementBinding.h" -NS_IMPL_NS_NEW_HTML_ELEMENT(Details) +#include "mozilla/dom/HTMLUnknownElement.h" +#include "mozilla/Preferences.h" + +// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Details) to add pref check. +nsGenericHTMLElement* +NS_NewHTMLDetailsElement(already_AddRefed&& aNodeInfo, + mozilla::dom::FromParser aFromParser) +{ + if (!mozilla::dom::HTMLDetailsElement::IsDetailsEnabled()) { + return new mozilla::dom::HTMLUnknownElement(aNodeInfo); + } + + return new mozilla::dom::HTMLDetailsElement(aNodeInfo); +} namespace mozilla { namespace dom { +/* static */ bool +HTMLDetailsElement::IsDetailsEnabled() +{ + static bool isDetailsEnabled = false; + static bool added = false; + + if (!added) { + Preferences::AddBoolVarCache(&isDetailsEnabled, + "dom.details_element.enabled"); + added = true; + } + + return isDetailsEnabled; +} + HTMLDetailsElement::~HTMLDetailsElement() { } diff --git a/dom/html/HTMLDetailsElement.h b/dom/html/HTMLDetailsElement.h index 4575ed888d..10e70784c6 100644 --- a/dom/html/HTMLDetailsElement.h +++ b/dom/html/HTMLDetailsElement.h @@ -23,6 +23,8 @@ class HTMLDetailsElement final : public nsGenericHTMLElement public: using NodeInfo = mozilla::dom::NodeInfo; + static bool IsDetailsEnabled(); + explicit HTMLDetailsElement(already_AddRefed& aNodeInfo) : nsGenericHTMLElement(aNodeInfo) { diff --git a/dom/html/HTMLSummaryElement.cpp b/dom/html/HTMLSummaryElement.cpp index 42ead6b87f..ee3c07b20b 100644 --- a/dom/html/HTMLSummaryElement.cpp +++ b/dom/html/HTMLSummaryElement.cpp @@ -14,7 +14,17 @@ #include "mozilla/TextEvents.h" #include "nsFocusManager.h" -NS_IMPL_NS_NEW_HTML_ELEMENT(Summary) +// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Summary) to add pref check. +nsGenericHTMLElement* +NS_NewHTMLSummaryElement(already_AddRefed&& aNodeInfo, + mozilla::dom::FromParser aFromParser) +{ + if (!mozilla::dom::HTMLDetailsElement::IsDetailsEnabled()) { + return new mozilla::dom::HTMLUnknownElement(aNodeInfo); + } + + return new mozilla::dom::HTMLSummaryElement(aNodeInfo); +} namespace mozilla { namespace dom { diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl index e7dc4931bd..f7acb66ef4 100644 --- a/dom/webidl/EventHandler.webidl +++ b/dom/webidl/EventHandler.webidl @@ -95,6 +95,7 @@ interface GlobalEventHandlers { [Pref="dom.select_events.enabled"] attribute EventHandler onselectstart; + [Pref="dom.details_element.enabled"] attribute EventHandler ontoggle; // Pointer events handlers diff --git a/dom/webidl/HTMLDetailsElement.webidl b/dom/webidl/HTMLDetailsElement.webidl index 04df82e30f..0ef20428f5 100644 --- a/dom/webidl/HTMLDetailsElement.webidl +++ b/dom/webidl/HTMLDetailsElement.webidl @@ -11,7 +11,7 @@ * and create derivative works of this document. */ -[HTMLConstructor] +[HTMLConstructor, Pref="dom.details_element.enabled"] interface HTMLDetailsElement : HTMLElement { [CEReactions, SetterThrows] attribute boolean open; diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index b40e6f8b61..9a0410d737 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -3580,6 +3580,10 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement, return nullptr; } + if (aTag == nsGkAtoms::details && !HTMLDetailsElement::IsDetailsEnabled()) { + return nullptr; + } + static const FrameConstructionDataByTag sHTMLData[] = { SIMPLE_TAG_CHAIN(img, nsCSSFrameConstructor::FindImgData), SIMPLE_TAG_CHAIN(mozgeneratedcontentimage, @@ -5791,7 +5795,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState // ::before and ::after); we always want to create "internal" anonymous // content. auto* details = HTMLDetailsElement::FromContentOrNull(parent); - if (details && !details->Open() && + if (details && details->IsDetailsEnabled() && !details->Open() && (!aContent->IsRootOfNativeAnonymousSubtree() || aContent->IsGeneratedContentContainerForBefore() || aContent->IsGeneratedContentContainerForAfter())) { @@ -5959,7 +5963,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState } FrameConstructionItem* item = nullptr; - if (details && details->Open()) { + if (details && details->IsDetailsEnabled() && details->Open()) { auto* summary = HTMLSummaryElement::FromContentOrNull(aContent); if (summary && summary->IsMainSummary()) { // If details is open, the main summary needs to be rendered as if it is diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index de3cac709b..71c8c8f0c9 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -606,19 +606,19 @@ pref(layout.css.grid.enabled,true) load 1225376.html pref(layout.css.grid.enabled,true) load 1225592.html load 1229437-1.html load 1229437-2.html -load details-containing-only-text.html -load details-display-none-summary-1.html -load details-display-none-summary-2.html -load details-display-none-summary-3.html -load details-open-overflow-auto.html -load details-open-overflow-hidden.html -load details-three-columns.html +pref(dom.details_element.enabled,true) load details-containing-only-text.html +pref(dom.details_element.enabled,true) load details-display-none-summary-1.html +pref(dom.details_element.enabled,true) load details-display-none-summary-2.html +pref(dom.details_element.enabled,true) load details-display-none-summary-3.html +pref(dom.details_element.enabled,true) load details-open-overflow-auto.html +pref(dom.details_element.enabled,true) load details-open-overflow-hidden.html +pref(dom.details_element.enabled,true) load details-three-columns.html load first-letter-638937-1.html load first-letter-638937-2.html load flex-nested-abspos-1.html pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) asserts(0-100) load font-inflation-762332.html # bug 762332 load outline-on-frameset.xhtml -load summary-position-out-of-flow.html +pref(dom.details_element.enabled,true) load summary-position-out-of-flow.html load text-overflow-bug666751-1.html load text-overflow-bug666751-2.html load text-overflow-bug670564.xhtml diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 835ba9b262..47afed9de1 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -1891,10 +1891,12 @@ nsContainerFrame::RenumberFrameAndDescendants(int32_t* aOrdinal, } // Do not renumber list for summary elements. - HTMLSummaryElement* summary = - HTMLSummaryElement::FromContent(kid->GetContent()); - if (summary && summary->IsMainSummary()) { - return false; + if (HTMLDetailsElement::IsDetailsEnabled()) { + HTMLSummaryElement* summary = + HTMLSummaryElement::FromContent(kid->GetContent()); + if (summary && summary->IsMainSummary()) { + return false; + } } bool kidRenumberedABullet = false; diff --git a/layout/reftests/details-summary/disabled-no-summary-ref.html b/layout/reftests/details-summary/disabled-no-summary-ref.html new file mode 100644 index 0000000000..6ecdbcdc0a --- /dev/null +++ b/layout/reftests/details-summary/disabled-no-summary-ref.html @@ -0,0 +1,11 @@ + + + + + +
+

This is the details.

+
+ + diff --git a/layout/reftests/details-summary/disabled-single-summary-ref.html b/layout/reftests/details-summary/disabled-single-summary-ref.html new file mode 100644 index 0000000000..f643af6dcd --- /dev/null +++ b/layout/reftests/details-summary/disabled-single-summary-ref.html @@ -0,0 +1,12 @@ + + + + + +
+
Summary
+

This is the details.

+
+ + diff --git a/layout/reftests/details-summary/reftest.list b/layout/reftests/details-summary/reftest.list index a972cf4980..6b558ea137 100644 --- a/layout/reftests/details-summary/reftest.list +++ b/layout/reftests/details-summary/reftest.list @@ -1,3 +1,10 @@ +default-preferences pref(dom.details_element.enabled,true) + +# Disable
and +pref(dom.details_element.enabled,false) == single-summary.html disabled-single-summary-ref.html +pref(dom.details_element.enabled,false) == open-single-summary.html disabled-single-summary-ref.html +pref(dom.details_element.enabled,false) == no-summary.html disabled-no-summary-ref.html + # Basic handling == multiple-summary.html single-summary.html == open-multiple-summary.html open-multiple-summary-ref.html diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index bf87b006ca..1905d8c5cd 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -121,6 +121,11 @@ nsLayoutStylesheetCache::UASheet() StyleSheet* nsLayoutStylesheetCache::HTMLSheet() { + if (!mHTMLSheet) { + LoadSheetURL("resource://gre-resources/html.css", + &mHTMLSheet, eAgentSheetFeatures, eCrash); + } + return mHTMLSheet; } @@ -316,8 +321,6 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache(StyleBackendType aType) // per-profile, since they're profile-invariant. LoadSheetURL("resource://gre-resources/counterstyles.css", &mCounterStylesSheet, eAgentSheetFeatures, eCrash); - LoadSheetURL("resource://gre-resources/html.css", - &mHTMLSheet, eAgentSheetFeatures, eCrash); LoadSheetURL("chrome://global/content/minimal-xul.css", &mMinimalXULSheet, eAgentSheetFeatures, eCrash); LoadSheetURL("resource://gre-resources/quirk.css", @@ -378,6 +381,8 @@ nsLayoutStylesheetCache::For(StyleBackendType aType) // "layout.css.example-pref.enabled"); Preferences::RegisterCallback(&DependentPrefChanged, "layout.css.grid.enabled"); + Preferences::RegisterCallback(&DependentPrefChanged, + "dom.details_element.enabled"); } return cache; @@ -549,6 +554,7 @@ nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData) gStyleCache_Servo ? &gStyleCache_Servo->sheet_ : nullptr); INVALIDATE(mUASheet); // for layout.css.grid.enabled + INVALIDATE(mHTMLSheet); // for dom.details_element.enabled #undef INVALIDATE } diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 5e202cdc82..b90934e404 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -5106,6 +5106,9 @@ pref("dom.audiochannel.mutedByDefault", false); // HTML element pref("dom.dialog_element.enabled", false); +// Enable
and tags. +pref("dom.details_element.enabled", true); + // Secure Element API #ifdef MOZ_SECUREELEMENT pref("dom.secureelement.enabled", false); diff --git a/testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/details.html.ini b/testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/details.html.ini new file mode 100644 index 0000000000..6ffca742cc --- /dev/null +++ b/testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/details.html.ini @@ -0,0 +1,3 @@ +[details.html] + type: testharness + prefs: [dom.details_element.enabled:true] diff --git a/testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/toggleEvent.html.ini b/testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/toggleEvent.html.ini new file mode 100644 index 0000000000..335ffd5b3a --- /dev/null +++ b/testing/web-platform/meta/html/semantics/interactive-elements/the-details-element/toggleEvent.html.ini @@ -0,0 +1,3 @@ +[toggleEvent.html] + type: testharness + prefs: [dom.details_element.enabled:true] From 5df00281089cd334ab8a38cab168afe75a79ec12 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 31 Mar 2021 11:54:20 +0000 Subject: [PATCH 4/8] Issue #1756 - Initial wrapped implementation in C++ --- .../unum_formatDoubleForFields.diff | 134 +++++ intl/icu/source/i18n/unicode/unum.h | 52 ++ intl/icu/source/i18n/unum.cpp | 28 + intl/update-icu.sh | 1 + js/src/builtin/Intl.cpp | 519 +++++++++++++++++- js/src/builtin/Intl.js | 15 +- js/src/builtin/Number.js | 2 +- js/src/jsapi.h | 19 + js/src/shell/js.cpp | 5 + js/src/vm/CommonPropertyNames.h | 14 +- 10 files changed, 761 insertions(+), 28 deletions(-) create mode 100644 intl/icu-patches/unum_formatDoubleForFields.diff diff --git a/intl/icu-patches/unum_formatDoubleForFields.diff b/intl/icu-patches/unum_formatDoubleForFields.diff new file mode 100644 index 0000000000..75a684d4aa --- /dev/null +++ b/intl/icu-patches/unum_formatDoubleForFields.diff @@ -0,0 +1,134 @@ +Add an ICU API for formatting a number into constituent parts (sign, integer, grouping separator, decimal, fraction, &c.) for use in implementing Intl.NumberFormat.prototype.formatToParts. + +https://ssl.icu-project.org/trac/ticket/12684 + +diff --git a/intl/icu/source/i18n/unicode/unum.h b/intl/icu/source/i18n/unicode/unum.h +--- a/intl/icu/source/i18n/unicode/unum.h ++++ b/intl/icu/source/i18n/unicode/unum.h +@@ -20,16 +20,17 @@ + + #include "unicode/localpointer.h" + #include "unicode/uloc.h" + #include "unicode/ucurr.h" + #include "unicode/umisc.h" + #include "unicode/parseerr.h" + #include "unicode/uformattable.h" + #include "unicode/udisplaycontext.h" ++#include "unicode/ufieldpositer.h" + + /** + * \file + * \brief C API: NumberFormat + * + *

Number Format C API

+ * + * Number Format C API Provides functions for +@@ -647,16 +648,67 @@ U_STABLE int32_t U_EXPORT2 + unum_formatUFormattable(const UNumberFormat* fmt, + const UFormattable *number, + UChar *result, + int32_t resultLength, + UFieldPosition *pos, + UErrorCode *status); + + /** ++* Format a double using a UNumberFormat according to the UNumberFormat's locale, ++* and initialize a UFieldPositionIterator that enumerates the subcomponents of ++* the resulting string. ++* ++* @param format ++* The formatter to use. ++* @param number ++* The number to format. ++* @param result ++* A pointer to a buffer to receive the NULL-terminated formatted ++* number. If the formatted number fits into dest but cannot be ++* NULL-terminated (length == resultLength) then the error code is set ++* to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't ++* fit into result then the error code is set to ++* U_BUFFER_OVERFLOW_ERROR. ++* @param resultLength ++* The maximum size of result. ++* @param fpositer ++* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} ++* (may be NULL if field position information is not needed, but in this ++* case it's preferable to use {@link #unum_formatDouble}). Iteration ++* information already present in the UFieldPositionIterator is deleted, ++* and the iterator is reset to apply to the fields in the formatted ++* string created by this function call. The field values and indexes ++* returned by {@link #ufieldpositer_next} represent fields denoted by ++* the UNumberFormatFields enum. Fields are not returned in a guaranteed ++* order. Fields cannot overlap, but they may nest. For example, 1234 ++* could format as "1,234" which might consist of a grouping separator ++* field for ',' and an integer field encompassing the entire string. ++* @param status ++* A pointer to an UErrorCode to receive any errors ++* @return ++* The total buffer size needed; if greater than resultLength, the ++* output was truncated. ++* @see unum_formatDouble ++* @see unum_parse ++* @see unum_parseDouble ++* @see UFieldPositionIterator ++* @see UNumberFormatFields ++* @draft ICU 59 ++*/ ++U_DRAFT int32_t U_EXPORT2 ++unum_formatDoubleForFields(const UNumberFormat* format, ++ double number, ++ UChar* result, ++ int32_t resultLength, ++ UFieldPositionIterator* fpositer, ++ UErrorCode* status); ++#define ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS ++ ++/** + * Parse a string into an integer using a UNumberFormat. + * The string will be parsed according to the UNumberFormat's locale. + * Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT + * and UNUM_DECIMAL_COMPACT_LONG. + * @param fmt The formatter to use. + * @param text The text to parse. + * @param textLength The length of text, or -1 if null-terminated. + * @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which +diff --git a/intl/icu/source/i18n/unum.cpp b/intl/icu/source/i18n/unum.cpp +--- a/intl/icu/source/i18n/unum.cpp ++++ b/intl/icu/source/i18n/unum.cpp +@@ -870,9 +870,37 @@ unum_formatUFormattable(const UNumberFor + if(pos != 0) { + pos->beginIndex = fp.getBeginIndex(); + pos->endIndex = fp.getEndIndex(); + } + + return res.extract(result, resultLength, *status); + } + ++U_CAPI int32_t U_EXPORT2 ++unum_formatDoubleForFields(const UNumberFormat* format, ++ double number, ++ UChar* result, ++ int32_t resultLength, ++ UFieldPositionIterator* fpositer, ++ UErrorCode* status) ++{ ++ if (U_FAILURE(*status)) ++ return -1; ++ ++ if (result == NULL ? resultLength != 0 : resultLength < 0) { ++ *status = U_ILLEGAL_ARGUMENT_ERROR; ++ return -1; ++ } ++ ++ UnicodeString res; ++ if (result != NULL) { ++ // NULL destination for pure preflighting: empty dummy string ++ // otherwise, alias the destination buffer ++ res.setTo(result, 0, resultLength); ++ } ++ ++ ((const NumberFormat*)format)->format(number, res, (FieldPositionIterator*)fpositer, *status); ++ ++ return res.extract(result, resultLength, *status); ++} ++ + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/intl/icu/source/i18n/unicode/unum.h b/intl/icu/source/i18n/unicode/unum.h index 34d54427f0..acc6abf8c5 100644 --- a/intl/icu/source/i18n/unicode/unum.h +++ b/intl/icu/source/i18n/unicode/unum.h @@ -25,6 +25,7 @@ #include "unicode/parseerr.h" #include "unicode/uformattable.h" #include "unicode/udisplaycontext.h" +#include "unicode/ufieldpositer.h" /** * \file @@ -651,6 +652,57 @@ unum_formatUFormattable(const UNumberFormat* fmt, UFieldPosition *pos, UErrorCode *status); +/** +* Format a double using a UNumberFormat according to the UNumberFormat's locale, +* and initialize a UFieldPositionIterator that enumerates the subcomponents of +* the resulting string. +* +* @param format +* The formatter to use. +* @param number +* The number to format. +* @param result +* A pointer to a buffer to receive the NULL-terminated formatted +* number. If the formatted number fits into dest but cannot be +* NULL-terminated (length == resultLength) then the error code is set +* to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't +* fit into result then the error code is set to +* U_BUFFER_OVERFLOW_ERROR. +* @param resultLength +* The maximum size of result. +* @param fpositer +* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} +* (may be NULL if field position information is not needed, but in this +* case it's preferable to use {@link #unum_formatDouble}). Iteration +* information already present in the UFieldPositionIterator is deleted, +* and the iterator is reset to apply to the fields in the formatted +* string created by this function call. The field values and indexes +* returned by {@link #ufieldpositer_next} represent fields denoted by +* the UNumberFormatFields enum. Fields are not returned in a guaranteed +* order. Fields cannot overlap, but they may nest. For example, 1234 +* could format as "1,234" which might consist of a grouping separator +* field for ',' and an integer field encompassing the entire string. +* @param status +* A pointer to an UErrorCode to receive any errors +* @return +* The total buffer size needed; if greater than resultLength, the +* output was truncated. +* @see unum_formatDouble +* @see unum_parse +* @see unum_parseDouble +* @see UFieldPositionIterator +* @see UNumberFormatFields +* @draft ICU 59 +*/ +U_DRAFT int32_t U_EXPORT2 +unum_formatDoubleForFields(const UNumberFormat* format, + double number, + UChar* result, + int32_t resultLength, + UFieldPositionIterator* fpositer, + UErrorCode* status); +#define ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS + /** * Parse a string into an integer using a UNumberFormat. * The string will be parsed according to the UNumberFormat's locale. diff --git a/intl/icu/source/i18n/unum.cpp b/intl/icu/source/i18n/unum.cpp index 01170b4c1d..8029810eaf 100644 --- a/intl/icu/source/i18n/unum.cpp +++ b/intl/icu/source/i18n/unum.cpp @@ -875,4 +875,32 @@ unum_formatUFormattable(const UNumberFormat* fmt, return res.extract(result, resultLength, *status); } +U_CAPI int32_t U_EXPORT2 +unum_formatDoubleForFields(const UNumberFormat* format, + double number, + UChar* result, + int32_t resultLength, + UFieldPositionIterator* fpositer, + UErrorCode* status) +{ + if (U_FAILURE(*status)) + return -1; + + if (result == NULL ? resultLength != 0 : resultLength < 0) { + *status = U_ILLEGAL_ARGUMENT_ERROR; + return -1; + } + + UnicodeString res; + if (result != NULL) { + // NULL destination for pure preflighting: empty dummy string + // otherwise, alias the destination buffer + res.setTo(result, 0, resultLength); + } + + ((const NumberFormat*)format)->format(number, res, (FieldPositionIterator*)fpositer, *status); + + return res.extract(result, resultLength, *status); +} + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/intl/update-icu.sh b/intl/update-icu.sh index 4983b66707..0662c57c9e 100644 --- a/intl/update-icu.sh +++ b/intl/update-icu.sh @@ -72,6 +72,7 @@ for patch in \ bug-1198952-workaround-make-3.82-bug.diff \ bug-1228227-bug-1263325-libc++-gcc_hidden.diff \ ucol_getKeywordValuesForLocale-ulist_resetList.diff \ + unum_formatDoubleForFields.diff \ ; do echo "Applying local patch $patch" patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 622e773e0f..71e40a2d54 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -13,7 +13,6 @@ #include "mozilla/Casting.h" #include "mozilla/PodOperations.h" #include "mozilla/Range.h" -#include "mozilla/ScopeExit.h" #include @@ -23,6 +22,7 @@ #include "jsobj.h" #include "builtin/IntlTimeZoneData.h" +#include "ds/Sort.h" #include "unicode/plurrule.h" #include "unicode/ucal.h" #include "unicode/ucol.h" @@ -48,8 +48,8 @@ using namespace js; using mozilla::AssertedCast; using mozilla::IsFinite; +using mozilla::IsNaN; using mozilla::IsNegativeZero; -using mozilla::MakeScopeExit; using mozilla::PodCopy; @@ -905,6 +905,24 @@ CreateNumberFormatPrototype(JSContext* cx, HandleObject Intl, Handlecompartment()->creationOptions().experimentalNumberFormatFormatToPartsEnabled()) { + RootedValue ftp(cx); + HandlePropertyName name = cx->names().formatToParts; + if (!GlobalObject::getSelfHostedFunction(cx, cx->global(), + cx->names().NumberFormatFormatToParts, + name, 1, &ftp)) + { + return nullptr; + } + + if (!DefineProperty(cx, proto, cx->names().formatToParts, ftp, nullptr, nullptr, 0)) + return nullptr; + } +#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) + RootedValue options(cx); if (!CreateDefaultOptions(cx, &options)) return nullptr; @@ -1186,31 +1204,72 @@ NewUNumberFormat(JSContext* cx, HandleObject numberFormat) return toClose.forget(); } -static bool -intl_FormatNumber(JSContext* cx, UNumberFormat* nf, double x, MutableHandleValue result) -{ - // FormatNumber doesn't consider -0.0 to be negative. - if (IsNegativeZero(x)) - x = 0.0; +using FormattedNumberChars = Vector; - Vector chars(cx); - if (!chars.resize(INITIAL_CHAR_BUFFER_SIZE)) - return false; - UErrorCode status = U_ZERO_ERROR; - int size = unum_formatDouble(nf, x, Char16ToUChar(chars.begin()), INITIAL_CHAR_BUFFER_SIZE, - nullptr, &status); +static bool +PartitionNumberPattern(JSContext* cx, UNumberFormat* nf, double* x, + UFieldPositionIterator* fpositer, FormattedNumberChars& formattedChars) +{ + // PartitionNumberPattern doesn't consider -0.0 to be negative. + if (IsNegativeZero(*x)) + *x = 0.0; + + MOZ_ASSERT(formattedChars.length() == 0, + "formattedChars must initially be empty"); + MOZ_ALWAYS_TRUE(formattedChars.resize(INITIAL_CHAR_BUFFER_SIZE)); + UErrorCode status = U_ZERO_ERROR; + +#if !defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) + MOZ_ASSERT(fpositer == nullptr, + "shouldn't be requesting field information from an ICU that " + "can't provide it"); +#endif + + int32_t resultSize; +#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) + resultSize = + unum_formatDoubleForFields(nf, *x, + Char16ToUChar(formattedChars.begin()), INITIAL_CHAR_BUFFER_SIZE, + fpositer, &status); +#else + resultSize = + unum_formatDouble(nf, *x, Char16ToUChar(formattedChars.begin()), INITIAL_CHAR_BUFFER_SIZE, + nullptr, &status); +#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) if (status == U_BUFFER_OVERFLOW_ERROR) { - if (!chars.resize(size)) + if (!formattedChars.resize(size_t(resultSize))) return false; status = U_ZERO_ERROR; - unum_formatDouble(nf, x, Char16ToUChar(chars.begin()), size, nullptr, &status); +#ifdef DEBUG + int32_t size = +#endif +#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) + unum_formatDoubleForFields(nf, *x, Char16ToUChar(formattedChars.begin()), resultSize, + fpositer, &status); +#else + unum_formatDouble(nf, *x, Char16ToUChar(formattedChars.begin()), resultSize, + nullptr, &status); +#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) + MOZ_ASSERT(size == resultSize); } if (U_FAILURE(status)) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return false; } - JSString* str = NewStringCopyN(cx, chars.begin(), size); + return formattedChars.resize(size_t(resultSize)); +} + +static bool +intl_FormatNumber(JSContext* cx, UNumberFormat* nf, double x, MutableHandleValue result) +{ + // Passing null for |fpositer| will just not compute partition information, + // letting us common up all ICU number-formatting code. + FormattedNumberChars chars(cx); + if (!PartitionNumberPattern(cx, nf, &x, nullptr, chars)) + return false; + + JSString* str = NewStringCopyN(cx, chars.begin(), chars.length()); if (!str) return false; @@ -1218,13 +1277,414 @@ intl_FormatNumber(JSContext* cx, UNumberFormat* nf, double x, MutableHandleValue return true; } +using FieldType = ImmutablePropertyNamePtr JSAtomState::*; + +#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) + +static FieldType +GetFieldTypeForNumberField(UNumberFormatFields fieldName, double d) +{ + // See intl/icu/source/i18n/unicode/unum.h for a detailed field list. This + // list is deliberately exhaustive: cases might have to be added/removed if + // this code is compiled with a different ICU with more UNumberFormatFields + // enum initializers. Please guard such cases with appropriate ICU + // version-testing #ifdefs, should cross-version divergence occur. + switch (fieldName) { + case UNUM_INTEGER_FIELD: + if (IsNaN(d)) + return &JSAtomState::nan; + if (!IsFinite(d)) + return &JSAtomState::infinity; + return &JSAtomState::integer; + + case UNUM_GROUPING_SEPARATOR_FIELD: + return &JSAtomState::group; + + case UNUM_DECIMAL_SEPARATOR_FIELD: + return &JSAtomState::decimal; + + case UNUM_FRACTION_FIELD: + return &JSAtomState::fraction; + + case UNUM_SIGN_FIELD: { + MOZ_ASSERT(!IsNegativeZero(d), + "-0 should have been excluded by PartitionNumberPattern"); + + // Manual trawling through the ICU call graph appears to indicate that + // the basic formatting we request will never include a positive sign. + // But this analysis may be mistaken, so don't absolutely trust it. + return d < 0 ? &JSAtomState::minusSign : &JSAtomState::plusSign; + } + + case UNUM_PERCENT_FIELD: + return &JSAtomState::percentSign; + + case UNUM_CURRENCY_FIELD: + return &JSAtomState::currency; + + case UNUM_PERMILL_FIELD: + MOZ_ASSERT_UNREACHABLE("unexpected permill field found, even though " + "we don't use any user-defined patterns that " + "would require a permill field"); + break; + + case UNUM_EXPONENT_SYMBOL_FIELD: + case UNUM_EXPONENT_SIGN_FIELD: + case UNUM_EXPONENT_FIELD: + MOZ_ASSERT_UNREACHABLE("exponent field unexpectedly found in " + "formatted number, even though UNUM_SCIENTIFIC " + "and scientific notation were never requested"); + break; + + case UNUM_FIELD_COUNT: + MOZ_ASSERT_UNREACHABLE("format field sentinel value returned by " + "iterator!"); + break; + } + + MOZ_ASSERT_UNREACHABLE("unenumerated, undocumented format field returned " + "by iterator"); + return nullptr; +} + +static bool +intl_FormatNumberToParts(JSContext* cx, UNumberFormat* nf, double x, MutableHandleValue result) +{ + UErrorCode status = U_ZERO_ERROR; + + UFieldPositionIterator* fpositer = ufieldpositer_open(&status); + if (U_FAILURE(status)) { + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); + return false; + } + + MOZ_ASSERT(fpositer); + ScopedICUObject toClose(fpositer); + + FormattedNumberChars chars(cx); + if (!PartitionNumberPattern(cx, nf, &x, fpositer, chars)) + return false; + + RootedArrayObject partsArray(cx, NewDenseEmptyArray(cx)); + if (!partsArray) + return false; + + RootedString overallResult(cx, NewStringCopyN(cx, chars.begin(), chars.length())); + if (!overallResult) + return false; + + // First, vacuum up fields in the overall formatted string. + + struct Field + { + uint32_t begin; + uint32_t end; + FieldType type; + + // Needed for vector-resizing scratch space. + Field() = default; + + Field(uint32_t begin, uint32_t end, FieldType type) + : begin(begin), end(end), type(type) + {} + }; + + using FieldsVector = Vector; + FieldsVector fields(cx); + + int32_t fieldInt, beginIndexInt, endIndexInt; + while ((fieldInt = ufieldpositer_next(fpositer, &beginIndexInt, &endIndexInt)) >= 0) { + MOZ_ASSERT(beginIndexInt >= 0); + MOZ_ASSERT(endIndexInt >= 0); + MOZ_ASSERT(beginIndexInt < endIndexInt, + "erm, aren't fields always non-empty?"); + + FieldType type = GetFieldTypeForNumberField(UNumberFormatFields(fieldInt), x); + if (!fields.emplaceBack(uint32_t(beginIndexInt), uint32_t(endIndexInt), type)) + return false; + } + + // Second, merge sort the fields vector. Expand the vector to have scratch + // space for performing the sort. + size_t fieldsLen = fields.length(); + if (!fields.resizeUninitialized(fieldsLen * 2)) + return false; + + MOZ_ALWAYS_TRUE(MergeSort(fields.begin(), fieldsLen, fields.begin() + fieldsLen, + [](const Field& left, const Field& right, + bool* lessOrEqual) + { + // Sort first by begin index, then to place + // enclosing fields before nested fields. + *lessOrEqual = left.begin < right.begin || + (left.begin == right.begin && + left.end > right.end); + return true; + })); + + // Deallocate the scratch space. + if (!fields.resize(fieldsLen)) + return false; + + // Third, iterate over the sorted field list to generate a sequence of + // parts (what ECMA-402 actually exposes). A part is a maximal character + // sequence entirely within no field or a single most-nested field. + // + // Diagrams may be helpful to illustrate how fields map to parts. Consider + // formatting -28,114,774,228,750.32, the US national surplus (negative + // because it's actually a debt) on March 31, 2021. + // + // var options = + // { style: "currency", currency: "USD", currencyDisplay: "name" }; + // var usdFormatter = new Intl.NumberFormat("en-US", options); + // usdFormatter.format(-28114774228750.32); + // + // The formatted result is "-28,114,774,228,750.32 US dollars". ICU + // identifies these fields in the string: + // + // UNUM_GROUPING_SEPARATOR_FIELD + // | + // UNUM_SIGN_FIELD | UNUM_DECIMAL_SEPARATOR_FIELD + // | __________/| | + // | / | | | | + // "-28,114,774,228,750.32 US dollars" + // \________________/ |/ \_______/ + // | | | + // UNUM_INTEGER_FIELD | UNUM_CURRENCY_FIELD + // | + // UNUM_FRACTION_FIELD + // + // These fields map to parts as follows: + // + // integer decimal + // _____|________ | + // / /| |\ |\ |\ | literal + // /| / | | \ | \ | \| | + // "-28,114,774,228,750.32 US dollars" + // | \___|___|___/ |/ \________/ + // | | | | + // | group | currency + // | | + // minusSign fraction + // + // The sign is a part. Each comma is a part, splitting the integer field + // into parts for trillions/billions/&c. digits. The decimal point is a + // part. Cents are a part. The space between cents and currency is a part + // (outside any field). Last, the currency field is a part. + // + // Because parts fully partition the formatted string, we only track the + // end of each part -- the beginning is implicitly the last part's end. + struct Part + { + uint32_t end; + FieldType type; + }; + + class PartGenerator + { + // The fields in order from start to end, then least to most nested. + const FieldsVector& fields; + + // Index of the current field, in |fields|, being considered to + // determine part boundaries. |lastEnd <= fields[index].begin| is an + // invariant. + size_t index; + + // The end index of the last part produced, always less than or equal + // to |limit|, strictly increasing. + uint32_t lastEnd; + + // The length of the overall formatted string. + const uint32_t limit; + + Vector enclosingFields; + + void popEnclosingFieldsEndingAt(uint32_t end) { + MOZ_ASSERT_IF(enclosingFields.length() > 0, + fields[enclosingFields.back()].end >= end); + + while (enclosingFields.length() > 0 && fields[enclosingFields.back()].end == end) + enclosingFields.popBack(); + } + + bool nextPartInternal(Part* part) { + size_t len = fields.length(); + MOZ_ASSERT(index <= len); + + // If we're out of fields, all that remains are part(s) consisting + // of trailing portions of enclosing fields, and maybe a final + // literal part. + if (index == len) { + if (enclosingFields.length() > 0) { + const auto& enclosing = fields[enclosingFields.popCopy()]; + part->end = enclosing.end; + part->type = enclosing.type; + + // If additional enclosing fields end where this part ends, + // pop them as well. + popEnclosingFieldsEndingAt(part->end); + } else { + part->end = limit; + part->type = &JSAtomState::literal; + } + + return true; + } + + // Otherwise we still have a field to process. + const Field* current = &fields[index]; + MOZ_ASSERT(lastEnd <= current->begin); + MOZ_ASSERT(current->begin < current->end); + + // But first, deal with inter-field space. + if (lastEnd < current->begin) { + if (enclosingFields.length() > 0) { + // Space between fields, within an enclosing field, is part + // of that enclosing field, until the start of the current + // field or the end of the enclosing field, whichever is + // earlier. + const auto& enclosing = fields[enclosingFields.back()]; + part->end = std::min(enclosing.end, current->begin); + part->type = enclosing.type; + popEnclosingFieldsEndingAt(part->end); + } else { + // If there's no enclosing field, the space is a literal. + part->end = current->begin; + part->type = &JSAtomState::literal; + } + + return true; + } + + // Otherwise, the part spans a prefix of the current field. Find + // the most-nested field containing that prefix. + const Field* next; + do { + current = &fields[index]; + + // If the current field is last, the part extends to its end. + if (++index == len) { + part->end = current->end; + part->type = current->type; + return true; + } + + next = &fields[index]; + MOZ_ASSERT(current->begin <= next->begin); + MOZ_ASSERT(current->begin < next->end); + + // If the next field nests within the current field, push an + // enclosing field. (If there are no nested fields, don't + // bother pushing a field that'd be immediately popped.) + if (current->end > next->begin) { + if (!enclosingFields.append(index - 1)) + return false; + } + + // Do so until the next field begins after this one. + } while (current->begin == next->begin); + + part->type = current->type; + + if (current->end <= next->begin) { + // The next field begins after the current field ends. Therefore + // the current part ends at the end of the current field. + part->end = current->end; + popEnclosingFieldsEndingAt(part->end); + } else { + // The current field encloses the next one. The current part + // ends where the next field/part will start. + part->end = next->begin; + } + + return true; + } + + public: + PartGenerator(JSContext* cx, const FieldsVector& vec, uint32_t limit) + : fields(vec), index(0), lastEnd(0), limit(limit), enclosingFields(cx) + {} + + bool nextPart(bool* hasPart, Part* part) { + // There are no parts left if we've partitioned the entire string. + if (lastEnd == limit) { + MOZ_ASSERT(enclosingFields.length() == 0); + *hasPart = false; + return true; + } + + if (!nextPartInternal(part)) + return false; + + *hasPart = true; + lastEnd = part->end; + return true; + } + }; + + // Finally, generate the result array. + size_t lastEndIndex = 0; + uint32_t partIndex = 0; + RootedObject singlePart(cx); + RootedValue propVal(cx); + + PartGenerator gen(cx, fields, chars.length()); + do { + bool hasPart; + Part part; + if (!gen.nextPart(&hasPart, &part)) + return false; + + if (!hasPart) + break; + + FieldType type = part.type; + size_t endIndex = part.end; + + MOZ_ASSERT(lastEndIndex < endIndex); + + singlePart = NewBuiltinClassInstance(cx); + if (!singlePart) + return false; + + propVal.setString(cx->names().*type); + if (!DefineProperty(cx, singlePart, cx->names().type, propVal)) + return false; + + JSLinearString* partSubstr = + NewDependentString(cx, overallResult, lastEndIndex, endIndex - lastEndIndex); + if (!partSubstr) + return false; + + propVal.setString(partSubstr); + if (!DefineProperty(cx, singlePart, cx->names().value, propVal)) + return false; + + propVal.setObject(*singlePart); + if (!DefineElement(cx, partsArray, partIndex, propVal)) + return false; + + lastEndIndex = endIndex; + partIndex++; + } while (true); + + MOZ_ASSERT(lastEndIndex == chars.length(), + "result array must partition the entire string"); + + result.setObject(*partsArray); + return true; +} + +#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) + bool js::intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); - MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(args.length() == 3); MOZ_ASSERT(args[0].isObject()); MOZ_ASSERT(args[1].isNumber()); + MOZ_ASSERT(args[2].isBoolean()); RootedObject numberFormat(cx, &args[0].toObject()); @@ -1252,8 +1712,21 @@ js::intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp) } // Use the UNumberFormat to actually format the number. + double d = args[1].toNumber(); RootedValue result(cx); - bool success = intl_FormatNumber(cx, nf, args[1].toNumber(), &result); + + bool success; +#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) + if (args[2].toBoolean()) { + success = intl_FormatNumberToParts(cx, nf, d, &result); + } else +#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) + { + MOZ_ASSERT(!args[2].toBoolean(), + "shouldn't be doing formatToParts without an ICU that " + "supports it"); + success = intl_FormatNumber(cx, nf, d, &result); + } if (!isNumberFormatInstance) unum_close(nf); @@ -2145,8 +2618,6 @@ intl_FormatDateTime(JSContext* cx, UDateFormat* df, double x, MutableHandleValue return true; } -using FieldType = ImmutablePropertyNamePtr JSAtomState::*; - static FieldType GetFieldTypeForFormatField(UDateFormatField fieldName) { @@ -2251,7 +2722,7 @@ intl_FormatToPartsDateTime(JSContext* cx, UDateFormat* df, double x, MutableHand JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return false; } - auto closeFieldPosIter = MakeScopeExit([&]() { ufieldpositer_close(fpositer); }); + ScopedICUObject toClose(fpositer); int resultSize = udat_formatForFields(df, x, Char16ToUChar(chars.begin()), INITIAL_CHAR_BUFFER_SIZE, @@ -2285,7 +2756,6 @@ intl_FormatToPartsDateTime(JSContext* cx, UDateFormat* df, double x, MutableHand uint32_t partIndex = 0; RootedObject singlePart(cx); RootedValue partType(cx); - RootedString partSubstr(cx); RootedValue val(cx); auto AppendPart = [&](FieldType type, size_t beginIndex, size_t endIndex) { @@ -2297,7 +2767,8 @@ intl_FormatToPartsDateTime(JSContext* cx, UDateFormat* df, double x, MutableHand if (!DefineProperty(cx, singlePart, cx->names().type, partType)) return false; - partSubstr = SubstringKernel(cx, overallResult, beginIndex, endIndex - beginIndex); + JSLinearString* partSubstr = + NewDependentString(cx, overallResult, beginIndex, endIndex - beginIndex); if (!partSubstr) return false; diff --git a/js/src/builtin/Intl.js b/js/src/builtin/Intl.js index 281b0f4243..ef0aa986a6 100644 --- a/js/src/builtin/Intl.js +++ b/js/src/builtin/Intl.js @@ -2140,7 +2140,7 @@ function numberFormatFormatToBind(value) { // Step 1.a.ii-iii. var x = ToNumber(value); - return intl_FormatNumber(this, x); + return intl_FormatNumber(this, x, /* formatToParts = */ false); } @@ -2168,6 +2168,19 @@ function Intl_NumberFormat_format_get() { return internals.boundFormat; } +function Intl_NumberFormat_formatToParts(value) { + // Step 1. + var nf = this; + + // Steps 2-3. + getNumberFormatInternals(nf, "formatToParts"); + + // Step 4. + var x = ToNumber(value); + + // Step 5. + return intl_FormatNumber(nf, x, /* formatToParts = */ true); +} /** * Returns the resolved options for a NumberFormat object. diff --git a/js/src/builtin/Number.js b/js/src/builtin/Number.js index 07b2be57ab..323d2666b2 100644 --- a/js/src/builtin/Number.js +++ b/js/src/builtin/Number.js @@ -36,7 +36,7 @@ function Number_toLocaleString() { } // Step 5. - return intl_FormatNumber(numberFormat, x); + return intl_FormatNumber(numberFormat, x, /* formatToParts = */ false); } // ES6 draft ES6 20.1.2.4 diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 1eecdbf749..63119cb288 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -2206,6 +2206,7 @@ class JS_PUBLIC_API(CompartmentCreationOptions) mergeable_(false), preserveJitCode_(false), cloneSingletons_(false), + experimentalNumberFormatFormatToPartsEnabled_(false), sharedMemoryAndAtomics_(false), secureContext_(false) { @@ -2270,6 +2271,23 @@ class JS_PUBLIC_API(CompartmentCreationOptions) return *this; } + // ECMA-402 is considering adding a "formatToParts" NumberFormat method, + // that exposes not just a formatted string but its subcomponents. The + // method, its semantics, and its name aren't finalized, so for now it's + // exposed *only* if requested. + // + // Until "formatToParts" is included in a final specification edition, it's + // subject to change or removal at any time. Do *not* rely on it in + // mission-critical code that can't be changed if ECMA-402 decides not to + // accept the method in its current form. + bool experimentalNumberFormatFormatToPartsEnabled() const { + return experimentalNumberFormatFormatToPartsEnabled_; + } + CompartmentCreationOptions& setExperimentalNumberFormatFormatToPartsEnabled(bool flag) { + experimentalNumberFormatFormatToPartsEnabled_ = flag; + return *this; + } + bool getSharedMemoryAndAtomicsEnabled() const; CompartmentCreationOptions& setSharedMemoryAndAtomicsEnabled(bool flag); @@ -2294,6 +2312,7 @@ class JS_PUBLIC_API(CompartmentCreationOptions) bool mergeable_; bool preserveJitCode_; bool cloneSingletons_; + bool experimentalNumberFormatFormatToPartsEnabled_; bool sharedMemoryAndAtomics_; bool secureContext_; }; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 6e155d3ff6..088551c302 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -4684,6 +4684,11 @@ NewGlobal(JSContext* cx, unsigned argc, Value* vp) if (v.isBoolean()) creationOptions.setCloneSingletons(v.toBoolean()); + if (!JS_GetProperty(cx, opts, "experimentalNumberFormatFormatToPartsEnabled", &v)) + return false; + if (v.isBoolean()) + creationOptions.setExperimentalNumberFormatFormatToPartsEnabled(v.toBoolean()); + if (!JS_GetProperty(cx, opts, "sameZoneAs", &v)) return false; if (v.isObject()) diff --git a/js/src/vm/CommonPropertyNames.h b/js/src/vm/CommonPropertyNames.h index a88406bc61..ed75802b1b 100644 --- a/js/src/vm/CommonPropertyNames.h +++ b/js/src/vm/CommonPropertyNames.h @@ -82,10 +82,10 @@ macro(currencyDisplay, currencyDisplay, "currencyDisplay") \ macro(DateTimeFormat, DateTimeFormat, "DateTimeFormat") \ macro(DateTimeFormatFormatGet, DateTimeFormatFormatGet, "Intl_DateTimeFormat_format_get") \ - macro(DateTimeFormatFormatToParts, DateTimeFormatFormatToParts, "Intl_DateTimeFormat_formatToParts") \ macro(day, day, "day") \ macro(dayPeriod, dayPeriod, "dayPeriod") \ macro(debugger, debugger, "debugger") \ + macro(decimal, decimal, "decimal") \ macro(decodeURI, decodeURI, "decodeURI") \ macro(decodeURIComponent, decodeURIComponent, "decodeURIComponent") \ macro(DefaultBaseClassConstructor, DefaultBaseClassConstructor, "DefaultBaseClassConstructor") \ @@ -142,6 +142,8 @@ macro(forceInterpreter, forceInterpreter, "forceInterpreter") \ macro(forEach, forEach, "forEach") \ macro(format, format, "format") \ + macro(formatToParts, formatToParts, "formatToParts") \ + macro(fraction, fraction, "fraction") \ macro(frame, frame, "frame") \ macro(from, from, "from") \ macro(fulfilled, fulfilled, "fulfilled") \ @@ -160,6 +162,7 @@ macro(getPrototypeOf, getPrototypeOf, "getPrototypeOf") \ macro(global, global, "global") \ macro(globalThis, globalThis, "globalThis") \ + macro(group, group, "group") \ macro(Handle, Handle, "Handle") \ macro(has, has, "has") \ macro(hasOwn, hasOwn, "hasOwn") \ @@ -174,6 +177,7 @@ macro(includes, includes, "includes") \ macro(incumbentGlobal, incumbentGlobal, "incumbentGlobal") \ macro(index, index, "index") \ + macro(infinity, infinity, "infinity") \ macro(Infinity, Infinity, "Infinity") \ macro(InitializeCollator, InitializeCollator, "InitializeCollator") \ macro(InitializeDateTimeFormat, InitializeDateTimeFormat, "InitializeDateTimeFormat") \ @@ -189,6 +193,7 @@ macro(Int8x16, Int8x16, "Int8x16") \ macro(Int16x8, Int16x8, "Int16x8") \ macro(Int32x4, Int32x4, "Int32x4") \ + macro(integer, integer, "integer") \ macro(interface, interface, "interface") \ macro(InterpretGeneratorResume, InterpretGeneratorResume, "InterpretGeneratorResume") \ macro(isEntryPoint, isEntryPoint, "isEntryPoint") \ @@ -223,6 +228,7 @@ macro(minimumFractionDigits, minimumFractionDigits, "minimumFractionDigits") \ macro(minimumIntegerDigits, minimumIntegerDigits, "minimumIntegerDigits") \ macro(minimumSignificantDigits, minimumSignificantDigits, "minimumSignificantDigits") \ + macro(minusSign, minusSign, "minusSign") \ macro(minute, minute, "minute") \ macro(missingArguments, missingArguments, "missingArguments") \ macro(module, module, "module") \ @@ -232,6 +238,7 @@ macro(month, month, "month") \ macro(multiline, multiline, "multiline") \ macro(name, name, "name") \ + macro(nan, nan, "nan") \ macro(NaN, NaN, "NaN") \ macro(NegativeInfinity, NegativeInfinity, "-Infinity") \ macro(new, new_, "new") \ @@ -246,6 +253,7 @@ macro(notes, notes, "notes") \ macro(NumberFormat, NumberFormat, "NumberFormat") \ macro(NumberFormatFormatGet, NumberFormatFormatGet, "Intl_NumberFormat_format_get") \ + macro(NumberFormatFormatToParts, NumberFormatFormatToParts, "Intl_NumberFormat_formatToParts") \ macro(numeric, numeric, "numeric") \ macro(objectArguments, objectArguments, "[object Arguments]") \ macro(objectArray, objectArray, "[object Array]") \ @@ -271,9 +279,10 @@ macro(parseInt, parseInt, "parseInt") \ macro(pattern, pattern, "pattern") \ macro(pending, pending, "pending") \ + macro(percentSign, percentSign, "percentSign") \ macro(PluralRules, PluralRules, "PluralRules") \ macro(PluralRulesSelect, PluralRulesSelect, "Intl_PluralRules_Select") \ - macro(public, public_, "public") \ + macro(plusSign, plusSign, "plusSign") \ macro(preventExtensions, preventExtensions, "preventExtensions") \ macro(private, private_, "private") \ macro(promise, promise, "promise") \ @@ -282,6 +291,7 @@ macro(proto, proto, "__proto__") \ macro(prototype, prototype, "prototype") \ macro(proxy, proxy, "proxy") \ + macro(public, public_, "public") \ macro(raw, raw, "raw") \ macro(reason, reason, "reason") \ macro(RegExpFlagsGetter, RegExpFlagsGetter, "RegExpFlagsGetter") \ From bdcb9cc504d5c5500a685cc6e931d24aa84c5816 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 31 Mar 2021 14:45:56 +0000 Subject: [PATCH 5/8] Issue #1756 - Expose NumberFormat.formatToParts() to content. --- js/src/builtin/Intl.cpp | 19 +------------------ js/src/jsapi.h | 19 ------------------- js/src/shell/js.cpp | 5 ----- js/src/vm/CommonPropertyNames.h | 2 -- 4 files changed, 1 insertion(+), 44 deletions(-) diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 71e40a2d54..92dea5687e 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -755,6 +755,7 @@ static const JSFunctionSpec numberFormat_static_methods[] = { static const JSFunctionSpec numberFormat_methods[] = { JS_SELF_HOSTED_FN("resolvedOptions", "Intl_NumberFormat_resolvedOptions", 0, 0), + JS_SELF_HOSTED_FN("formatToParts", "Intl_NumberFormat_formatToParts", 1, 0), #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, numberFormat_toSource, 0, 0), #endif @@ -905,24 +906,6 @@ CreateNumberFormatPrototype(JSContext* cx, HandleObject Intl, Handlecompartment()->creationOptions().experimentalNumberFormatFormatToPartsEnabled()) { - RootedValue ftp(cx); - HandlePropertyName name = cx->names().formatToParts; - if (!GlobalObject::getSelfHostedFunction(cx, cx->global(), - cx->names().NumberFormatFormatToParts, - name, 1, &ftp)) - { - return nullptr; - } - - if (!DefineProperty(cx, proto, cx->names().formatToParts, ftp, nullptr, nullptr, 0)) - return nullptr; - } -#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) - RootedValue options(cx); if (!CreateDefaultOptions(cx, &options)) return nullptr; diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 63119cb288..1eecdbf749 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -2206,7 +2206,6 @@ class JS_PUBLIC_API(CompartmentCreationOptions) mergeable_(false), preserveJitCode_(false), cloneSingletons_(false), - experimentalNumberFormatFormatToPartsEnabled_(false), sharedMemoryAndAtomics_(false), secureContext_(false) { @@ -2271,23 +2270,6 @@ class JS_PUBLIC_API(CompartmentCreationOptions) return *this; } - // ECMA-402 is considering adding a "formatToParts" NumberFormat method, - // that exposes not just a formatted string but its subcomponents. The - // method, its semantics, and its name aren't finalized, so for now it's - // exposed *only* if requested. - // - // Until "formatToParts" is included in a final specification edition, it's - // subject to change or removal at any time. Do *not* rely on it in - // mission-critical code that can't be changed if ECMA-402 decides not to - // accept the method in its current form. - bool experimentalNumberFormatFormatToPartsEnabled() const { - return experimentalNumberFormatFormatToPartsEnabled_; - } - CompartmentCreationOptions& setExperimentalNumberFormatFormatToPartsEnabled(bool flag) { - experimentalNumberFormatFormatToPartsEnabled_ = flag; - return *this; - } - bool getSharedMemoryAndAtomicsEnabled() const; CompartmentCreationOptions& setSharedMemoryAndAtomicsEnabled(bool flag); @@ -2312,7 +2294,6 @@ class JS_PUBLIC_API(CompartmentCreationOptions) bool mergeable_; bool preserveJitCode_; bool cloneSingletons_; - bool experimentalNumberFormatFormatToPartsEnabled_; bool sharedMemoryAndAtomics_; bool secureContext_; }; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 088551c302..6e155d3ff6 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -4684,11 +4684,6 @@ NewGlobal(JSContext* cx, unsigned argc, Value* vp) if (v.isBoolean()) creationOptions.setCloneSingletons(v.toBoolean()); - if (!JS_GetProperty(cx, opts, "experimentalNumberFormatFormatToPartsEnabled", &v)) - return false; - if (v.isBoolean()) - creationOptions.setExperimentalNumberFormatFormatToPartsEnabled(v.toBoolean()); - if (!JS_GetProperty(cx, opts, "sameZoneAs", &v)) return false; if (v.isObject()) diff --git a/js/src/vm/CommonPropertyNames.h b/js/src/vm/CommonPropertyNames.h index ed75802b1b..7df7563b5b 100644 --- a/js/src/vm/CommonPropertyNames.h +++ b/js/src/vm/CommonPropertyNames.h @@ -142,7 +142,6 @@ macro(forceInterpreter, forceInterpreter, "forceInterpreter") \ macro(forEach, forEach, "forEach") \ macro(format, format, "format") \ - macro(formatToParts, formatToParts, "formatToParts") \ macro(fraction, fraction, "fraction") \ macro(frame, frame, "frame") \ macro(from, from, "from") \ @@ -253,7 +252,6 @@ macro(notes, notes, "notes") \ macro(NumberFormat, NumberFormat, "NumberFormat") \ macro(NumberFormatFormatGet, NumberFormatFormatGet, "Intl_NumberFormat_format_get") \ - macro(NumberFormatFormatToParts, NumberFormatFormatToParts, "Intl_NumberFormat_formatToParts") \ macro(numeric, numeric, "numeric") \ macro(objectArguments, objectArguments, "[object Arguments]") \ macro(objectArray, objectArray, "[object Array]") \ From 4651d973429a608714cce73dc462ad7cf4e0dafc Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 31 Mar 2021 15:41:38 +0000 Subject: [PATCH 6/8] Issue #1756 - Clean up ICU patch. We don't need ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS because we don't support any ICU other than the one in-tree. --- .../unum_formatDoubleForFields.diff | 7 +++-- intl/icu/source/i18n/unicode/unum.h | 5 ++-- js/src/builtin/Intl.cpp | 26 +------------------ 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/intl/icu-patches/unum_formatDoubleForFields.diff b/intl/icu-patches/unum_formatDoubleForFields.diff index 75a684d4aa..148c7d2d97 100644 --- a/intl/icu-patches/unum_formatDoubleForFields.diff +++ b/intl/icu-patches/unum_formatDoubleForFields.diff @@ -23,7 +23,7 @@ diff --git a/intl/icu/source/i18n/unicode/unum.h b/intl/icu/source/i18n/unicode/ *

Number Format C API

* * Number Format C API Provides functions for -@@ -647,16 +648,67 @@ U_STABLE int32_t U_EXPORT2 +@@ -647,16 +648,66 @@ U_STABLE int32_t U_EXPORT2 unum_formatUFormattable(const UNumberFormat* fmt, const UFormattable *number, UChar *result, @@ -71,16 +71,15 @@ diff --git a/intl/icu/source/i18n/unicode/unum.h b/intl/icu/source/i18n/unicode/ +* @see unum_parseDouble +* @see UFieldPositionIterator +* @see UNumberFormatFields -+* @draft ICU 59 ++* @stable ICU 59 +*/ -+U_DRAFT int32_t U_EXPORT2 ++U_STABLE int32_t U_EXPORT2 +unum_formatDoubleForFields(const UNumberFormat* format, + double number, + UChar* result, + int32_t resultLength, + UFieldPositionIterator* fpositer, + UErrorCode* status); -+#define ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS + +/** * Parse a string into an integer using a UNumberFormat. diff --git a/intl/icu/source/i18n/unicode/unum.h b/intl/icu/source/i18n/unicode/unum.h index acc6abf8c5..8c37ec90ae 100644 --- a/intl/icu/source/i18n/unicode/unum.h +++ b/intl/icu/source/i18n/unicode/unum.h @@ -692,16 +692,15 @@ unum_formatUFormattable(const UNumberFormat* fmt, * @see unum_parseDouble * @see UFieldPositionIterator * @see UNumberFormatFields -* @draft ICU 59 +* @stable ICU 59 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 unum_formatDoubleForFields(const UNumberFormat* format, double number, UChar* result, int32_t resultLength, UFieldPositionIterator* fpositer, UErrorCode* status); -#define ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS /** * Parse a string into an integer using a UNumberFormat. diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 92dea5687e..5455b3a854 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -1202,23 +1202,11 @@ PartitionNumberPattern(JSContext* cx, UNumberFormat* nf, double* x, MOZ_ALWAYS_TRUE(formattedChars.resize(INITIAL_CHAR_BUFFER_SIZE)); UErrorCode status = U_ZERO_ERROR; -#if !defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) - MOZ_ASSERT(fpositer == nullptr, - "shouldn't be requesting field information from an ICU that " - "can't provide it"); -#endif - int32_t resultSize; -#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) resultSize = unum_formatDoubleForFields(nf, *x, Char16ToUChar(formattedChars.begin()), INITIAL_CHAR_BUFFER_SIZE, fpositer, &status); -#else - resultSize = - unum_formatDouble(nf, *x, Char16ToUChar(formattedChars.begin()), INITIAL_CHAR_BUFFER_SIZE, - nullptr, &status); -#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) if (status == U_BUFFER_OVERFLOW_ERROR) { if (!formattedChars.resize(size_t(resultSize))) return false; @@ -1226,13 +1214,8 @@ PartitionNumberPattern(JSContext* cx, UNumberFormat* nf, double* x, #ifdef DEBUG int32_t size = #endif -#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) unum_formatDoubleForFields(nf, *x, Char16ToUChar(formattedChars.begin()), resultSize, fpositer, &status); -#else - unum_formatDouble(nf, *x, Char16ToUChar(formattedChars.begin()), resultSize, - nullptr, &status); -#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) MOZ_ASSERT(size == resultSize); } if (U_FAILURE(status)) { @@ -1262,8 +1245,6 @@ intl_FormatNumber(JSContext* cx, UNumberFormat* nf, double x, MutableHandleValue using FieldType = ImmutablePropertyNamePtr JSAtomState::*; -#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) - static FieldType GetFieldTypeForNumberField(UNumberFormatFields fieldName, double d) { @@ -1658,8 +1639,6 @@ intl_FormatNumberToParts(JSContext* cx, UNumberFormat* nf, double x, MutableHand return true; } -#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) - bool js::intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp) { @@ -1699,12 +1678,9 @@ js::intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp) RootedValue result(cx); bool success; -#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) if (args[2].toBoolean()) { success = intl_FormatNumberToParts(cx, nf, d, &result); - } else -#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) - { + } else { MOZ_ASSERT(!args[2].toBoolean(), "shouldn't be doing formatToParts without an ICU that " "supports it"); From 724fc731ac789033bcddfbe27596fdf45e4223ba Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 25 Mar 2021 21:32:38 +0000 Subject: [PATCH 7/8] [Pale-Moon] Issue #1865 - Remove unused overlays and unnecessary preprocessing --- .../base/content/browserMountPoints.inc | 12 ---- .../base/content/downloadManagerOverlay.xul | 32 --------- .../base/content/jsConsoleOverlay.xul | 18 ----- .../base/content/macBrowserOverlay.xul | 67 ------------------- .../base/content/softwareUpdateOverlay.xul | 18 ----- application/palemoon/base/jar.mn | 14 ++-- .../palemoon/components/downloads/jar.mn | 10 +-- .../palemoon/components/pageinfo/jar.mn | 2 +- application/palemoon/components/places/jar.mn | 12 ++-- .../palemoon/components/preferences/jar.mn | 14 ++-- .../components/privatebrowsing/jar.mn | 2 +- application/palemoon/components/search/jar.mn | 2 +- .../palemoon/components/sessionstore/jar.mn | 2 +- application/palemoon/components/shell/jar.mn | 2 +- 14 files changed, 30 insertions(+), 177 deletions(-) delete mode 100644 application/palemoon/base/content/browserMountPoints.inc delete mode 100644 application/palemoon/base/content/downloadManagerOverlay.xul delete mode 100644 application/palemoon/base/content/jsConsoleOverlay.xul delete mode 100644 application/palemoon/base/content/macBrowserOverlay.xul delete mode 100644 application/palemoon/base/content/softwareUpdateOverlay.xul diff --git a/application/palemoon/base/content/browserMountPoints.inc b/application/palemoon/base/content/browserMountPoints.inc deleted file mode 100644 index e4315b04a8..0000000000 --- a/application/palemoon/base/content/browserMountPoints.inc +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/application/palemoon/base/content/downloadManagerOverlay.xul b/application/palemoon/base/content/downloadManagerOverlay.xul deleted file mode 100644 index 9987820cb9..0000000000 --- a/application/palemoon/base/content/downloadManagerOverlay.xul +++ /dev/null @@ -1,32 +0,0 @@ - -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - - - - - - -#include browserMountPoints.inc - - - - - - diff --git a/application/palemoon/base/content/jsConsoleOverlay.xul b/application/palemoon/base/content/jsConsoleOverlay.xul deleted file mode 100644 index 1bc518d4f8..0000000000 --- a/application/palemoon/base/content/jsConsoleOverlay.xul +++ /dev/null @@ -1,18 +0,0 @@ - -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - - - - - - -#include browserMountPoints.inc - - - - diff --git a/application/palemoon/base/content/macBrowserOverlay.xul b/application/palemoon/base/content/macBrowserOverlay.xul deleted file mode 100644 index b1ae838d0f..0000000000 --- a/application/palemoon/base/content/macBrowserOverlay.xul +++ /dev/null @@ -1,67 +0,0 @@ - -# -*- Mode: HTML -*- -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - - - - - - - -# All DTD information is stored in a separate file so that it can be shared by -# hiddenWindow.xul. -#include browser-doctype.inc - - - -# All JS files which are not content (only) dependent that browser.xul -# wishes to include *must* go into the global-scripts.inc file -# so that they can be shared by this overlay. -#include global-scripts.inc -#ifdef MOZ_DEVTOOLS -#include global-devtools-theme-scripts.inc -#endif - - - -# All sets except for popupsets (commands, keys, stringbundles and broadcasters) *must* go into the -# browser-sets.inc file for sharing with hiddenWindow.xul. -#include browser-sets.inc - -# The entire main menubar is placed into browser-menubar.inc, so that it can be shared by -# hiddenWindow.xul. -#include browser-menubar.inc - - - - - - - - - - - diff --git a/application/palemoon/base/content/softwareUpdateOverlay.xul b/application/palemoon/base/content/softwareUpdateOverlay.xul deleted file mode 100644 index 01170e46c3..0000000000 --- a/application/palemoon/base/content/softwareUpdateOverlay.xul +++ /dev/null @@ -1,18 +0,0 @@ - -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - - - - - - -#include browserMountPoints.inc - - - - diff --git a/application/palemoon/base/jar.mn b/application/palemoon/base/jar.mn index 18b7e7144c..ef6d02c486 100644 --- a/application/palemoon/base/jar.mn +++ b/application/palemoon/base/jar.mn @@ -11,7 +11,7 @@ browser.jar: % style chrome://global/content/customizeToolbar.xul chrome://browser/content/browser.css % style chrome://global/content/customizeToolbar.xul chrome://browser/skin/ * content/browser/aboutDialog.xul (content/aboutDialog.xul) -* content/browser/aboutDialog.js (content/aboutDialog.js) + content/browser/aboutDialog.js (content/aboutDialog.js) content/browser/aboutDialog.css (content/aboutDialog.css) content/browser/autorecovery.js (content/autorecovery.js) content/browser/autorecovery.xul (content/autorecovery.xul) @@ -24,7 +24,7 @@ browser.jar: #ifdef MOZ_DEVTOOLS content/browser/browser-devtools-theme.js (content/browser-devtools-theme.js) #endif -* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml) + content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml) content/browser/content.js (content/content.js) content/browser/padlock.xul (content/padlock.xul) content/browser/padlock.js (content/padlock.js) @@ -45,23 +45,23 @@ browser.jar: content/browser/safeMode.css (content/safeMode.css) content/browser/safeMode.js (content/safeMode.js) * content/browser/safeMode.xul (content/safeMode.xul) -* content/browser/sanitize.js (content/sanitize.js) + content/browser/sanitize.js (content/sanitize.js) * content/browser/sanitize.xul (content/sanitize.xul) * content/browser/sanitizeDialog.js (content/sanitizeDialog.js) content/browser/sanitizeDialog.css (content/sanitizeDialog.css) content/browser/autocomplete.css (content/autocomplete.css) -* content/browser/autocomplete.xml (content/autocomplete.xml) + content/browser/autocomplete.xml (content/autocomplete.xml) content/browser/tabbrowser.css (content/tabbrowser.css) * content/browser/tabbrowser.xml (content/tabbrowser.xml) -* content/browser/urlbarBindings.xml (content/urlbarBindings.xml) + content/browser/urlbarBindings.xml (content/urlbarBindings.xml) * content/browser/utilityOverlay.js (content/utilityOverlay.js) content/browser/web-panels.js (content/web-panels.js) * content/browser/web-panels.xul (content/web-panels.xul) * content/browser/baseMenuOverlay.xul (content/baseMenuOverlay.xul) * content/browser/nsContextMenu.js (content/nsContextMenu.js) # XXX: We should exclude this one as well (bug 71895) -* content/browser/hiddenWindow.xul (content/hiddenWindow.xul) -* content/browser/viewSourceOverlay.xul (content/viewSourceOverlay.xul) + content/browser/hiddenWindow.xul (content/hiddenWindow.xul) + content/browser/viewSourceOverlay.xul (content/viewSourceOverlay.xul) #ifdef XP_WIN content/browser/win6BrowserOverlay.xul (content/win6BrowserOverlay.xul) #endif diff --git a/application/palemoon/components/downloads/jar.mn b/application/palemoon/components/downloads/jar.mn index 8f8c66dd7f..7b10ee9a70 100644 --- a/application/palemoon/components/downloads/jar.mn +++ b/application/palemoon/components/downloads/jar.mn @@ -3,16 +3,16 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. browser.jar: -* content/browser/downloads/download.xml (content/download.xml) + content/browser/downloads/download.xml (content/download.xml) content/browser/downloads/download.css (content/download.css) content/browser/downloads/downloads.css (content/downloads.css) -* content/browser/downloads/downloads.js (content/downloads.js) -* content/browser/downloads/downloadsOverlay.xul (content/downloadsOverlay.xul) + content/browser/downloads/downloads.js (content/downloads.js) + content/browser/downloads/downloadsOverlay.xul (content/downloadsOverlay.xul) content/browser/downloads/indicator.js (content/indicator.js) content/browser/downloads/indicatorOverlay.xul (content/indicatorOverlay.xul) -* content/browser/downloads/allDownloadsViewOverlay.xul (content/allDownloadsViewOverlay.xul) + content/browser/downloads/allDownloadsViewOverlay.xul (content/allDownloadsViewOverlay.xul) content/browser/downloads/allDownloadsViewOverlay.js (content/allDownloadsViewOverlay.js) content/browser/downloads/allDownloadsViewOverlay.css (content/allDownloadsViewOverlay.css) -* content/browser/downloads/contentAreaDownloadsView.xul (content/contentAreaDownloadsView.xul) + content/browser/downloads/contentAreaDownloadsView.xul (content/contentAreaDownloadsView.xul) content/browser/downloads/contentAreaDownloadsView.js (content/contentAreaDownloadsView.js) content/browser/downloads/contentAreaDownloadsView.css (content/contentAreaDownloadsView.css) diff --git a/application/palemoon/components/pageinfo/jar.mn b/application/palemoon/components/pageinfo/jar.mn index 229f991682..c0c947ffe4 100644 --- a/application/palemoon/components/pageinfo/jar.mn +++ b/application/palemoon/components/pageinfo/jar.mn @@ -3,7 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. browser.jar: -* content/browser/pageinfo/pageInfo.xul + content/browser/pageinfo/pageInfo.xul content/browser/pageinfo/pageInfo.js content/browser/pageinfo/pageInfo.css content/browser/pageinfo/pageInfo.xml diff --git a/application/palemoon/components/places/jar.mn b/application/palemoon/components/places/jar.mn index 41222e156c..77d05663a6 100644 --- a/application/palemoon/components/places/jar.mn +++ b/application/palemoon/components/places/jar.mn @@ -8,27 +8,27 @@ browser.jar: # attributes separately content/browser/places/bookmarkProperties2.xul (content/bookmarkProperties.xul) * content/browser/places/places.xul (content/places.xul) -* content/browser/places/places.js (content/places.js) + content/browser/places/places.js (content/places.js) content/browser/places/places.css (content/places.css) content/browser/places/organizer.css (content/organizer.css) content/browser/places/bookmarkProperties.xul (content/bookmarkProperties.xul) content/browser/places/bookmarkProperties.js (content/bookmarkProperties.js) content/browser/places/placesOverlay.xul (content/placesOverlay.xul) -* content/browser/places/menu.xml (content/menu.xml) + content/browser/places/menu.xml (content/menu.xml) content/browser/places/tree.xml (content/tree.xml) content/browser/places/controller.js (content/controller.js) content/browser/places/treeView.js (content/treeView.js) -* content/browser/places/browserPlacesViews.js (content/browserPlacesViews.js) + content/browser/places/browserPlacesViews.js (content/browserPlacesViews.js) # keep the Places version of the history sidebar at history/history-panel.xul # to prevent having to worry about between versions of the browser -* content/browser/history/history-panel.xul (content/history-panel.xul) + content/browser/history/history-panel.xul (content/history-panel.xul) content/browser/places/history-panel.js (content/history-panel.js) # ditto for the bookmarks sidebar content/browser/bookmarks/bookmarksPanel.xul (content/bookmarksPanel.xul) content/browser/bookmarks/bookmarksPanel.js (content/bookmarksPanel.js) -* content/browser/bookmarks/sidebarUtils.js (content/sidebarUtils.js) + content/browser/bookmarks/sidebarUtils.js (content/sidebarUtils.js) content/browser/places/moveBookmarks.xul (content/moveBookmarks.xul) content/browser/places/moveBookmarks.js (content/moveBookmarks.js) content/browser/places/editBookmarkOverlay.xul (content/editBookmarkOverlay.xul) content/browser/places/editBookmarkOverlay.js (content/editBookmarkOverlay.js) -* content/browser/places/downloadsViewOverlay.xul (content/downloadsViewOverlay.xul) + content/browser/places/downloadsViewOverlay.xul (content/downloadsViewOverlay.xul) diff --git a/application/palemoon/components/preferences/jar.mn b/application/palemoon/components/preferences/jar.mn index 7e8ac3bc8a..7981a9cb75 100644 --- a/application/palemoon/components/preferences/jar.mn +++ b/application/palemoon/components/preferences/jar.mn @@ -8,25 +8,25 @@ browser.jar: content/browser/preferences/applications.xul * content/browser/preferences/applications.js content/browser/preferences/applicationManager.xul -* content/browser/preferences/applicationManager.js + content/browser/preferences/applicationManager.js * content/browser/preferences/colors.xul -* content/browser/preferences/cookies.xul -* content/browser/preferences/cookies.js + content/browser/preferences/cookies.xul + content/browser/preferences/cookies.js * content/browser/preferences/content.xul content/browser/preferences/content.js -* content/browser/preferences/connection.xul + content/browser/preferences/connection.xul content/browser/preferences/connection.js -* content/browser/preferences/fonts.xul + content/browser/preferences/fonts.xul content/browser/preferences/fonts.js content/browser/preferences/handlers.xml content/browser/preferences/handlers.css -* content/browser/preferences/languages.xul + content/browser/preferences/languages.xul content/browser/preferences/languages.js * content/browser/preferences/main.xul content/browser/preferences/main.js content/browser/preferences/newtaburl.js content/browser/preferences/permissions.xul -* content/browser/preferences/permissions.js + content/browser/preferences/permissions.js * content/browser/preferences/preferences.xul content/browser/preferences/privacy.xul content/browser/preferences/privacy.js diff --git a/application/palemoon/components/privatebrowsing/jar.mn b/application/palemoon/components/privatebrowsing/jar.mn index 75e985c139..5667dc338e 100644 --- a/application/palemoon/components/privatebrowsing/jar.mn +++ b/application/palemoon/components/privatebrowsing/jar.mn @@ -3,4 +3,4 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. browser.jar: -* content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml) + content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml) diff --git a/application/palemoon/components/search/jar.mn b/application/palemoon/components/search/jar.mn index e6c42f97d5..71f6ba45e2 100644 --- a/application/palemoon/components/search/jar.mn +++ b/application/palemoon/components/search/jar.mn @@ -3,7 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. browser.jar: -* content/browser/search/search.xml (content/search.xml) + content/browser/search/search.xml (content/search.xml) content/browser/search/searchbarBindings.css (content/searchbarBindings.css) content/browser/search/engineManager.xul (content/engineManager.xul) content/browser/search/engineManager.js (content/engineManager.js) diff --git a/application/palemoon/components/sessionstore/jar.mn b/application/palemoon/components/sessionstore/jar.mn index 825b00fbbb..7ad408e4c3 100644 --- a/application/palemoon/components/sessionstore/jar.mn +++ b/application/palemoon/components/sessionstore/jar.mn @@ -4,5 +4,5 @@ browser.jar: * content/browser/aboutSessionRestore.xhtml (content/aboutSessionRestore.xhtml) -* content/browser/aboutSessionRestore.js (content/aboutSessionRestore.js) + content/browser/aboutSessionRestore.js (content/aboutSessionRestore.js) content/browser/content-sessionStore.js (content/content-sessionStore.js) diff --git a/application/palemoon/components/shell/jar.mn b/application/palemoon/components/shell/jar.mn index 39303f275b..4cff4da9e9 100644 --- a/application/palemoon/components/shell/jar.mn +++ b/application/palemoon/components/shell/jar.mn @@ -3,5 +3,5 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. browser.jar: -* content/browser/setDesktopBackground.xul (content/setDesktopBackground.xul) + content/browser/setDesktopBackground.xul (content/setDesktopBackground.xul) * content/browser/setDesktopBackground.js (content/setDesktopBackground.js) From 2fea3f29bcdb32efa5e6d4be3a119ef73fb4f349 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sat, 27 Mar 2021 15:43:47 +0000 Subject: [PATCH 8/8] [Pale-Moon] Issue #1865 - Stop preprocessor abuse causing issues --- application/palemoon/base/content/aboutDialog.js | 6 +++--- .../palemoon/base/content/browser-tabPreviews.xml | 8 ++++---- application/palemoon/base/content/hiddenWindow.xul | 9 ++++----- application/palemoon/base/content/sanitize.js | 8 ++++---- application/palemoon/base/content/urlbarBindings.xml | 8 ++++---- application/palemoon/base/content/viewSourceOverlay.xul | 6 +++--- .../downloads/content/allDownloadsViewOverlay.xul | 6 +++--- .../downloads/content/contentAreaDownloadsView.xul | 6 +++--- .../components/downloads/content/downloadsOverlay.xul | 7 +++---- application/palemoon/components/pageinfo/pageInfo.xul | 6 +++--- .../palemoon/components/places/content/history-panel.xul | 6 +++--- application/palemoon/components/places/content/menu.xml | 6 +++--- .../palemoon/components/places/content/places.xul | 6 +++--- .../palemoon/components/places/content/sidebarUtils.js | 8 ++++---- application/palemoon/components/preferences/advanced.js | 7 +++---- application/palemoon/components/preferences/advanced.xul | 7 +++---- .../components/preferences/applicationManager.js | 6 +++--- .../palemoon/components/preferences/applications.js | 9 +++------ application/palemoon/components/preferences/colors.xul | 7 +++---- .../palemoon/components/preferences/connection.js | 7 +++---- .../palemoon/components/preferences/connection.xul | 7 +++---- application/palemoon/components/preferences/content.js | 7 +++---- application/palemoon/components/preferences/cookies.js | 7 +++---- application/palemoon/components/preferences/cookies.xul | 7 +++---- application/palemoon/components/preferences/fonts.js | 7 +++---- application/palemoon/components/preferences/fonts.xul | 7 +++---- application/palemoon/components/preferences/languages.js | 7 +++---- .../palemoon/components/preferences/languages.xul | 7 +++---- application/palemoon/components/preferences/main.js | 7 +++---- application/palemoon/components/preferences/main.xul | 7 +++---- application/palemoon/components/preferences/newtaburl.js | 6 +++--- .../palemoon/components/preferences/preferences.xul | 7 +++---- application/palemoon/components/preferences/privacy.js | 7 +++---- application/palemoon/components/preferences/sanitize.js | 7 +++---- application/palemoon/components/preferences/security.js | 7 +++---- .../palemoon/components/preferences/selectBookmark.js | 7 +++---- application/palemoon/components/preferences/sync.js | 6 +++--- application/palemoon/components/preferences/tabs.js | 7 +++---- application/palemoon/components/preferences/tabs.xul | 7 +++---- .../privatebrowsing/content/aboutPrivateBrowsing.xhtml | 6 +++--- .../palemoon/components/search/content/search.xml | 7 +++---- .../components/shell/content/setDesktopBackground.xul | 6 +++--- 42 files changed, 131 insertions(+), 158 deletions(-) diff --git a/application/palemoon/base/content/aboutDialog.js b/application/palemoon/base/content/aboutDialog.js index cce96f96d4..7568de7265 100644 --- a/application/palemoon/base/content/aboutDialog.js +++ b/application/palemoon/base/content/aboutDialog.js @@ -1,6 +1,6 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. // Services = object with smart getters for common XPCOM services Components.utils.import("resource://gre/modules/Services.jsm"); diff --git a/application/palemoon/base/content/browser-tabPreviews.xml b/application/palemoon/base/content/browser-tabPreviews.xml index d06c8b2642..c2bfa63c79 100644 --- a/application/palemoon/base/content/browser-tabPreviews.xml +++ b/application/palemoon/base/content/browser-tabPreviews.xml @@ -1,9 +1,9 @@ -# -*- Mode: HTML -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + -# -*- Mode: HTML -*- -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/base/content/sanitize.js b/application/palemoon/base/content/sanitize.js index a40093f8ad..2be68878fc 100644 --- a/application/palemoon/base/content/sanitize.js +++ b/application/palemoon/base/content/sanitize.js @@ -1,7 +1,7 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. +// -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", diff --git a/application/palemoon/base/content/urlbarBindings.xml b/application/palemoon/base/content/urlbarBindings.xml index 0da91b798a..a17304cfa2 100644 --- a/application/palemoon/base/content/urlbarBindings.xml +++ b/application/palemoon/base/content/urlbarBindings.xml @@ -1,9 +1,9 @@ -# -*- Mode: HTML -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/base/content/viewSourceOverlay.xul b/application/palemoon/base/content/viewSourceOverlay.xul index 27f36dc311..4946d27cc2 100644 --- a/application/palemoon/base/content/viewSourceOverlay.xul +++ b/application/palemoon/base/content/viewSourceOverlay.xul @@ -1,7 +1,7 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/downloads/content/allDownloadsViewOverlay.xul b/application/palemoon/components/downloads/content/allDownloadsViewOverlay.xul index c19568f885..3571adc5c8 100644 --- a/application/palemoon/components/downloads/content/allDownloadsViewOverlay.xul +++ b/application/palemoon/components/downloads/content/allDownloadsViewOverlay.xul @@ -1,8 +1,8 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/downloads/content/contentAreaDownloadsView.xul b/application/palemoon/components/downloads/content/contentAreaDownloadsView.xul index 5ddcf2031d..6fecaf2fdb 100644 --- a/application/palemoon/components/downloads/content/contentAreaDownloadsView.xul +++ b/application/palemoon/components/downloads/content/contentAreaDownloadsView.xul @@ -1,8 +1,8 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/downloads/content/downloadsOverlay.xul b/application/palemoon/components/downloads/content/downloadsOverlay.xul index 0ef3d03cb9..8dc8148bbc 100644 --- a/application/palemoon/components/downloads/content/downloadsOverlay.xul +++ b/application/palemoon/components/downloads/content/downloadsOverlay.xul @@ -1,8 +1,7 @@ -# -*- Mode: HTML; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/pageinfo/pageInfo.xul b/application/palemoon/components/pageinfo/pageInfo.xul index 53b04916e1..35f331ab61 100644 --- a/application/palemoon/components/pageinfo/pageInfo.xul +++ b/application/palemoon/components/pageinfo/pageInfo.xul @@ -1,7 +1,7 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/places/content/history-panel.xul b/application/palemoon/components/places/content/history-panel.xul index 974075758e..bcc581a601 100644 --- a/application/palemoon/components/places/content/history-panel.xul +++ b/application/palemoon/components/places/content/history-panel.xul @@ -1,8 +1,8 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/places/content/menu.xml b/application/palemoon/components/places/content/menu.xml index 45ae403f9b..0fed40966b 100644 --- a/application/palemoon/components/places/content/menu.xml +++ b/application/palemoon/components/places/content/menu.xml @@ -1,8 +1,8 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/places/content/sidebarUtils.js b/application/palemoon/components/places/content/sidebarUtils.js index a135530214..9a2660bd67 100644 --- a/application/palemoon/components/places/content/sidebarUtils.js +++ b/application/palemoon/components/places/content/sidebarUtils.js @@ -1,7 +1,7 @@ -# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. +// -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. var SidebarUtils = { handleTreeClick: function(aTree, aEvent, aGutterSelect) { diff --git a/application/palemoon/components/preferences/advanced.js b/application/palemoon/components/preferences/advanced.js index 9986ca1e7e..a399b509a0 100644 --- a/application/palemoon/components/preferences/advanced.js +++ b/application/palemoon/components/preferences/advanced.js @@ -1,7 +1,6 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. // Load DownloadUtils module for convertByteUnits Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); diff --git a/application/palemoon/components/preferences/advanced.xul b/application/palemoon/components/preferences/advanced.xul index 82db77605c..ec6f5689fd 100644 --- a/application/palemoon/components/preferences/advanced.xul +++ b/application/palemoon/components/preferences/advanced.xul @@ -1,9 +1,8 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/preferences/applicationManager.js b/application/palemoon/components/preferences/applicationManager.js index 1ff2528f57..43558c156a 100644 --- a/application/palemoon/components/preferences/applicationManager.js +++ b/application/palemoon/components/preferences/applicationManager.js @@ -1,6 +1,6 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. var gAppManagerDialog = { _removed: [], diff --git a/application/palemoon/components/preferences/applications.js b/application/palemoon/components/preferences/applications.js index 2f360de2e5..3751ee7325 100644 --- a/application/palemoon/components/preferences/applications.js +++ b/application/palemoon/components/preferences/applications.js @@ -1,9 +1,6 @@ -/* -# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. //****************************************************************************// // Constants & Enumeration Values diff --git a/application/palemoon/components/preferences/colors.xul b/application/palemoon/components/preferences/colors.xul index e2c1e5959d..055b7dcaa4 100644 --- a/application/palemoon/components/preferences/colors.xul +++ b/application/palemoon/components/preferences/colors.xul @@ -1,9 +1,8 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/preferences/connection.js b/application/palemoon/components/preferences/connection.js index da038c925b..f94819d3f0 100644 --- a/application/palemoon/components/preferences/connection.js +++ b/application/palemoon/components/preferences/connection.js @@ -1,7 +1,6 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. var gConnectionsDialog = { beforeAccept: function () diff --git a/application/palemoon/components/preferences/connection.xul b/application/palemoon/components/preferences/connection.xul index 67d10d2836..e21168652d 100644 --- a/application/palemoon/components/preferences/connection.xul +++ b/application/palemoon/components/preferences/connection.xul @@ -1,9 +1,8 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/preferences/content.js b/application/palemoon/components/preferences/content.js index 5ae84c2f70..62a675c92b 100644 --- a/application/palemoon/components/preferences/content.js +++ b/application/palemoon/components/preferences/content.js @@ -1,7 +1,6 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. var gContentPane = { diff --git a/application/palemoon/components/preferences/cookies.js b/application/palemoon/components/preferences/cookies.js index a98f21a5ca..dbc2b3ef60 100644 --- a/application/palemoon/components/preferences/cookies.js +++ b/application/palemoon/components/preferences/cookies.js @@ -1,7 +1,6 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. const nsICookie = Components.interfaces.nsICookie; diff --git a/application/palemoon/components/preferences/cookies.xul b/application/palemoon/components/preferences/cookies.xul index 2ced525352..8dd757fd0c 100644 --- a/application/palemoon/components/preferences/cookies.xul +++ b/application/palemoon/components/preferences/cookies.xul @@ -1,9 +1,8 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/preferences/fonts.js b/application/palemoon/components/preferences/fonts.js index e9f93a2d15..975671a6e9 100644 --- a/application/palemoon/components/preferences/fonts.js +++ b/application/palemoon/components/preferences/fonts.js @@ -1,7 +1,6 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. // browser.display.languageList LOCK ALL when LOCKED diff --git a/application/palemoon/components/preferences/fonts.xul b/application/palemoon/components/preferences/fonts.xul index 38314f8ff3..1c14bcf91b 100644 --- a/application/palemoon/components/preferences/fonts.xul +++ b/application/palemoon/components/preferences/fonts.xul @@ -1,9 +1,8 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/preferences/languages.js b/application/palemoon/components/preferences/languages.js index 8d2b3948cd..5b8ea38a65 100644 --- a/application/palemoon/components/preferences/languages.js +++ b/application/palemoon/components/preferences/languages.js @@ -1,7 +1,6 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. var gLanguagesDialog = { diff --git a/application/palemoon/components/preferences/languages.xul b/application/palemoon/components/preferences/languages.xul index 45521860cc..bd74e11cfe 100644 --- a/application/palemoon/components/preferences/languages.xul +++ b/application/palemoon/components/preferences/languages.xul @@ -1,9 +1,8 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/preferences/main.js b/application/palemoon/components/preferences/main.js index 07e09fff39..1fc46679de 100644 --- a/application/palemoon/components/preferences/main.js +++ b/application/palemoon/components/preferences/main.js @@ -1,7 +1,6 @@ -/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon", diff --git a/application/palemoon/components/preferences/main.xul b/application/palemoon/components/preferences/main.xul index 78a5d3b546..16b784cdd7 100644 --- a/application/palemoon/components/preferences/main.xul +++ b/application/palemoon/components/preferences/main.xul @@ -1,9 +1,8 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/preferences/newtaburl.js b/application/palemoon/components/preferences/newtaburl.js index 3c82df8460..211d9b90a2 100644 --- a/application/palemoon/components/preferences/newtaburl.js +++ b/application/palemoon/components/preferences/newtaburl.js @@ -1,6 +1,6 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. var gNewtabUrl = { /** diff --git a/application/palemoon/components/preferences/preferences.xul b/application/palemoon/components/preferences/preferences.xul index ee28c60028..b56b16ecc3 100644 --- a/application/palemoon/components/preferences/preferences.xul +++ b/application/palemoon/components/preferences/preferences.xul @@ -1,9 +1,8 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/preferences/privacy.js b/application/palemoon/components/preferences/privacy.js index ab5c37ee2f..7b319c3ee6 100644 --- a/application/palemoon/components/preferences/privacy.js +++ b/application/palemoon/components/preferences/privacy.js @@ -1,7 +1,6 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); diff --git a/application/palemoon/components/preferences/sanitize.js b/application/palemoon/components/preferences/sanitize.js index 15e6f58f48..4383bee4fb 100644 --- a/application/palemoon/components/preferences/sanitize.js +++ b/application/palemoon/components/preferences/sanitize.js @@ -1,7 +1,6 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. var gSanitizeDialog = Object.freeze({ onClearHistoryChanged: function () { diff --git a/application/palemoon/components/preferences/security.js b/application/palemoon/components/preferences/security.js index 54fab68ac1..d8f491b1cb 100644 --- a/application/palemoon/components/preferences/security.js +++ b/application/palemoon/components/preferences/security.js @@ -1,7 +1,6 @@ -/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper", "resource://gre/modules/LoginHelper.jsm"); diff --git a/application/palemoon/components/preferences/selectBookmark.js b/application/palemoon/components/preferences/selectBookmark.js index dbbdb4ff6d..ba468646cb 100644 --- a/application/palemoon/components/preferences/selectBookmark.js +++ b/application/palemoon/components/preferences/selectBookmark.js @@ -1,7 +1,6 @@ -//* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. /** * SelectBookmarkDialog controls the user interface for the "Use Bookmark for diff --git a/application/palemoon/components/preferences/sync.js b/application/palemoon/components/preferences/sync.js index f29728dbfc..e4071fbacf 100644 --- a/application/palemoon/components/preferences/sync.js +++ b/application/palemoon/components/preferences/sync.js @@ -1,6 +1,6 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. Components.utils.import("resource://services-sync/main.js"); Components.utils.import("resource://gre/modules/Services.jsm"); diff --git a/application/palemoon/components/preferences/tabs.js b/application/palemoon/components/preferences/tabs.js index b09cb60dfb..8110642918 100644 --- a/application/palemoon/components/preferences/tabs.js +++ b/application/palemoon/components/preferences/tabs.js @@ -1,7 +1,6 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. var gTabsPane = { diff --git a/application/palemoon/components/preferences/tabs.xul b/application/palemoon/components/preferences/tabs.xul index 64529d60d6..1f7a2a9e3b 100644 --- a/application/palemoon/components/preferences/tabs.xul +++ b/application/palemoon/components/preferences/tabs.xul @@ -1,9 +1,8 @@ -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml b/application/palemoon/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml index 4bf5140c9b..03347d3580 100644 --- a/application/palemoon/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml +++ b/application/palemoon/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml @@ -1,8 +1,8 @@ diff --git a/application/palemoon/components/search/content/search.xml b/application/palemoon/components/search/content/search.xml index d032a1cfa6..eccaa072aa 100644 --- a/application/palemoon/components/search/content/search.xml +++ b/application/palemoon/components/search/content/search.xml @@ -1,8 +1,7 @@ -# -*- Mode: HTML -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. + diff --git a/application/palemoon/components/shell/content/setDesktopBackground.xul b/application/palemoon/components/shell/content/setDesktopBackground.xul index e05f119dae..1bd781fea4 100644 --- a/application/palemoon/components/shell/content/setDesktopBackground.xul +++ b/application/palemoon/components/shell/content/setDesktopBackground.xul @@ -1,8 +1,8 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. +