Eric has explained the problem very thoroughly. The truth of the matter is that most browsers are broken when it comes to window.alert in multiple windows and tabs. WebKit does something that is functionally correct and protects against the problems Eric described. It turns out that Firefox is single threaded, and the fact that you are seeing multiple alerts is only an indication of some interesting and unfortunate recursion happening on the UI thread. It is a bug, plain and simple. It is violating assumptions about the run-to-completion requirements of javascript in browsers.
Now, I agree wholeheartedly that it would be nice for alerts to be scoped to the tab. I worked really hard to try to make it so, but it breaks way too many requirements of the web platform to do it. I'm very interested in some alternatives, like changing the behavior of alerts spawned by background tabs. Perhaps an alert generated in a background tab could instead be routed to some kind of "this tab needs attention" non-blocking UI, such that when the user clicks on the tab, they would be able to see the alert text. In this mode, the window.alert issued by the background tab would have returned immediately so as to keep from blocking the javascript thread. I'm sure this will break web apps though, so it has to be thought through very carefully. -Darin On Sun, Sep 7, 2008 at 6:19 PM, Bernd Kreuss <[EMAIL PROTECTED]>wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > e. roman wrote: > > > If your browser lets you hit the step3 button (while alert is open), > > then it will fail. > > Both of my browsers, Konqueror and Firefox allow me to click step 3 and > the thread in the popup will change the value of x while the thrad in > the opener window is waiting in the alert() and it will report "FAIL" > when it continues. This is absolutely what i would have expected! > > In my original example I could not click on the opener alert while the > popup alert was open, so this means that the blocking popup can be modal > to the opening window. Alerts in popups seem to trigger some kind of > modality between popup and opener, but this is not about Threads and > blocking script execution. > > The fact that there are can be two alerts open at the same time means > that there must be two separate threads. There is *no* way how one > thread can wait in two alerts at the same time. > > > - -- > private communication within hostile networks: > http://torchat.googlecode.com/ > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFIxH29xT6R4jlFoh0RAu1xAJ98BwVblvE9HYLP/z1N7e54y5mJcACdEFVx > 9JJoGTKGUidwhPMkuIgFx3k= > =fLjm > -----END PGP SIGNATURE----- > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Chromium-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/chromium-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
