зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1506434 - Add telemetry probe to collect how percentage users meet web apps which listens "text" event r=smaug
"text" event is Mozilla specific event, not in any standards. The event follows "compositionupdate" event and editor modifies composition string when receives the event in the system group. So, we'd like to stop dispatching this unnecessary event but we need to get actual usage in the web. Differential Revision: https://phabricator.services.mozilla.com/D11600 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
aa76de2aae
Коммит
52b7d573b5
|
@ -1103,6 +1103,8 @@ nsGlobalWindowInner::~nsGlobalWindowInner()
|
||||||
|
|
||||||
Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_MUTATION_LISTENERS,
|
Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_MUTATION_LISTENERS,
|
||||||
mMutationBits ? 1 : 0);
|
mMutationBits ? 1 : 0);
|
||||||
|
Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_TEXT_EVENT_LISTENERS,
|
||||||
|
mMayHaveTextEventListenerInDefaultGroup ? 1 : 0);
|
||||||
|
|
||||||
// An inner window is destroyed, pull it out of the outer window's
|
// An inner window is destroyed, pull it out of the outer window's
|
||||||
// list if inner windows.
|
// list if inner windows.
|
||||||
|
@ -1721,9 +1723,13 @@ nsGlobalWindowInner::InnerSetNewDocument(JSContext* aCx, nsIDocument* aDocument)
|
||||||
|
|
||||||
Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_MUTATION_LISTENERS,
|
Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_MUTATION_LISTENERS,
|
||||||
mMutationBits ? 1 : 0);
|
mMutationBits ? 1 : 0);
|
||||||
|
Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_TEXT_EVENT_LISTENERS,
|
||||||
|
mMayHaveTextEventListenerInDefaultGroup ? 1 : 0);
|
||||||
|
|
||||||
// Clear our mutation bitfield.
|
// Clear our mutation bitfield.
|
||||||
mMutationBits = 0;
|
mMutationBits = 0;
|
||||||
|
|
||||||
|
mMayHaveTextEventListenerInDefaultGroup = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -8066,6 +8072,7 @@ nsPIDOMWindowInner::nsPIDOMWindowInner(nsPIDOMWindowOuter *aOuterWindow)
|
||||||
mMayHaveSelectionChangeEventListener(false),
|
mMayHaveSelectionChangeEventListener(false),
|
||||||
mMayHaveMouseEnterLeaveEventListener(false),
|
mMayHaveMouseEnterLeaveEventListener(false),
|
||||||
mMayHavePointerEnterLeaveEventListener(false),
|
mMayHavePointerEnterLeaveEventListener(false),
|
||||||
|
mMayHaveTextEventListenerInDefaultGroup(false),
|
||||||
mAudioCaptured(false),
|
mAudioCaptured(false),
|
||||||
mOuterWindow(aOuterWindow),
|
mOuterWindow(aOuterWindow),
|
||||||
// Make sure no actual window ends up with mWindowID == 0
|
// Make sure no actual window ends up with mWindowID == 0
|
||||||
|
|
|
@ -256,6 +256,16 @@ public:
|
||||||
mMayHavePointerEnterLeaveEventListener = true;
|
mMayHavePointerEnterLeaveEventListener = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call this to indiate that some node (this window, its document,
|
||||||
|
* or content in that document) has a text event listener in the default
|
||||||
|
* group.
|
||||||
|
*/
|
||||||
|
void SetHasTextEventListenerInDefaultGroup()
|
||||||
|
{
|
||||||
|
mMayHaveTextEventListenerInDefaultGroup = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Sets the event for window.event. Does NOT take ownership, so
|
// Sets the event for window.event. Does NOT take ownership, so
|
||||||
// the caller is responsible for clearing the event before the
|
// the caller is responsible for clearing the event before the
|
||||||
// event gets deallocated. Pass nullptr to set window.event to
|
// event gets deallocated. Pass nullptr to set window.event to
|
||||||
|
@ -661,6 +671,9 @@ protected:
|
||||||
bool mMayHaveSelectionChangeEventListener;
|
bool mMayHaveSelectionChangeEventListener;
|
||||||
bool mMayHaveMouseEnterLeaveEventListener;
|
bool mMayHaveMouseEnterLeaveEventListener;
|
||||||
bool mMayHavePointerEnterLeaveEventListener;
|
bool mMayHavePointerEnterLeaveEventListener;
|
||||||
|
// Only for telemetry probe so that you can remove this after the
|
||||||
|
// telemetry stops working.
|
||||||
|
bool mMayHaveTextEventListenerInDefaultGroup;
|
||||||
|
|
||||||
bool mAudioCaptured;
|
bool mAudioCaptured;
|
||||||
|
|
||||||
|
|
|
@ -424,6 +424,14 @@ EventListenerManager::AddEventListenerInternal(
|
||||||
doc->SetDocumentAndPageUseCounter(eUseCounter_custom_onfinish);
|
doc->SetDocumentAndPageUseCounter(eUseCounter_custom_onfinish);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (aTypeAtom == nsGkAtoms::ontext) {
|
||||||
|
// Ignore event listeners in the system group since editor needs to
|
||||||
|
// listen "text" events in the system group.
|
||||||
|
if (!aFlags.mInSystemGroup) {
|
||||||
|
if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
|
||||||
|
window->SetHasTextEventListenerInDefaultGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsApzAwareListener(listener)) {
|
if (IsApzAwareListener(listener)) {
|
||||||
|
|
|
@ -6783,6 +6783,15 @@
|
||||||
"kind": "boolean",
|
"kind": "boolean",
|
||||||
"description": "Deleted or to-be-reused innerwindow which has had mutation event listeners."
|
"description": "Deleted or to-be-reused innerwindow which has had mutation event listeners."
|
||||||
},
|
},
|
||||||
|
"INNERWINDOWS_WITH_TEXT_EVENT_LISTENERS": {
|
||||||
|
"record_in_processes": ["content"],
|
||||||
|
"alert_emails": ["mnakano@mozilla.com"],
|
||||||
|
"bug_numbers": [1506434,1288640],
|
||||||
|
"expires_in_version": "67",
|
||||||
|
"kind": "boolean",
|
||||||
|
"releaseChannelCollection": "opt-out",
|
||||||
|
"description": "Deleted or to-be-reused innerwindow which has had text event listeners in the default group."
|
||||||
|
},
|
||||||
"CHARSET_OVERRIDE_SITUATION": {
|
"CHARSET_OVERRIDE_SITUATION": {
|
||||||
"record_in_processes": ["main", "content"],
|
"record_in_processes": ["main", "content"],
|
||||||
"expires_in_version": "never",
|
"expires_in_version": "never",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче