Commit Graph

222 Commits

Author SHA1 Message Date
Tooru Fujisawa
d8c21fafdb Bug 1843789 - Part 3: Rewrite testing/mochitest/BrowserTestUtils/BrowserTestUtils.sys.mjs consumers in html/xhtml to use ChromeUtils.importESModule. r=ahal,fxview-reviewers,sfoster
Differential Revision: https://phabricator.services.mozilla.com/D183659
2023-07-18 23:06:30 +00:00
Emilio Cobos Álvarez
4cc6758558 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
Kris Maglione
fbc33fd683 Bug 1648545: Part 2 - Load SpecialPowers in XPCShellContentUtils. r=ahal,application-update-reviewers,nalexander,devtools-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D119449
2023-05-27 03:46:44 +00:00
Mark Banner
8219a5c503 Bug 1826062 - Automatic fixes for Prettier 2.0.5 upgrade. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,owlish
Differential Revision: https://phabricator.services.mozilla.com/D177025
2023-05-20 12:26:49 +00:00
Greg Tatum
a5ebe9f40b Bug 1830989 - Add a document.l10n.setArgs method; r=webidl,smaug,eemeli
Differential Revision: https://phabricator.services.mozilla.com/D176958
2023-05-08 14:24:54 +00:00
Emilio Cobos Álvarez
f2c33f7f71 Bug 1823915 - Ensure that we have a pending flush when blocking load. r=smaug
Consider the following sequence of events:

 * We do an l10n mutation -> mBlockingLoad=true, mPendingMutations.Size() = 1
 * That flush triggers a promise -> mBlockingLoad=true, mPendingMutations.Size() = 0, mPendingPromises=1
 * Another mutation happens -> mBlockingLoad=true, mPendingMutations.Size() = 1, mPendingPromises = 1
 * The promise resolves -> mBlockingLoad=true, mPendingMutations.Size() = 1, mPendingPromises=0

Key part there is that the second mutation didn't post a task to flush,
so we rely on the refresh driver (which is not reliable on Wayland as
described in the comment).

Instead, we need to track the pending flush separately from the blocking
load.

Differential Revision: https://phabricator.services.mozilla.com/D174624
2023-04-04 13:52:39 +00:00
Emilio Cobos Álvarez
75b298315d Bug 1819664 - Block onload on pending l10n mutations. r=smaug,Gijs
Remove custom code doing this for <dialog>.

Differential Revision: https://phabricator.services.mozilla.com/D171475
2023-03-04 00:04:45 +00:00
Emilio Cobos Álvarez
f3f4f3270c Bug 1819664 - Notify chrome docs when async translation work is done. r=smaug,Gijs
This prototypes the proposal in bug 1738056 comment 22.

Depends on D171359

Differential Revision: https://phabricator.services.mozilla.com/D171360
2023-03-04 00:04:21 +00:00
Emilio Cobos Álvarez
3d49ec4825 Bug 1819664 - Fix unsettled promise handling in Localization. r=smaug
Otherwise we have some promises that may never resolve. This causes
issues in
toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html with
the previous patch, for example.

Differential Revision: https://phabricator.services.mozilla.com/D171564
2023-03-03 22:18:11 +00:00
Emilio Cobos Álvarez
11ccf4bd21 Bug 1819664 - Other drive-by cleanups in L10nMutations. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D171494
2023-03-03 10:03:42 +00:00
Emilio Cobos Álvarez
f18db8cf1b Bug 1819664 - Cleanup some DOMLocalization methods that can't throw. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D171482
2023-03-02 18:15:10 +00:00
Ms2ger
3f2d0f2321 Bug 1819287 - Make nsContentUtils::StringifyJSON more flexible; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D171215
2023-03-02 15:47:40 +00:00
Ms2ger
ead15dfc06 Bug 1819287 - Pass an immutable Handle to nsContentUtils::StringifyJSON; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D171212
2023-03-02 15:47:38 +00:00
Emilio Cobos Álvarez
67cde8c9d2 Bug 1819664 - Cleanup mutation pending elements. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D171359
2023-03-02 12:36:55 +00:00
Joel Maher
a62ef05cdb Bug 1816191 - Skip tests in order to keep win7 running @ azure. r=gbrown,necko-reviewers,settings-reviewers,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,nalexander,sgalich,alwu
Differential Revision: https://phabricator.services.mozilla.com/D169523
2023-02-14 23:44:12 +00:00
Eemeli Aro
7f665345c4 Bug 1801716 - Switch the id/attr set order in DOMLocalization::SetAttributes. r=Gijs
`l10n.setAttributes` should work atomically, so a failure in handling l10n args does not allow for the l10n id be set by itself.

Differential Revision: https://phabricator.services.mozilla.com/D167147
2023-01-19 16:47:19 +00:00
Gijs Kruitbosch
522c895c0f Bug 1809902 - make fluent sanitization of innerHTML assignments explicit to avoid DEBUG MOZ_CRASH, r=eemeli
Differential Revision: https://phabricator.services.mozilla.com/D167139
2023-01-18 13:07:44 +00:00
Greg Tatum
5523bbefcd Bug 1802690 - Re-work error handling DocumentL10n::TranslateDocument; r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D163264
2022-12-16 17:43:08 +00:00
Manuel Bucher
0c14644dbb Bug 1788135 - Fix "Assertion failure: !IsDOMException()" when running with rr r=platform-i18n-reviewers,gregtatum
This only fixes the crash, not the root cause of the error.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1788135#c16

