Open Bug 1061258 Opened 10 years ago Updated 2 years ago

When closing a tab having an opened modal window generated by <a>'s onclick, firefox makes a request to the href

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86_64
Windows 7
defect

Tracking

()

People

(Reporter: bg.tanatos, Unassigned)

References

Details

Attachments

(3 files)

Attached file test.html (deleted) —
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.102 Safari/537.36

Steps to reproduce:

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0

<a href="http://localhost/?BUG" onclick="return confirm('you sure?')">TEST</a>

1. Open a html file with the contents above. 
2. Open a blank tab.
3. Click the link TEST in order to open the modal window.
4. Close the tab while the modal is open. 
5. Check access log to see that the request was made, as if the link was clicked.


Actual results:

A HTTP request was made. 


Expected results:

A HTTP request should not have been made
Confirmed in Nightly34.0a1 and Firefox24 as well, Repeat STR twice, I got the following access log.


http://localhost/?BUG

GET /?BUG HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Status: UNCONFIRMED → NEW
Ever confirmed: true
Great fun.  The problem is that the click processing blocks on the confirm returning, which happens after the tab is closed; then the click processing presses on.  Olli, can we check for the "tab is closed" case at that point?
Component: General → DOM: Core & HTML
Flags: needinfo?(bugs)
How is this different to calling <a>.click() at very late point of beforeunload/unload.

Though, tabmodal confirm should default to 'cancel', not to 'ok'.
Flags: needinfo?(bugs)
Flags: needinfo?(gijskruitbosch+bugs)
Boris and I briefly discussed this on IRC, and I suspect (but haven't verified) that this is because the prompt's abortPrompt code gets triggered and throws an exception. Now, the prompt service might be interested in that, and some of it chrome consumers might be especially - but nsGlobalWindow::Prompt and friends should probably swallow it and return the 'cancel' option from the prompt as a return value to the web page, instead of an exception - much like we silently swallow issues with setting location.href and friends.
Flags: needinfo?(gijskruitbosch+bugs)
Attached file Altered Test html (deleted) —
In this Altered Test html, return false by [OK],  true by [Cancel].
However, same problem happens.

So, I think that
default [Cancel] (comment#3) --- not solve
return false from widget when exception occurred (comment#4) --- not solve
Attached file Alternative test v2 (deleted) —
What comment #4 proposes is roughly the following, which works in my testing, actually... Alice, am I missing something?
Flags: needinfo?(alice0775)
Attachment #8482866 - Attachment mime type: text/plain → text/html
Disabling Bug 59314 solves every thing.

IE11 and Chrome37 are using window modal dialog insted of tab modal one!
So, I think it is time to back out Bug 59314!
Blocks: 59314
Flags: needinfo?(alice0775)
(In reply to :Gijs Kruitbosch from comment #6)
> Created attachment 8482866 [details]
> Alternative test v2
> 
> What comment #4 proposes is roughly the following, which works in my
> testing, actually... Alice, am I missing something?

Okay
Er, no, comment 4 can't do what comment 6 suggests.  What I was talking about on irc is just making confirm() return false when canceled...  but yes, that would not address attachment 8482857 [details].

However, do we _care_ about addressing it?  See comment 3.
And to be clear, the UX of using window-modal dialogs sucks, and we should not go back to it.  The fact that other browsers have the sucky UX doesn't mean we have to make ours worse.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: