This simplifies a two-part return statement into a single expression, while
also enforcing (via already_AddRefed) that the caller must not discard the
returned value.
Differential Revision: https://phabricator.services.mozilla.com/D298471
This is similar to the previous patch in this series, but now for spots where
the object gets stored in a nsCOMPtr rather than a RefPtr.
For these cases, I opted to use MakeAndAddRef instead of MakeRefPtr (though
either would work), because:
* The hypothetical statement `nsCOMPtr<Foo> a = MakeRefPtr<Foo>();` would risk
looking like a typo to humans, since it's explicitly making one kind of
pointer and then putting it in another kind of pointer).
* In contrast, MakeAndAddRef is less particular (in its name) about what flavor
of reference-counted pointer it's claiming to be producing (because it
returns an already_AddRefed<T>, which nsCOMPtr and nsRefPtr are both happy to
consume).
* We already follow this pattern in several other places, e.g. here:
https://searchfox.org/firefox-main/rev/a353242aeafd56b2c21a2c0672ecb51ea1b81142/dom/ipc/BrowserParent.cpp#3091
Differential Revision: https://phabricator.services.mozilla.com/D298453
This is a spec bug currently: https://github.com/w3c/event-timing/issues/123
When no paint is pending, event timing entries would stay in the pending
queue indefinitely until unrelated activity triggered a repaint. For
example, a keydown event on a div that doesn't trigger any paint. The
following patch adds a wpt test for this specifically.
Differential Revision: https://phabricator.services.mozilla.com/D288419
Fix also order-in-new-document-navigation.html to not rely on bogus ordering of
pageshow and pagereveal. Those events are dispatched by tasks from different task sources, so
the ordering isn't guaranteed. pageshow is dispatched from a task from DOM manipulation task source and
pagereveal from rendering task source.
Differential Revision: https://phabricator.services.mozilla.com/D278513
We wrap the list of timelines attached to the document into a controller,
so this makes it easier to support diffrerent types of timelines, e.g.
scroll-timeline.
We will add the implementation of scroll timelines in the following
patches.
Differential Revision: https://phabricator.services.mozilla.com/D269663
We wrap the list of timelines attached to the document into a controller,
so this makes it easier to support diffrerent types of timelines, e.g.
scroll-timeline.
We will add the implementation of scroll timelines in the following
patches.
Differential Revision: https://phabricator.services.mozilla.com/D269663
After the previous patches, nsViewManager is basically a backpointer to
its pres shell.
Remove it and just make PresShell manage the root view directly. After
this is done, we can decide what to do about nsView (which is itself
little more than a widget listener that forwards to pres shell right
now).
This technically starts listening to mParentWidget slightly later (on
pres shell creation), but I think that's ok.
Differential Revision: https://phabricator.services.mozilla.com/D272890
This changes the widget size constraints to be applied once per frame
before painting (like popups), but that seems acceptable.
Differential Revision: https://phabricator.services.mozilla.com/D272831
This changes the widget size constraints to be applied once per frame
before painting (like popups), but that seems acceptable.
Differential Revision: https://phabricator.services.mozilla.com/D272831
Local and global vsync sources can co-exist in the same (parent) process
on Wayland and macOS, since we have windowless browsers with no widgets,
and windows have their local vsync source, so we need to account for
them properly.
Differential Revision: https://phabricator.services.mozilla.com/D271157
This also drops the category argument. The category string was confusing
because it ends up a field of the marker and not the actual category which is
an enum. Having the category as a field isn't really helpful.
This also sets us up for unifying AUTO_PROFILER_MARKER and
AUTO_PROFILER_MARKER_UNTYPED which become basically the same.
Differential Revision: https://phabricator.services.mozilla.com/D269992
This also drops the category argument. The category string was confusing
because it ends up a field of the marker and not the actual category which is
an enum. Having the category as a field isn't really helpful.
This also sets us up for unifying AUTO_PROFILER_MARKER and
AUTO_PROFILER_MARKER_UNTYPED which become basically the same.
Differential Revision: https://phabricator.services.mozilla.com/D269992
This also drops the category argument. The category string was confusing
because it ends up a field of the marker and not the actual category which is
an enum. Having the category as a field isn't really helpful.
This also sets us up for unifying AUTO_PROFILER_MARKER and
AUTO_PROFILER_MARKER_UNTYPED which become basically the same.
Differential Revision: https://phabricator.services.mozilla.com/D269992
This also drops the category argument. The category string was confusing
because it ends up a field of the marker and not the actual category which is
an enum. Having the category as a field isn't really helpful.
This also sets us up for unifying AUTO_PROFILER_MARKER and
AUTO_PROFILER_MARKER_UNTYPED which become basically the same.
Differential Revision: https://phabricator.services.mozilla.com/D269992
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
Make the popup frame listener to the widget events itself, rather than
via the view tree.
This is a first step towards getting rid of views as a whole.
This creates the (annoying, but temporary) subtlety of the view tree
jumping across popups, so nsIFrame::GetNearestWidget and co need to
become a bit careful and avoid doing that.
Similarly a couple places relied on view visibility, which now need to
check nsMenuPopupFrame::IsOpen() as well.
Other than that this seems to just work.
Differential Revision: https://phabricator.services.mozilla.com/D230106
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.
It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).
Differential Revision: https://phabricator.services.mozilla.com/D261032
This reverts commit 8c929cc018.
Revert "Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot"
This reverts commit e01c0a6a32.
Revert "Bug 1979013 - Part 1: Eagerly fetch name for timer callbacks, r=xpcom-reviewers,mccr8"
This reverts commit 9f8e73c163.
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.
It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).
Differential Revision: https://phabricator.services.mozilla.com/D261032
In order to do this and keep tests passing, we need to also recurse into
external resource docs during the refresh driver tick.
Otherwise, we fail dom/smil/test/test_smilExtDoc.xhtml. This used to
work because the SMIL controller registered with the refresh driver
directly, and resource docs share the refresh driver with the parent
doc. I think it makes sense to treat them more like subdocuments, and it
also matches svg-as-image better.
This fixes some known SMIL bugs, too, yay.
Differential Revision: https://phabricator.services.mozilla.com/D246588
In order to do this and keep tests passing, we need to also recurse into
external resource docs during the refresh driver tick.
Otherwise, we fail dom/smil/test/test_smilExtDoc.xhtml. This used to
work because the SMIL controller registered with the refresh driver
directly, and resource docs share the refresh driver with the parent
doc. I think it makes sense to treat them more like subdocuments, and it
also matches svg-as-image better.
This fixes some known SMIL bugs, too, yay.
Differential Revision: https://phabricator.services.mozilla.com/D246588