Differential Revision: https://phabricator.services.mozilla.com/D163833
2022-12-08 12:02:20 +00:00
Greg Tatum
271b13ac1e Bug 1803615 - Ignore empty strings for fluent data-l10n-args; r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D163612
2022-12-02 18:53:27 +00:00
Jan-Niklas Jaeschke
4265f72859 Bug 1777925: Replaced MutationObserver array container type with linked list. r=smaug
Deletion of mutation observers from a list resulted in O(n^2) behavior and could lead to massive freezes.
This is resolved by using a LinkedList instead, reducing complexity to O(n).

A safely iterable doubly linked list was implemented based on `mozilla::DoublyLinkedList`,
allowing to insert and remove elements while iterating the list.

Due to the nature of `mozilla::DoublyLinkedList`, every Mutation Observer now inherits `mozilla::DoublyLinkedListElement<T>`.
This implies that a Mutation Observer can only be part of one DoublyLinkedList.
This conflicts with some Mutation Observers, which are being added to multiple `nsINode`s.
To continue supporting this, new MutationObserver base classes `nsMultiMutationObserver` and `nsStubMultiMutationObserver` are introduced,
which create `MutationObserverWrapper` objects each time they are added to a `nsINode`.
The wrapper objects forward every call to the actual observer.

Differential Revision: https://phabricator.services.mozilla.com/D157031
2022-09-21 11:31:44 +00:00
justchen1369
4743055749 Bug 1789765 - Fix broken links to 'Fluent for Firefox Developers' page. r=firefox-source-docs-reviewers,marco DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D156761
2022-09-08 19:03:25 +00:00
Mark Banner
783a2f2187 Bug 1788037 - Turn on ESLint rule for prefer-boolean-length-check for dom. r=asuth,karlt
Differential Revision: https://phabricator.services.mozilla.com/D155965
2022-09-02 11:05:17 +00:00
Anna Yeddi
f0cb8e8faf Bug 1761893 - Remove aria-valuetext from a list of localisable attributes. r=smaug,nordzilla,Jamie,eemeli
`Aria-valuetext` attribute is expected to be mutated with each change of user's input, thus it does not have to be listed as localizable attribute.

Also, this approach removes pre-selected value from the DOM on init of a component like a spinbutton, preventing users of assistive technology from accessing human-readable value that was pre-selected and is present on-screen.

