This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24707 - The pause (for blocking dialog) algorithm should not provide a stable state
Summary: The pause (for blocking dialog) algorithm should not provide a stable state
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on: 24724
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-18 07:03 UTC by contributor
Modified: 2014-09-12 18:08 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2014-02-18 07:03:26 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/
Multipage: http://www.whatwg.org/C#processing-model-4
Complete: http://www.whatwg.org/c#processing-model-4
Referrer: 

Comment:
The pause (for blocking dialog) algorithm should not provide a stable state

Posted from: 58.187.186.41
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.58 Safari/537.36 OPR/20.0.1387.30 (Edition Next)
Comment 1 Philip Jägenstedt 2014-02-18 07:21:51 UTC
See discussion in https://www.w3.org/Bugs/Public/show_bug.cgi?id=24484#c2

After trying to implement this in Blink, I've changed my mind about thinking this is reasonable. In short, the more places that provide a stable state, the more cases have to be tested for every algorithm that awaits a stable state. In this case, cross-browser testing using plain scripts is not possible because scripts have no way of dismissing these dialogs, since they are blocked waiting for them.

Hixie said this in the linked bug:

> Consider the case of a page that create a video element, then does
> alert("Ok, I've started the load!"). The user sees the alert, thinks "I'll
> go for lunch while it loads", comes back... and we haven't yet started the
> load, if we don't provide a stable state here.

This is not an impossible scenario, but providing for it does not seem worth the added implementation and testing effort.
Comment 2 Rafael Weinstein 2014-02-19 11:13:33 UTC
Question: Am I understanding the spec language correctly that "spin the event loop" synchronously triggers "perform a microtask checkpoint" before returning to the event loop?

Would imply that calling showModalDialog would synchronously run all pending microtasks, and the parser discovering that it is blocked on a "style sheet that is blocking scripts" would also synchronously run all pending microtasks?
Comment 4 Ian 'Hixie' Hickson 2014-02-19 17:05:17 UTC
I don't understand why we would not want to provide a stable state when the whole browser is blocked on an alert. It's the ultimate stable state, and preventing downloads from starting in that state seems really bad.

It seems bad for users primarily, but also authors. It might be more complicated for implementors, but users and authors are more important.
Comment 5 Philip Jägenstedt 2014-02-19 17:21:43 UTC
(In reply to Ian 'Hixie' Hickson from comment #4)
> I don't understand why we would not want to provide a stable state when the
> whole browser is blocked on an alert. It's the ultimate stable state, and
> preventing downloads from starting in that state seems really bad.
> 
> It seems bad for users primarily, but also authors. It might be more
> complicated for implementors, but users and authors are more important.

What about what zcorpan pointed out, that alert() is used for debugging? This seems like a problem:

v1.src = 'foo';
alert(v1.src); // removing this line changes the behavior of the next
v2.src = v1.currentSrc;

Debugging this doesn't seem like fun at all.
Comment 6 Ian 'Hixie' Hickson 2014-02-19 20:33:45 UTC
*shrug*

That seems less bad to me. I agree that it could be argued both ways.
Comment 7 Ian 'Hixie' Hickson 2014-02-19 20:38:03 UTC
If you really think we should block media loads until the script is over, even in the case of the script calling alert(), then ok. But we should make sure to test that that is actually implemented.
Comment 8 Philip Jägenstedt 2014-02-20 16:56:19 UTC
I wrote a test for alert, confirm and prompt:
https://github.com/w3c/web-platform-tests/pull/659

I was rather surprised to find that Firefox and IE11 pass the tests.

But yeah, I still think that the use case for providing a stable state here is very dubious, and if this is going to be the only remaining case where a stable state could occur while scripts are running I definitely don't think it's worth it.
Comment 9 Ian 'Hixie' Hickson 2014-02-20 18:43:36 UTC
Ok, but are Firefox and IE going to _stop_ downloading in that case?
Comment 10 Philip Jägenstedt 2014-02-21 04:21:03 UTC
roc and cdouble, would you be willing to change Gecko to *not* provide a stable state for blocking dialogs? I think the example in comment #5 is the strongest reason to not do it.
Comment 11 Robert O'Callahan (Mozilla) 2014-02-21 05:13:08 UTC
console.log and other tools are better than alert() anyway. I don't see a reason to change here.
Comment 12 Philip Jägenstedt 2014-02-21 10:38:27 UTC
(In reply to Robert O'Callahan (Mozilla) from comment #11)
> console.log and other tools are better than alert() anyway. I don't see a
> reason to change here.

What do you think should be done if this is the only "provide a stable state" that cannot be expressed in terms of microtasks in https://www.w3.org/Bugs/Public/show_bug.cgi?id=24724 ?
Comment 13 Robert O'Callahan (Mozilla) 2014-02-21 11:06:58 UTC
I wouldn't stand in the way of that.
Comment 14 Philip Jägenstedt 2014-02-21 18:01:22 UTC
OK, I guess that bug should be resolved first then, to see if this will actually be the odd man out.
Comment 15 Ian 'Hixie' Hickson 2014-05-07 23:00:38 UTC
foolip, do you have an update on what happened to the test for this? I really think we should make sure to have a test for this (with the behaviour being that alert() blocks the download of video content for elements created in the same script block before the alert()), because I am not confident that browsers will maintain this behaviour if we spec it.
Comment 16 Philip Jägenstedt 2014-05-08 09:44:36 UTC
Looks like I forgot to re-open that pull request as I planned, so here's a new one:
https://github.com/w3c/web-platform-tests/pull/970

This is testing the current spec behavior, and if you change the spec I'll just invert the pass condition.
Comment 17 Ian 'Hixie' Hickson 2014-05-08 18:12:41 UTC
Done.
Comment 18 Ian 'Hixie' Hickson 2014-07-31 21:15:16 UTC
This is open to help me track the aforementioned test, so that I don't forget to undo this change if browsers decide to load the file during an alert() anyway.