Closed Bug 1643205 Opened 4 years ago Closed 4 years ago

Navigator's share() must consume user activation

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: marcosc, Assigned: marcosc)

References

()

Details

Attachments

(1 file)

When share() is called, "consume user activation" of Window.

Edgar, could you guide me a little bit here?

The spec says:

If |window| does not have [=transient activation=], return [=a promise rejected with=] with a {{"NotAllowedError"}} {{DOMException}}.

What's the equivalent in Gecko for checking "If window does not have transient activation"?

And then the spec says:

[=Consume user activation=] of |window|.

I assume I need to call UserActivation.StopHandlingUserInput()?

Flags: needinfo?(echen)
Priority: -- → P3

As an aside, as these are user activation stuff is pretty common in specs, what might be nice is to document these like:

  • if the spec says, "consume", do this: ...
  • if the spec says "sticky activation", do this: ...
  • If the spec says "transient activation", do this: ...

The we have easy recipes to follow when implementing.

To check transient activation, you could use BrowsingContext::HasValidTransientUserGestureActivation(). And BrowsingContext::ConsumeTransientUserGestureActivation() is for consuming transient activation. We also provide some chrome only api on Document for testing purpose.

Flags: needinfo?(echen)

Amazing! Thanks Edgar!!!

Severity: -- → S3
Assignee: nobody → mcaceres
Summary: WebShare's share() must consume user activation → Navigator's share() must consume user activation

navigator.share() must consume the user activation.

Should this wait for the PR to land first?

Will land them all together (the PR is approved and the google folks are onboard too).

Another try:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5e6a62dbd40d08125beff24cff2c9cca0a61d4f8

Pushed by mcaceres@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9ff60304993b
Navigator's share() must consume user activation r=edgar
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/24187 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Upstream PR was closed without merging

Ah, forgot to disable for Windows 😅

Flags: needinfo?(mcaceres)
Pushed by mcaceres@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b7cd5a26f98e
Navigator's share() must consume user activation r=edgar
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: