473,503 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modal dialog doesn't threads to sleep in Firefox?

VK
Yet about the code posted at
<http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/bf33c7bbb9f699f9/0336cb59fb5920c5>

I just noticed another thing I did not notice last year (besides my
interface bug :-)

I looks like in Firefox window.confirm does not put setTimeout
"threads" on sleep. Script keeps executing as never nothing. I presume
(did not test yet) that window.alert / window.prompt do the same.

I realize that "window is not documented, and setTimeout is not
documented and ta-ta-ta". Still IMHO *the most expected* behavior IMHO
is that demonstrated by IE and Opera:- all threads are sleeping until
you dismiss the dialog.

I'm wondering if this Firefox behavior is intentional and mentioned
anywhere?

Mar 6 '06 #1
10 2358
VK wrote:
I realize that "window is not documented, and setTimeout is not
documented and ta-ta-ta". Still IMHO *the most expected* behavior IMHO
is that demonstrated by IE and Opera:- all threads are sleeping until
you dismiss the dialog.


I've just tested what you said and in my opinion the Firefox behaviour
is better. If I start a timer, it doesnt matter what's happening, I want
it to keep running until I tell it to stop.

The confirm/alert/prompt should interrupt just the current code from
running, not all the processes. Take a look on the JavaScript reference
(not manuals) and check what it says.
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Mar 6 '06 #2
VK

Jonas Raoni wrote:
I've just tested what you said and in my opinion the Firefox behaviour
is better. If I start a timer, it doesnt matter what's happening, I want
it to keep running until I tell it to stop.
It is not really a question of better/worse, but a question of
consistency. With 10-100 "threads" running, a single alert will move FF
and IE to completely different time frames after dialog is closed.
What is more benefitial programmatically - it highly depends of course
on the current task. I personally consider Firefox behavior as more
"adult looking". At the same time JavaScript doesn't have real *thread*
management and synchronization like in Java, so seems like a rather
dangerous decision to me especially for multiple timed instance
methods.
Not too much one can do anyway. It's great good to know though. So I
guess to have cross-browser FF behavior one needs to use a DHTML widget
instead. And for cross-browser IE/Opera/Co behavior one needs to stop
all "thread" manually before showing a dialog - and manually resume
them after.
Just great ... !@#$% ...
Take a look on the JavaScript reference
(not manuals) and check what it says.


I did, including mozilla.org. The same 11-years-old baby talk going
over and over for years: "this window has these buttons and returns
that, this window has those buttons and.. etc." Not a dot seems changed
since JavaScript 1.0

I think I'll ask at bugzilla: not as a bug report, but as a
clarification request.

Mar 6 '06 #3
VK wrote:
Jonas Raoni wrote:
I've just tested what you said and in my opinion the Firefox behaviour
is better. If I start a timer, it doesnt matter what's happening, I want
it to keep running until I tell it to stop.
It is not really a question of better/worse, but a question of
consistency.


Ok, I thought you were just alerting about this fact, not asking about
solutions.
With 10-100 "threads" running, a single alert will move FF
and IE to completely different time frames after dialog is closed.
Sure.
I personally consider Firefox behavior as more "adult looking".
I prefer it too, but since there's nothing on the specification (you
said), it would be nice to keep the same behaviour.
At the same time JavaScript doesn't have real *thread*
management and synchronization like in Java
It doesn't matter, JavaScript was used to validate forms not to build
powerful applications, try to take a look on the JS 2.0, maybe there's
something new =)
So I guess to have cross-browser FF behavior one needs to use a DHTML widget
instead.
But you won't be able to achieve the same result =/

myConfirm("Are you sure?");
confirm("Are you sure?");

Won't be the same as:

confirm("Are you sure?");
myConfirm("Are you sure?");

And for cross-browser IE/Opera/Co behavior one needs to stop
all "thread" manually before showing a dialog - and manually resume
them after.
Just great ... !@#$%


Yes, that's great hehe, but we already make a lot of tricks haha. You
could write a wrapper: "window.setTimeout = function", then it would be
easier to manage ;]

Well, till now I haven't needed any kind of "synchronized" timer, so
this behaviour won't be important for me. If you're counting time, the
best solution is to subtract date intervals, since timers don't fire at
the exact interval that you setted.
Take a look on the JavaScript reference
(not manuals) and check what it says.

"this window has these buttons and returns
that, this window has those buttons and.. etc."

I think I'll ask at bugzilla: not as a bug report, but as a
clarification request.


Well, if there's nothing talking about this on the specification, it's
unuseful to ask to the Firefox crew. It won't be a right answer, since
it will be based on guessing.
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Mar 7 '06 #4
VK

Jonas Raoni wrote:
VK wrote:
I think I'll ask at bugzilla: not as a bug report, but as a
clarification request.


Well, if there's nothing talking about this on the specification, it's
unuseful to ask to the Firefox crew. It won't be a right answer, since
it will be based on guessing.


You mean Firefox makers will try to *guess* the right behavior? :-)
I just want to check that they are aware of this behavior, that it is
by design so will stay from version to version, and not a particular
version specific.

Mar 7 '06 #5
VK wrote:
Jonas Raoni wrote:
Well, if there's nothing talking about this on the specification, it's
unuseful to ask to the Firefox crew. It won't be a right answer, since
it will be based on guessing.


I just want to check that they are aware of this behavior, that it is
by design so will stay from version to version, and not a particular
version specific.


Ok, good luck, I warned them about some bizarre bugs that I found, but I
don't remember of all of them, just 2:

