I believe the crashes are due to the metasources list being mutated
while the async iterators are running. This changes should fix this
issue if it is in fact the root cause. The scope of this patch is a bit
larger since it changes the implementation to use a proper MetaSources
struct.
This struct centralizes access and mutation to the MetaSources,
providing an ergonomic API that should be fairly idiomatic and similar
to other Rust APIs.
The Mutex is not needed as this code is not multi-threaded. The RefCell
should provide proper access controls for handling the mutation of the
MetaSources.
The MetaSources struct also favors a Vec<Vec<Rc<T>>> rather than
Vec<Vec<T>> so that it can be copied very cheaply for the async
iterators.
Differential Revision: https://phabricator.services.mozilla.com/D159446
This is probably the riskiest patch in the group, as it's touching the
core async iterator algorithm. The previous implementation relied on
pure match branches for handling things, but it made it awkward to share
some of the logic with a macro. I kept on running into issues with
refactoring tools not being able to work on the macro.
The changes here makes the code a bit more imperative, but I added
documentation of the current state that thing are in, so that it's
clearer where we were in the process of the algorithm.
This is a pure refactor and should not have any behavior changes.
Differential Revision: https://phabricator.services.mozilla.com/D159443
This is a bit of chore work, as the upcoming MetaSources struct will not
need access to this member, and it's simpler without it.
Differential Revision: https://phabricator.services.mozilla.com/D159442
Rust's definition of nsrefcnt is incorrect, so I'm eliminating uses of it
where possible. Nobody actually uses these return values, so remove them.
Differential Revision: https://phabricator.services.mozilla.com/D159320
There are only 3 places where nsMemory.h is still needed (image/RasterImage.cpp,
gfx/thebes/gfxFT2FontList.cpp, and nsMemory.cpp). Remove the rest.
Differential Revision: https://phabricator.services.mozilla.com/D158213
Nika pointed out that there are only two places that register
something, and only one place that uses it, so this entire module
can be turned into a couple of lines of a switch statement.
Differential Revision: https://phabricator.services.mozilla.com/D158132
These macros will produce better outputs when they fail than these existing
patterns using `ENSURE_TRUE(NS_SUCCEEDED(...))` or similar, so this is a bulk
rewrite of existing tests to use them.
It should also help with discoverability when people base their tests off of
other existing tests.
Differential Revision: https://phabricator.services.mozilla.com/D157214
This is actually exploiting an ICU bug, but ensures we return the same results
as other browsers. When the ICU bug has been fixed, we can revert this back to
"G".
Differential Revision: https://phabricator.services.mozilla.com/D156413
Migrating the strings used by the edit dialogs also allows/requires for their migration elsewhere.
Some streamlining is applied to how autofillEditForms.js gets access to e.g. FormFillUtils methods, so that they are no longer routed via the XHTML files' script tags. The prior independence of this file from internal dependencies appears to have been in place to support its use as a part of the Payments API's UI, but that was dropped in bug 1721229.
The Fluent migration script included in this patch also covers changes from the immediately preceding patch.
The intl documentation change is a typo correction that was noticed while working on this patch.
Differential Revision: https://phabricator.services.mozilla.com/D155705
Migrating the strings used by the edit dialogs also allows/requires for their migration elsewhere.
Some streamlining is applied to how autofillEditForms.js gets access to e.g. FormFillUtils methods, so that they are no longer routed via the XHTML files' script tags. The prior independence of this file from internal dependencies appears to have been in place to support its use as a part of the Payments API's UI, but that was dropped in bug 1721229.
The Fluent migration script included in this patch also covers changes from the immediately preceding patch.
The intl documentation change is a typo correction that was noticed while working on this patch.
Depends on D155478
Differential Revision: https://phabricator.services.mozilla.com/D155705
As part of installing the lang pack, add the negotiated language as string args and convert to raw if it wants to use the lang pack.
Differential Revision: https://phabricator.services.mozilla.com/D155021
For this to work, we need to add a move-constructor to `Locale`, so that it's
possible to write `loc = {}`. (We need move instead of copy semantics, because
`Locale` has UniquePtr members.) All other `Locale` members except for
`LanguageTagSubtag` already support move semantics. Add copy-constructors to
`LanguageTagSubtag`, so defaulted move-constructor/assignment works for `Locale`.
`LanguageTagSubtag` gets copy- instead of move-constructors, because there isn't
a good reason to disallow copying when moving is allowed.
Also add extra assertions and comments to document the requirement that `TryParse`
expects a new, empty `Locale`.
Differential Revision: https://phabricator.services.mozilla.com/D154496
This patch changes how nsConverterInputStream handles passing data
through to the underlying unicode converter in order to make it more
reliably handle propagating errors and deal with short reads from the
underlying input stream.
This was done by making the code continuously read within the Fill
method until at least one character has been decoded from the input
stream, so that we don't spuriously communicate an EOF to the caller due
to a short read not producing enough bytes for the decoder to produce a
UTF-16 character.
In addition, while making this change it became easier to signal to
the decoder about the final read from the input stream, meaning that
partial characters at the end of the stream will now generate a
replacement character, rather than being ignored.
Differential Revision: https://phabricator.services.mozilla.com/D152682
This patch changes how nsConverterInputStream handles passing data
through to the underlying unicode converter in order to make it more
reliably handle propagating errors and deal with short reads from the
underlying input stream.
This was done by making the code continuously read within the Fill
method until at least one character has been decoded from the input
stream, so that we don't spuriously communicate an EOF to the caller due
to a short read not producing enough bytes for the decoder to produce a
UTF-16 character.
In addition, while making this change it became easier to signal to
the decoder about the final read from the input stream, meaning that
partial characters at the end of the stream will now generate a
replacement character, rather than being ignored.
Differential Revision: https://phabricator.services.mozilla.com/D152682
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