Updating a patch to ensure [the fix for bug 1779625](https://bugzilla.mozilla.org/show_bug.cgi?id=1779625) is still working after the change per discussion in Bugzilla.

Differential Revision: https://phabricator.services.mozilla.com/D142371
2022-08-18 17:09:54 +00:00
Mark Banner
7428be4a86 Bug 1782008 - Remove now unnecessary .eslintrc.js files. r=webcompat-reviewers,extension-reviewers,media-playback-reviewers,pip-reviewers,denschub,rpl,alwu,mossop
Differential Revision: https://phabricator.services.mozilla.com/D152736
2022-08-03 11:16:20 +00:00
Nika Layzell
c15823d075 Bug 1772006 - Part 5: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-07-30 00:12:48 +00:00
Tooru Fujisawa
52c95734e7 Bug 1667455 - Part 9: Stop importing Services.jsm from chrome-priv HTML code, single-line cases. r=kmag,necko-reviewers,geckoview-reviewers,extension-reviewers,m_kato,dragana
Differential Revision: https://phabricator.services.mozilla.com/D150898
2022-07-11 12:41:52 +00:00
criss
c6b2c5db61 Backed out 9 changesets (bug 1772006) causing build bustages on nsTString.cpp. CLOSED TREE
Backed out changeset f17c7565707b (bug 1772006)
Backed out changeset c725fe1f5882 (bug 1772006)
Backed out changeset d19663161261 (bug 1772006)
Backed out changeset b6611ab002d9 (bug 1772006)
Backed out changeset 790f42b64af9 (bug 1772006)
Backed out changeset 79a734b4e4d9 (bug 1772006)
Backed out changeset 42730aae16ea (bug 1772006)
Backed out changeset b2542aef3054 (bug 1772006)
Backed out changeset 962bfea4a309 (bug 1772006)
2022-06-11 01:13:42 +03:00
Nika Layzell
b3c13bf114 Bug 1772006 - Part 6: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-06-10 21:12:08 +00:00
Kagami Sascha Rosylight
36c4c2abca Bug 1768189 - Part 17: Apply modernize-concat-nested-namespaces to dom/ipc/URLClassifierParent.h ... r=andi
Depends on D145750

Differential Revision: https://phabricator.services.mozilla.com/D145751
2022-05-09 20:41:09 +00:00
Emilio Cobos Álvarez
063c03b0ec Bug 1751836 - Drive-by: Simplify L10nMutations::FlushPendingTranslations. r=dminor
Sequence can be downcasted to a const nsTArray, so we can clean up the
code a bit.

Depends on D145188

Differential Revision: https://phabricator.services.mozilla.com/D145189
2022-05-02 15:12:30 +00:00
Emilio Cobos Álvarez
3b2e45d7f8 Bug 1751836 - Ignore error properly in L10nMutations::FlushPendingTranslations(). r=Gijs
If we're dropping the ErrorResult on the floor we should use
IgnoredErrorResult.

Differential Revision: https://phabricator.services.mozilla.com/D145188
2022-05-01 22:54:10 +00:00
Emilio Cobos Álvarez
a26c4d2005 Bug 1751836 - Check for errors properly in DOMLocalization::TranslateRoots. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D145187
2022-05-01 22:54:09 +00:00
Peter Van der Beken
d9be07f2fd Bug 1766574 - Clean up generated DOM binding code. r=edgar
- Remove break-after-return
- Remove empty TraceUnion implementations
- Remove unused friend declaration
- Remove some whitespace

Differential Revision: https://phabricator.services.mozilla.com/D144856
2022-04-28 10:03:14 +00:00
Erik Nordin
89585cfcc9 Bug 1762476 - Validate promise existence in L10nMutations r=dminor
Validates that the TranslateElements promise exists before
attempting to append a native handler to it.

Differential Revision: https://phabricator.services.mozilla.com/D142619
2022-04-01 14:59:51 +00:00
Emilio Cobos Álvarez
7368ed48d3 Bug 1759925 - Allow aria-description as a globally safe l10n attribute. r=Gijs
We had precedents for this and it is safe to allow it everywhere.

Depends on D141276

Differential Revision: https://phabricator.services.mozilla.com/D141277
2022-03-16 23:03:49 +00:00
Emilio Cobos Álvarez
179992eeca Bug 1759925 - Make localization attributes marginally more efficient. r=Gijs,smaug
Avoid atom -> string conversions in a variety of somewhat common cases.

Differential Revision: https://phabricator.services.mozilla.com/D141276
2022-03-16 23:03:49 +00:00
Olli Pettay
371cbcd489 Bug 1751609, trigger localization at expected time, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D139311
2022-02-25 09:57:31 +00:00
Matthew Gaudet
bc10b96605 Bug 1748888 - Add ErrorResult parameter to PromiseNativeHandler callbacks r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D136423
2022-01-20 19:11:39 +00:00
Erik Nordin
d9a63c9302 Bug 1743659 - Part 2: Update Gecko's Localization to use the new l10nregistry-rs API r=zbraniecki,dminor,eemeli,smaug,emilio?,eemeli?,zbraniecki
- Updates Gecko's Fluent class to use the new ResourceId type,
  which can be either optional or required regarding a particular resource.
- Adds JS tests verifying the new behavior.

Differential Revision: https://phabricator.services.mozilla.com/D133579
2021-12-22 19:08:38 +00:00
Iulian Moraru
0a45909356 Backed out changeset 32fcd7e0fa05 (bug 1747115) for causing bp-hybrid build bustages on L10nMutations.cpp. 2021-12-22 13:58:35 +02:00
Calixte
9aa02bcfa7 Bug 1747115 - Avoid circular inclusion in L10nMutations.h r=platform-i18n-reviewers,nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D134428
2021-12-22 10:31:55 +00:00
Zibi Braniecki
7571521ff5 Bug 1742608 - Fix the new l10n mutations pending element removal tests. r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D131966
2021-11-23 21:05:31 +00:00
Zibi Braniecki
43e7482f95 Bug 1681984 - Remove elements from L10nMutation pendingElements when they're removed from observed roots. r=nordzilla,smaug
Differential Revision: https://phabricator.services.mozilla.com/D131292
2021-11-23 04:24:31 +00:00
Zibi Braniecki
3881c4ca80 Bug 1687118 - Bail early from DocumentL10n::TriggerInitialTranslation if mReady is not available. r=emilio,nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D131253
2021-11-17 23:31:45 +00:00
Zibi Braniecki
a15a9224b5 Bug 1687592 - Don't cache mRefreshDriver between L10nMutation observer calls. r=nordzilla,mstange
Differential Revision: https://phabricator.services.mozilla.com/D131278
2021-11-17 19:54:18 +00:00
Zibi Braniecki
8d28718532 Bug 1563128 - Handle broken l10n-args gracefully. r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D131251
2021-11-16 18:28:26 +00:00
Zibi Braniecki
1aa25b7d0b Bug 1739143 - Capture DOM L10n initial translation and mutations rejections and report to console. r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D130797
2021-11-10 23:40:43 +00:00
Butkovits Atila
7f1436e4bc Backed out changeset 4f859ea95ec6 (bug 1739143) for causing failures at document_l10n/non-system-principal/browser_resource_uri.js. CLOSED TREE 2021-11-10 02:14:34 +02:00
Zibi Braniecki
d32521c61b Bug 1739143 - Capture DOM L10n initial translation and mutations rejections and report to console. r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D130797
2021-11-09 23:10:26 +00:00