Closed Bug 1271842 Opened 5 years ago Closed 10 months ago

Need async nsIPrompt API

Categories

(Toolkit :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla77

People

(Reporter: Dolske, Assigned: pbz)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

The current nsIPrompt APIs are used all over (and in extensions too), but they're all synchronous APIs... Call a prompt, wait for the user to interact, call returns. This has a number of problems -- there's an extra event loop spinning while the prompt is open, and hangs can result when other things spin the event loop (such as another prompt). This can also make converting prompts to tab-modal form difficult -- callers can be in an intermediate state when the tab is closed, and verifying correctness in such cases is tricky and non-obvious.

We should have a version of the nsIPrompt API that's asynchronous, using callbacks or Promises so that callers do not have to block waiting for the prompt to complete.

Note that nsIAuthPrompt2 has asyncPromptAuth(), which is kinda what we want, but it's actually implemented in the prompt code with a normal synchronous prompt.
Blocks: 1271852
Duplicate of this bug: 1621737
Assignee: nobody → pbz
Status: NEW → ASSIGNED

Depends on D67505

Attachment #9134451 - Attachment description: Bug 1271842 - Updated test_modal_prompts.html to include async prompting. r=johannh! → Bug 1271842 - Updated prompt tests to include async prompting. r=johannh!
Blocks: 1622836
Attachment #9134450 - Attachment is obsolete: true

This is the implementation for the newly added async prompt methods in nsIPromptService.
Async prompt methods return a Promise which resolves an nsIPropertyBag with the
prompt result values.

Depends on D69595

Pushed by pzuhlcke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/091a64a38136
nsIPromptService: Added async prompt methods. r=johannh
https://hg.mozilla.org/integration/autoland/rev/7262ae6d42ec
Updated prompt tests to include async prompting. r=johannh
Pushed by pzuhlcke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b16151863369
nsIPromptService: Added async prompt methods. r=johannh
https://hg.mozilla.org/integration/autoland/rev/bace62107e14
Updated prompt tests to include async prompting. r=johannh
Flags: needinfo?(pbz)
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77

Sorry, forgot to mark as 'leave-open'. Still missing a patch (is up for review).

Status: RESOLVED → REOPENED
Keywords: leave-open
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 1 year ago10 months ago
Resolution: --- → FIXED
Attachment #9141799 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.