BrowserTestUtils.browserLoaded() wants a tabbrowser-tab as input, most of it will
also work passing gBrowser, and indeed some tests ended up doing that.
Unfortunately some parts of it are skipped in that case.
Since it's confusing anyway, let's make it more lenient on its input.
Differential Revision: https://phabricator.services.mozilla.com/D188212
BrowserTestUtils.loadURIString() is not async, nor returning a promise, it's
effectively not awaiting for the page to be loaded.
Differential Revision: https://phabricator.services.mozilla.com/D188211
We're inserting `MToDouble` for a `MIRType::Float32` value. This is similar to
the `MToFloat32` case we were already handling.
Longer term it would be nicer to do the float32 analysis as a separate optimization
pass instead of doing it at the same time as type analysis.
Depends on D188110
Differential Revision: https://phabricator.services.mozilla.com/D188111
We failed the assertion in `unboxObjectInfallible` while adding an unbox for
`MCreateThis` in the transpiler. In this case we fail an earlier guard at
runtime, but at compile time we don't know that and can still get a non-Object/Value
type at a later point.
Differential Revision: https://phabricator.services.mozilla.com/D188110
Invalidating a relative selector requires traversal in the opposite direction of
the usual invalidation, i.e. In the directions of ancestor and/or earlier sibling.
However, when there are complex selectors within the relative selector, e.g.
`:has(:is(..) ..)`, we first need to perform invalidation in the usual direction to
reach the relative selector's search space, then perform the relative selector
invalidation.
There are two major changes to this effect:
1. `InvalidationProcessor` has an additional lifetime that separates matching context from
invalidations. This enables storing encountered dependencies (Since we may be in a deep recursion
during the invalidation) to be relative selector invalidated, without requiring that the
matching context live that long.
2. There now exists a separate category for relative selector invalidation depenedencies,
which triggers relative selector invalidation. Dependencies now can be either normal or
relative, since any complex selector inside a relative selector would have normal
dependencies, but with its outer dependency being a relative dependency.
Differential Revision: https://phabricator.services.mozilla.com/D185675
`putAsciiPrintable` was added temporarily as a substitute for externalizing the
logic done by `QuoteString`, while providing an interface which is as efficient.
Now, `EscapePrinter` is used to replace the content of `QuoteString` while
providing the same implementation, except that it is based on `put` instead of
`putAsciiPrintable`. The `EscapePrinter` already provides the guarantees that
are asserted by `putAsciiPrintable`, thus there is no longer any need for it.
As this patch set introduced `putAsciiPrintable`, there is not yet any external
consumer of it, and `EscapePrinter` should cover all use cases where non-ascii
inputs are provided.
Differential Revision: https://phabricator.services.mozilla.com/D183760
The previous patch reimplemented QuoteString to use a `StringSegmentRange`,
which should avoid mutating the inner parts of `JSRope`, while remaining fast on
`JSAtom`-s.
As the StringSegmentRange does not need to allocate with `ensureLinear`, then
all the failures are reported by the `put` functions using the `GenericPrinter`
mechanism, and the `release` functions of `Sprinter` would report the failure if
any.
Thus, there is no need for retuning a boolean value anymore from `QuoteString`
and `JSONQuoteString`, while this is still necessary to check the returned value
variant of `QuoteString` which returns `UniqueChars` by using the `release`
function of `Sprinter`.
Differential Revision: https://phabricator.services.mozilla.com/D183759
`QuoteString` is today only available as a mean to serialize a `JSString` to a
`Sprinter`, or by making an extra temporary allocation whch is most likely
discarded once the serialized content has been used once.
This implementation provide a generic escaping mechanism, named `EscapePrinter`,
which can be used on top of any existing Printer class, and with any escaping
logic such as different quotes, or different quotation marks if needed. The
different quoting strategies are implemented using a class which provides
`isSafeChar` and `convertInto` to normalize the `JSString` input characters into
characters which are properly encoded for the Printer.
This change keep the original `QuoteString` behavior, while replacing its
fallible implementation by an infallible implementation. `QuoteString` had an
undocummented side-effect of linearizing the strings while reading them, which
causes memory allocation and potential GC failures. This change replaces the
`ensureLinear` call by the new `GenericPrinter::putString` function which relies
on `StringSegmentRange` to iterate over the string fragments and serialize the
content which does not have the same side-effects.
If performance issue arise from this modification, calls to `ensureLinear`
should be added before the `QuoteString` calls.
Differential Revision: https://phabricator.services.mozilla.com/D183758
`putString` requires a JSContext, and it is taken out of Sprinter, which does
not make much sense. Making it explicit that a JSContext is required to print
JSString would make things simpler for users instead of failing during the
execution.
Differential Revision: https://phabricator.services.mozilla.com/D187202
Sprinter::jsprintf is nowadays the same as GenericPrinter::printf which Sprinter
inherit from. This patch removes all calls to Sprinter::jsprintf and replaces
them by Sprinter::printf.
The advantage of using GenericPrinter::printf is that this reduce the dependency
on Sprinter-specific interface and moves us toward being able to move more
consumers over to the GenericPrinter.
Differential Revision: https://phabricator.services.mozilla.com/D181500
Now that Sprinter::put and Sprinter::jsprintf functions are infallible, there is
no need to return a boolean from Nursery::printProfileDurations and
Statistics::printProfileTimes functions.
Differential Revision: https://phabricator.services.mozilla.com/D181499
Remove the boolean returned value of printing functions of the GenericPrinter
and all descendant classes.
The goal being that error checking is the responsibility of the wrapping
function in charge of the GenericPrinter, and that functions in charge of
providing content should assume that everything is always written successfully.
This patch only look at the GenericPrinter methods, consumers of these functions
would be updated in subsequent patches.
Differential Revision: https://phabricator.services.mozilla.com/D181498
As we are going to remove the returned value, and to be extra cautious, we skip
future re-entry in case of previous failures.
Differential Revision: https://phabricator.services.mozilla.com/D181497
As functions are made infallible, only the 2 release functions are reporting
errors. The advantage of this approach is that the error reporting and checking
would only happen in the release functions calls in the future. This enables
the upcoming set of patches to change the return type of put functions to make
them infallible, reduce the number of visible branches in debugging code.
This makes the Sprinter class more like a "Sink allocator", where the smell of
allocation failures does not propagate immediatly through the sinking water until
all the water has been through.
Differential Revision: https://phabricator.services.mozilla.com/D181496
When using Sprinter::string, one assumes that out-of-memory errors have been
reported earlier. As the code is being converted to be infallible, the
out-of-memory is thus needed when the release function is called. This change
replaces all Sprinter::string by Sprinter::release and explicit the error
checking code path which would be relevant when the Sprinter::put function would
become infallible in follow-up patches.
Differential Revision: https://phabricator.services.mozilla.com/D181495
Sprinter::releaseJS centralize a mechanism which used in many places across the
JS engine, and replaces it with a single function call as well as democratising
the proper handling of UTF8 which might be added to Sprinter allocated strings.
Differential Revision: https://phabricator.services.mozilla.com/D181494