Closed Bug 798298 Opened 8 years ago Closed 8 years ago

Allow chrome JS code to know if it is being called as a result of a user input event

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla18
blocking-basecamp +
Tracking Status
firefox18 --- fixed

People

(Reporter: mounir, Assigned: mounir)

References

Details

Attachments

(1 file)

Currently, there are two ways to make sure some features are called when there is a real user action that might have requested it:
- the popup manager (in nsPIDOMWindow and nsGlobalWindow);
- nsEventStateManager::IsHandlingUserInput().

None of them (AFAIK) are available to JS but bug 794407 and bug 769569 needs a mechanism or the other to make sure those features are not abused.

I think we should expose something trough a component.
Attached patch PatchSplinter Review
Attachment #668475 - Flags: review?(bugs)
Comment on attachment 668475 [details] [diff] [review]
Patch


>+  *aHandlingUserInput = GetPresContext()->EventStateManager()->IsHandlingUserInput();

GetPresContext() needs null check.

>+  /**
>+   * Returns if the current code is runned from a user input handling.
returns what?
And 'is run'

But perhaps:
Returns true if user input is being handled.

>+   *
>+   * This is calling nsEventStateManager::IsHandlingUserInput().
This calls nsEventStateManager::IsHandlingUserInput()

>+   */
>+  readonly attribute boolean handlingUserInput;
isHandlingUserInput
Attachment #668475 - Flags: review?(bugs) → review+
blocking-basecamp: ? → +
https://hg.mozilla.org/integration/mozilla-inbound/rev/055d18bfa169
Flags: in-testsuite+
Target Milestone: --- → mozilla19
https://hg.mozilla.org/mozilla-central/rev/055d18bfa169
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Couldn't the homescreen app simply not display itself? I.e. it's the homescreen app which is listing all the apps, it can simply choose to not skip displaying anything when it sees its own manifestURL
Jonas, I guess you meant to comment in bug 794407.
Pushed in mozilla-aurora, because it is blocking basecamp.
https://hg.mozilla.org/releases/mozilla-aurora/rev/cc22c3a6f9ed
Target Milestone: mozilla19 → mozilla18
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.