The expectation is that the blurring would eventually result in an IPC message
doing this anyway, but this doesn't happen if the focus is in OOP iframe which
won't try to bounce an IPC message to its parent frame.
Differential Revision: https://phabricator.services.mozilla.com/D93210
This changes the way we deal with page use counters so that we can
handle out of process iframes.
Currently, when a parent document is being destroyed, we poke into all
of the sub-documents to merge their use counters into the parent's page
use counters, which we then report via Telemetry. With Fission enabled,
the sub-documents may be out of process. We can't simply turn these
into async IPC calls, since the parent document will be destroyed
shortly, as might the content processes holding the sub-documents.
So instead, each document during its initialization identifies which
ancestor document it will contribute its page use counters to, and
stores its WindowContext id to identify that ancestor. A message is
sent to the parent process to notify it that page use counter data will
be sent at some later point. That later point is when the document
loses its window. It doesn't matter if the ancestor document has
already been destroyed at this point, since all we need is its
WindowContext id to uniquely identify it. Once the parent process has
received all of the use counters it expects to accumulate to a given
WindowContext Id, it reports them via Telemetry.
Reporting of document use counters remains unchanged and is done by each
document in their content process.
While we're here, we also:
* Limit use counters to be reported for a pre-defined set of document
URL schemes, rather than be based on the document principal.
* Add proper MOZ_LOG logging for use counters instead of printfs.
Differential Revision: https://phabricator.services.mozilla.com/D87188
This is mostly a revert of the patch in bug 1425686 that removed the old
probe, but rebased to new code locations and clang-formatted. The histogram
entry is also updated with new bug numbers and fields.
The next patch will refine some of these telemetry recording points; the patch
is split into two for easier reviewing as this part is basically what landed
originally.
Differential Revision: https://phabricator.services.mozilla.com/D92995
There is similar API in `Document`, but they indicate whether a node has been
observed by any mutation receiver, not only by `MutationObserver` of JS.
However, I'd like to know the percentage of web apps which use
`MutationObserver`, but not use `beforeinput` events. Therefore, this patch
adds similar API into `nsPIDOMWindowInner` as same as `beforeinput` and
ignores `MutationObserver`s which are created by chrome script and addons.
Differential Revision: https://phabricator.services.mozilla.com/D92547
When `HTMLEditor` instances are destroyed, I'd like to collect how much
instances are worked with `beforeinput` event listeners. Before adding such
telemetry probe, this patch adds methods to set/get whether a `beforeinput`
event listener has had added or not to `nsPIDOMWindowInner`.
Differential Revision: https://phabricator.services.mozilla.com/D92546
In order to avoid over/under-counting, we need to treat window.print()
specially. The new UI was using aOpenWindowInfo.isForPrintPreview for
that, but that doesn't quite work for the old UI (because it will
trigger a regular print, not a preview).
But since isForPrintPreview was only really needed to distinguish
window.print(), just rename it and set it to true when the old UI is
triggered by window.print() as well.
Differential Revision: https://phabricator.services.mozilla.com/D92925
This patch tries to mark root callers of `nsINode::GetSelectionRootContent()`
which calls `nsINode::GetAnonymousRootElementOfTextEditor()` as far as possible
(and reasonable).
It's used by `ContentEventHandler` so that a lot of methods of
`EventStateManager`, `ContentEventHandler`, `IMEContentObserver` which are main
users of it are also marked as `MOZ_CAN_RUN_SCRIPT`. I think that this is
reasonable.
On the other hand, it might not be reasonable to mark `IMEStateManager` methods
as `MOZ_CAN_RUN_SCRIPT` for initializing `IMEContentObserver` because
`IMEStateManager` may be able to initialize `IMEContentObserver` asynchronously
and its root callers are in XUL layout code. Therefore, this patch uses
`MOZ_CAN_RUN_SCRIPT_BOUNDARY` for `IMEStateManager` at least for now.
Differential Revision: https://phabricator.services.mozilla.com/D92730
It was designed for retrieving associated `TextEditor` and its root content
(anonymous `<div>` element) if the node is in native anonymous subtree in a
text editor or if the node itself is a `TextControlElement`. Additionally,
`TextControlElement` cannot be nested. Therefore, it can stop climbing up the
DOM tree when it meets a `TextControlElement`.
Then, we can rewrite this without a loop implemented by itself. Instead,
it can use `GetClosestNativeAnonymousSubtreeRootParent()` when the node is
in native anonymous subtree. Otherwise, it just needs to check whether it's
a `TextControlElement` or not. Therefore, we can make it stop using
`InclusiveAncestorsOfType`.
Finally, it calls `TextControlElement::GetTextEditor()` which is marked as
`MOZ_CAN_RUN_SCRIPT`. And I think that it may cause running selection
listeners (mutation event listeners won't run because changes occur only in
the native anonymous subtree). Therefore, we should mark all callers of
it with `MOZ_CAN_RUN_SCRIPT` later.
Differential Revision: https://phabricator.services.mozilla.com/D92728
This patch tries to mark root callers of `nsINode::GetSelectionRootContent()`
which calls `nsINode::GetAnonymousRootElementOfTextEditor()` as far as possible
(and reasonable).
It's used by `ContentEventHandler` so that a lot of methods of
`EventStateManager`, `ContentEventHandler`, `IMEContentObserver` which are main
users of it are also marked as `MOZ_CAN_RUN_SCRIPT`. I think that this is
reasonable.
On the other hand, it might not be reasonable to mark `IMEStateManager` methods
as `MOZ_CAN_RUN_SCRIPT` for initializing `IMEContentObserver` because
`IMEStateManager` may be able to initialize `IMEContentObserver` asynchronously
and its root callers are in XUL layout code. Therefore, this patch uses
`MOZ_CAN_RUN_SCRIPT_BOUNDARY` for `IMEStateManager` at least for now.
Differential Revision: https://phabricator.services.mozilla.com/D92730
It was designed for retrieving associated `TextEditor` and its root content
(anonymous `<div>` element) if the node is in native anonymous subtree in a
text editor or if the node itself is a `TextControlElement`. Additionally,
`TextControlElement` cannot be nested. Therefore, it can stop climbing up the
DOM tree when it meets a `TextControlElement`.
Then, we can rewrite this without a loop implemented by itself. Instead,
it can use `GetClosestNativeAnonymousSubtreeRootParent()` when the node is
in native anonymous subtree. Otherwise, it just needs to check whether it's
a `TextControlElement` or not. Therefore, we can make it stop using
`InclusiveAncestorsOfType`.
Finally, it calls `TextControlElement::GetTextEditor()` which is marked as
`MOZ_CAN_RUN_SCRIPT`. And I think that it may cause running selection
listeners (mutation event listeners won't run because changes occur only in
the native anonymous subtree). Therefore, we should mark all callers of
it with `MOZ_CAN_RUN_SCRIPT` later.
Differential Revision: https://phabricator.services.mozilla.com/D92728
Where an adjustment (to reflect a delta between the APZ and layout
scroll offsets) is necessary, the inputs needed to compute the
adjustment are stored with the margins, and the adjustment is
applied at query time.
A couple of notes on this patch:
* Storing DisplayPortMargins::mLayoutOffset is probably unnecessary,
we should be able to just query the scroll frame's layout offset
when applying the margins.
* Some callers of DisplayPortMargins::WithNoAdjustment() may be
incorrect, in that they pass in margins that are relative to the
visual viewport but do not make a corresponding adjustment.
This is a pre-existing issue that this patch just makes clearer.
As this is a regression-prone area, this patch is careful to avoid
making any functional changes, leaving the above issues to be
addressed in future bugs.
Differential Revision: https://phabricator.services.mozilla.com/D92506
The comment should be self-descriptive. We keep cloning the doc sync and
the UI will preview that doc, so it works out nicely and we do less
work.
Differential Revision: https://phabricator.services.mozilla.com/D92806
The browsing context group id needs to be an 64-bit integer. Otherwise
when having a browsing context created by a child process, if it goes
over INT32_MAX, parsing fails, and we end up creating a new BCG, which
can end up in the wrong process, etc.
Differential Revision: https://phabricator.services.mozilla.com/D92803
The telemetry probe was added in bug 1506434, and it's not necessary anymore
because of the event in the default group was completely disabled in
bug 1288640 (Gecko 65).
Therefore, we can get rid of the pref, and we can take back a room for a
bool member in `nsPIDOMWindowInner` for new telemetry probes which need
to know whether a specific event listener has been added or not.
Depends on D92395
Differential Revision: https://phabricator.services.mozilla.com/D92397
Thanks for asking me to add a test ;)
Using the image responsive selector works for scanning the srcset images, but
since we wouldn't rewrite the <source> uris the invalid urls would still have
preference.
Differential Revision: https://phabricator.services.mozilla.com/D92264
Rewrite the srcset URIs appropriately...
This code was completely untested (modulo one test for forms...) I added a
generic reftest framework to compare original vs. persisted document, so that
testing changes to this code is easier next time.
Differential Revision: https://phabricator.services.mozilla.com/D92133
Thanks for asking me to add a test ;)
Using the image responsive selector works for scanning the srcset images, but
since we wouldn't rewrite the <source> uris the invalid urls would still have
preference.
Differential Revision: https://phabricator.services.mozilla.com/D92264
Rewrite the srcset URIs appropriately...
This code was completely untested (modulo one test for forms...) I added a
generic reftest framework to compare original vs. persisted document, so that
testing changes to this code is easier next time.
Differential Revision: https://phabricator.services.mozilla.com/D92133