Closed Bug 1350151 Opened 8 years ago Closed 7 years ago

Add support for isHandlingUserInput to webextensions schemas

Categories

(WebExtensions :: Frontend, enhancement, P1)

enhancement

Tracking

(firefox55 affected, firefox56 fixed)

RESOLVED FIXED
mozilla56
Tracking Status
firefox55 --- affected
firefox56 --- fixed

People

(Reporter: aswan, Assigned: aswan)

References

(Blocks 1 open bug)

Details

(Whiteboard: triaged)

Attachments

(3 files)

There are several webextensions APIs that may only be called immediately from an event handler for a user initiated action (e.g., a mouse click or key press). We don't want to repeat code for the checking for these methods, lets support this with an appropriate annotation in the schema. Also, permissions.request() is about to land with code that checks directly, it should be converted to use this facility as part of this bug.
Note that downloads.open() will have the same check in it once bug 1369782 lands.
Attachment #8890198 - Flags: review?(kmaglione+bmo)
Attachment #8890199 - Flags: review?(kmaglione+bmo)
Attachment #8890200 - Flags: review?(mstriemer)
Attachment #8890200 - Flags: review?(kmaglione+bmo)
Comment on attachment 8890198 [details] Bug 1350151 Part 1: Add requireUserInput property for functions in webextension schemas https://reviewboard.mozilla.org/r/161274/#review168442 ::: toolkit/components/extensions/test/xpcshell/test_ext_schemas_interactive.js:43 (Diff revision 1) > +function setHandlingUserInput(extension) { > + let extensionChild = ExtensionManager.extensions.get(extension.extension.id); > + let bgwin = null; > + for (let view of extensionChild.views) { > + if (view.viewType == "background") { > + bgwin = view.contentWindow; Nit: `break`
Attachment #8890198 - Flags: review?(kmaglione+bmo) → review+
Comment on attachment 8890199 [details] Bug 1350151 Part 2: Use requireUserInput for permissions.request() https://reviewboard.mozilla.org/r/161276/#review168446
Attachment #8890199 - Flags: review?(kmaglione+bmo) → review+
Comment on attachment 8890200 [details] Bug 1350151 Part 3: Use requireUserInput for downloads.open() https://reviewboard.mozilla.org/r/161278/#review168448
Attachment #8890200 - Flags: review?(kmaglione+bmo) → review+
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again. hg error in cmd: hg rebase -s 053773205398 -d 241d6d2bc109: rebasing 410746:053773205398 "Bug 1350151 Part 1: Add requireUserInput property for functions in webextension schemas r=kmag" merging toolkit/components/extensions/ExtensionCommon.jsm merging toolkit/components/extensions/Schemas.jsm merging toolkit/components/extensions/test/xpcshell/xpcshell.ini warning: conflicts while merging toolkit/components/extensions/Schemas.jsm! (edit, then use 'hg resolve --mark') unresolved conflicts (see hg resolve, then hg rebase --continue)
Pushed by aswan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1cf8b34f618e Part 1: Add requireUserInput property for functions in webextension schemas r=kmag https://hg.mozilla.org/integration/autoland/rev/3facbb92e28b Part 2: Use requireUserInput for permissions.request() r=kmag https://hg.mozilla.org/integration/autoland/rev/86ed29aded32 Part 3: Use requireUserInput for downloads.open() r=kmag
Attachment #8890200 - Flags: review?(mstriemer)
Blocks: 1392624
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: