Closed
Bug 1343765
Opened 8 years ago
Closed 8 years ago
Label timer in dom/events
Categories
(Core :: DOM: Events, enhancement, P2)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: stone, Assigned: stone)
References
Details
(Whiteboard: [QDL][TDC-MVP][DOM])
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
stone
:
review+
|
Details | Diff | Splinter Review |
Timer gUserInteractionTimerCallback in EventStateManager.cpp
Updated•8 years ago
|
Priority: -- → P2
Assignee | ||
Comment 1•8 years ago
|
||
Assignee: nobody → sshih
Assignee | ||
Updated•8 years ago
|
Attachment #8849880 -
Flags: review?(btseng)
Comment 2•8 years ago
|
||
Comment on attachment 8849880 [details] [diff] [review]
Label timer in dom/events
Review of attachment 8849880 [details] [diff] [review]:
-----------------------------------------------------------------
Per offline discussion, the gUserInteractionTimer is a singleton to serve multiple documents/windows.
Hence, some design change is expected to call the timercallback from different event target.
In addition, if we keep gUserInteractionTimer as a singleton, we should make sure that the timer was cancel before we init another run of timercallback with different event target to prevent that the previous callback was invoked with the event target we set later for next InitWithCallback.
::: dom/events/EventStateManager.cpp
@@ +341,5 @@
> + return;
> + if (!gUserInteractionTimer && mPresContext) {
> + EnsureDocument(mPresContext);
> + CallCreateInstance("@mozilla.org/timer;1", &gUserInteractionTimer);
> + nsCOMPtr<nsPIDOMWindowOuter> win(mDocument->GetWindow());
You can get DocGroup EventTarget via mDocument->EventTargetFor() without getting TabGroup from its outter window.
@@ +1432,5 @@
> + EnsureDocument(mPresContext);
> + nsCOMPtr<nsPIDOMWindowOuter> win(mDocument->GetWindow());
> + NS_ENSURE_TRUE_VOID(win);
> + mClickHoldTimer->SetTarget(
> + win->TabGroup()->EventTargetFor(TaskCategory::UI));
ditto
Attachment #8849880 -
Flags: review?(btseng)
Assignee | ||
Comment 3•8 years ago
|
||
Attachment #8849880 -
Attachment is obsolete: true
Assignee | ||
Comment 4•8 years ago
|
||
Comment on attachment 8850260 [details] [diff] [review]
Label timer in dom/events (V2)
Maybe we should use SystemGroup for UserInteractionTimer since it's not bound to a specific document.
Attachment #8850260 -
Flags: review?(btseng)
Comment 5•8 years ago
|
||
Comment on attachment 8850260 [details] [diff] [review]
Label timer in dom/events (V2)
Review of attachment 8850260 [details] [diff] [review]:
-----------------------------------------------------------------
Please see my comment below.
Thanks!
::: dom/events/EventStateManager.cpp
@@ +343,4 @@
> CallCreateInstance("@mozilla.org/timer;1", &gUserInteractionTimer);
> + if (gUserInteractionTimer) {
> + gUserInteractionTimer->SetTarget(
> + SystemGroup::EventTargetFor(TaskCategory::Other));
We have to use SystemGroup carefully to prevent an assertion similar to
https://bugzilla.mozilla.org/show_bug.cgi?id=1339006#c11
The notification of user-interaction-active/user-interaction-inactive will trigger a JS callback in SessionRecorder:
http://searchfox.org/mozilla-central/source/toolkit/modules/SessionRecorder.jsm#390-396
Comprehensive test is required to ensure that SessionRecorder and its user are chrome-privileged to prevent hitting this assertion.
Attachment #8850260 -
Flags: review?(btseng)
Assignee | ||
Comment 6•8 years ago
|
||
(In reply to Bevis Tseng[:bevistseng][:btseng] from comment #5)
> Comment on attachment 8850260 [details] [diff] [review]
> Label timer in dom/events (V2)
>
> Review of attachment 8850260 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Please see my comment below.
>
> Thanks!
>
> ::: dom/events/EventStateManager.cpp
> @@ +343,4 @@
> > CallCreateInstance("@mozilla.org/timer;1", &gUserInteractionTimer);
> > + if (gUserInteractionTimer) {
> > + gUserInteractionTimer->SetTarget(
> > + SystemGroup::EventTargetFor(TaskCategory::Other));
>
> We have to use SystemGroup carefully to prevent an assertion similar to
> https://bugzilla.mozilla.org/show_bug.cgi?id=1339006#c11
>
> The notification of user-interaction-active/user-interaction-inactive will
> trigger a JS callback in SessionRecorder:
> http://searchfox.org/mozilla-central/source/toolkit/modules/SessionRecorder.
> jsm#390-396
>
> Comprehensive test is required to ensure that SessionRecorder and its user
> are chrome-privileged to prevent hitting this assertion.
Tested with my local build and it works fine.
Assignee | ||
Updated•8 years ago
|
Attachment #8850260 -
Flags: review?(bugs)
Comment 7•8 years ago
|
||
Comment on attachment 8850260 [details] [diff] [review]
Label timer in dom/events (V2)
>+ EnsureDocument(mPresContext);
Technically, what guarantees mPresContext is non-null here?
>+ mClickHoldTimer->SetTarget(mDocument->EventTargetFor(TaskCategory::UI));
> mClickHoldTimer->InitWithFuncCallback(sClickHoldCallback, this,
> clickHoldDelay,
> nsITimer::TYPE_ONE_SHOT);
Given that this is really about a system level thing, not so much about some particular document,
I would just use SystemGroup::EventTargetFor(TaskCategory::Other)
(we don't want this kind of timer to be delayed if the docgroup is preempted temporarily)
That changed, r+
(also, I think CreateClickHoldTimer code is effectively dead. There is even a bug to remove this method)
Attachment #8850260 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 8•8 years ago
|
||
Attachment #8850260 -
Attachment is obsolete: true
Attachment #8851447 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c01b9f972f5a
Label timer in dom/events. f=bevistseng. r=smaug.
Keywords: checkin-needed
Comment 10•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•8 years ago
|
Whiteboard: [QDL][TDC-MVP][DOM]
You need to log in
before you can comment on or make changes to this bug.
Description
•