Closed Bug 817876 Opened 10 years ago Closed 10 years ago

Support multiple modal dialogs being requested from the same origin at the same time


(Firefox OS Graveyard :: Gaia::Browser, defect, P4)

Gonk (Firefox OS)


(Not tracked)



(Reporter: martijn.martijn, Assigned: cwiiis)




(Keywords: testcase, Whiteboard: c=browser u=user)


(1 file)

See testcase.

Expected result:
- 3 alert dialogs should appear

Actual result:
- Only 1 dialog appears and the page never finishes loading
Keywords: testcase
This is a very odd test case and I'm struggling to think of this would ever be reproduced in actual web content.

I'm not actually sure why it doesn't work but I've created a test case here to demonstrate a more sane case where three alerts in a row are successfully displayed

Martijn, can you explain the rationale behind this bug report? Is there a particular use case you have in mind where you would want to create multiple iframes firing alerts at the same time?
Flags: needinfo?(martijn.martijn)
Oh I think I know what the bug is and it's definitely in Gaia not Gecko. The mozbrowsershowmodalprompt events are all being fired by Gecko, but the browser app can only handle one event from a given origin at a time.

In the working example, all three events are from the same origin but they're executed synchronously in the same thread so block each other and will only fire one at a time. By firing the alerts from different iframes in the non-working example, they don't block each other and so are all fired at the same time, or in other words modal dialogs may not always be modal.

I'm not sure how important this is to fix, but it should be fixable in Gaia by creating a queue per origin.

We might need to be careful not to allow content to DoS the browser this way though.
Summary: Only one alert dialog shown in this case, when 3 alert dialogs should appear → Support multiple modal dialogs being requested from the same origin at the same time
Whiteboard: c=browser u=user
Priority: -- → P4
This fixes the issue and provides what I see as the same behaviour as Firefox on desktop (each dialog is presented in the order in which they arrive).

I'm not sure if the possibility of DoS'ing is different to the normal modal dialog handling - if it is, then this patch needs a part 2 to prevent that, but I'd have thought that the usual mechanisms would work in this case too (?)

Assigning, but feel free to steal.
Assignee: nobody →
Attachment #767198 - Flags: review?(bfrancis)
Comment on attachment 767198 [details] [diff] [review]
Handle multiple modal dialogs from the same origin

r+me once it passes the JS linter (See pull request

Please be sure to squash into one commit before merging and add r=benfrancis to the merge commit message if you merge it yourself.

Attachment #767198 - Flags: review?(bfrancis) → review+
Merged into master
Closed: 10 years ago
Resolution: --- → FIXED
Flags: needinfo?(martijn.martijn)
You need to log in before you can comment on or make changes to this bug.