This one:
setTimeout(function(x){alert(x);}, 0);

My function had other ways of beeing used, so when there was no
arguments, I supposed it was invoked by a timer.

And this one:

alert([,].length); //should be 2
alert([,,].length); //should be 3

I had to add a 0/null in the end of my not so null arrays (it just
ignores the last null value).

alert([1, , null].length);
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Mar 7 '06 #6
VK

Jonas Raoni wrote:
I warned them about some bizarre bugs that I found, but I
don't remember of all of them, just 2:

This one:
setTimeout(function(x){alert(x);}, 0);

My function had other ways of beeing used, so when there was no
arguments, I supposed it was invoked by a timer.
Well the above is a side effect of what I called "NOOP" in
<http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/bf33c7bbb9f699f9>

setTimeout is running as kind of
with(window) {eval(arg);}
(language purists: I said "kind of" :-)

.... so sweet heart closures do not do much of good.
And this one:

alert([,].length); //should be 2
alert([,,].length); //should be 3

I had to add a 0/null in the end of my not so null arrays (it just
ignores the last null value).


Yeh... more interesting. Looks like the engine threads comma
differently with or without elements.

If no one array element provided it executes it as comma operator:
arrayObject[0] = (undefined, undefined, undefined); // undefined

If at least one element provided, then it treats comma as elements
separator.

Seems like an inconsistency bug. Thanks for a tip for my " 'round array
" collection. :-)

Mar 7 '06 #7
Jonas Raoni wrote:
<snip>
... , I warned them about some bizarre bugs that I found,
but I don't remember of all of them, just 2: <snip> And this one:

alert([,].length); //should be 2
Should be 1.
alert([,,].length); //should be 3


Should be 2.

A final comma in an array literal does not imply a following element.
Mozilla is correct here and JScript is the implementation with the bug.

Richard.
Mar 7 '06 #8
VK wrote:
Jonas Raoni wrote:
setTimeout(function(x){alert(x);}, 0);

Well the above is a side effect of what I called "NOOP" in
<http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/bf33c7bbb9f699f9>

setTimeout is running as kind of
with(window) {eval(arg);}
(language purists: I said "kind of" :-)

... so sweet heart closures do not do much of good.


Did you say it isn't a bug? Feel free to find it
<URL:https://bugzilla.mozilla.org>, I received an email some days ago
saying that it was going to be corrected.

The Firefox and Opera accept more parameters on the setTimeout, these
extra arguments are passed to the callback, so
"setTimeout(function(x){alert(x);}, 0, null);" would solve the problem,
I thought it was a kind of "real delay", but it's really a bug...

Well, there are a lot of incompatibilities between the browsers, so if
you start asking them what's the right way, open a text editor and start
writing all the different features :b

Another one :)
alert(new Array(5).splice(0).join("x"));
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Mar 7 '06 #9
Richard Cornford wrote:
Jonas Raoni wrote:
<snip>
A final comma in an array literal does not imply a following element.
Mozilla is correct here and JScript is the implementation with the bug.


Great, someone has read the specs instead of testing and guessing what
would be the best way in its own opinion \o/

Anyway, in my opinion the last element should exist, it looks like:

{a: 0,};

or

var a, ;

Which generates errors.
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Mar 7 '06 #10
Jonas Raoni wrote:
Richard Cornford wrote:
Jonas Raoni wrote:
<snip>
A final comma in an array literal does not imply a following
element. Mozilla is correct here and JScript is the
implementation with the bug.


Great, someone has read the specs instead of testing and guessing
what would be the best way in its own opinion \o/

<snip>

A software bug is not determined by a personal opinion. JavaScript(tm)
and JScript both claim to implement ECMA 262 so the one that is not
doing what is specified in ECMA 262 is the one with the bug.

Given the choice I would have the final comma define an additional
element, though if all implementations followed the standard it would
make machine generating array definitions easier as you would not have
to omit a comma after the final element to avoid creating an array that
was longer than intended. But the language is defined as the language is
defined so the situation is past the point where my opinion matters.

Richard.
Mar 7 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
445
by: RobJUK66 | last post by:
have a 3rd party .Net dll that wraps a set of further unmanaged dll's. The ..Net DLL basically uses pinvoke to wrap the calls. The low level dlls provide an API to talk to a complex device which...
3
1468
by: Balaji M | last post by:
Is there any way to create a modal dialog in the html, which should work in both ie and netscape. the one window.showmodaldialog works well in ie, but not in netscape i found a way to keep the...
2
3669
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the...
3
2166
by: Grumman | last post by:
For various reasons, I've found myself in the position of needing to automate the operation of a small VB6 application from an external process. After a bit of searching, I found watsup, and it has...
4
2212
by: forest demon | last post by:
i've seen previous posts somewhat related to this, so i apologize if this is redundant. I have a main form with separate threads. When showing a dialog like <dialog>.ShowDialog(), it functions...
4
10619
by: John Kotuby | last post by:
Hi all... I am bulding an application and wish to use custom Modal dialog windows. According to a couple of recent articles I have seen, the newer Mozilla browsers (actually I think they said...
3
2463
by: aagarwal8 | last post by:
Hi, I have a main form, which i use to open secondary forms. From the secondary form i need to open a Modal Window in such a way that, my secondary form is blocked, but i can still access my...
11
2332
by: VK | last post by:
In the continuation of the discussion at "Making Site Opaque -- This Strategy Feasible?" and my comment at http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2 I have...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1501
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.