IE6 synch Error problem in Test.Builder.die

1 view
Skip to first unread message

Marvin Humphrey

unread,
Aug 22, 2007, 3:30:09 PM8/22/07
to jsan-a...@googlegroups.com
Greets,

I've been chasing down a strange synch bug in IE6. For no good
reason, Test.Builder.die() sometimes produces an Error object with an
empty message. Either that, or another event produces a spurious
Error with an empty message before Test.Builder.die() completes its
work -- it's hard to tell with no stack trace.

The first of these three tests fails for me consistently on IE6 win2k:

http://www.rectangular.com/junk/Test.Simple.orig/tests/
builder_death.html

However, if I add this line to the html head, everything passes.

<script type="text/javascript" src="../lib/Test/Builder.js"></script>

That seems to suggest that there's some sort of loading problem with
the JSAN.require() mechanism on IE6. However, perhaps it is limited
to try/catch/Error functionality alone, because weirdly, I was
originally having trouble with any Test.Builder.die() call *after*
the first producing an Error object with a blank message.

As a workaround, throwing a subclass of Error seems to make the
problem go away.

Test.Builder.Error = function (msg) {
this.message = msg;
this.name = "Test.Builder.Error";
}
Test.Builder.Error.prototype = new Error();

Test.Builder.die = function (msg) {
throw new Test.Builder.Error(msg);
};

David, would you be amenable to that change?

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/


David E. Wheeler

unread,
Aug 22, 2007, 3:59:50 PM8/22/07
to jsan-a...@googlegroups.com
On Aug 22, 2007, at 12:30, Marvin Humphrey wrote:

> As a workaround, throwing a subclass of Error seems to make the
> problem go away.
>
> Test.Builder.Error = function (msg) {
> this.message = msg;
> this.name = "Test.Builder.Error";
> }
> Test.Builder.Error.prototype = new Error();
>
> Test.Builder.die = function (msg) {
> throw new Test.Builder.Error(msg);
> };
>
> David, would you be amenable to that change?

Yep. Probably makes sense anyway.

David

Marvin Humphrey

unread,
Aug 22, 2007, 6:01:16 PM8/22/07
to jsan-a...@googlegroups.com

On Aug 22, 2007, at 12:59 PM, David E. Wheeler wrote:

>> David, would you be amenable to that change?
>
> Yep. Probably makes sense anyway.

OK, patch attached.

I had to cargo-cult this at the end of builder_death.html...

// Force ending because IE6 needs coercion.
T._notifyHarness();

... or it wouldn't run from the Harness.

http://www.rectangular.com/junk/Test.Simple.tberror/tests/
http://www.rectangular.com/junk/Test.Simple.tberror/tests/?
file=builder_death.html;verbose=1

There's probably a better way to handle that, but I don't quite grok
the ending code.

<aside>Those URLs are going to wrap, but oh well. Any way to set
this mailing list so it wraps at 80 instead of such an absurdly
narrow width?</aside>

TBError.patch

Marvin Humphrey

unread,
Aug 22, 2007, 7:26:04 PM8/22/07
to jsan-a...@googlegroups.com

On Aug 22, 2007, at 3:01 PM, Marvin Humphrey wrote:

> I had to cargo-cult this at the end of builder_death.html...

Here's a better, smaller patch.

builder_death.html has morphed into builder_death.js and now running
from the harness works without the hack.

The test still fails on IE6 when Test.Builder.die is set up to throw
a normal Error.

TBError2.patch

David E. Wheeler

unread,
Aug 28, 2007, 1:37:26 PM8/28/07
to jsan-a...@googlegroups.com
On Aug 22, 2007, at 15:01, Marvin Humphrey wrote:

> I had to cargo-cult this at the end of builder_death.html...
>
> // Force ending because IE6 needs coercion.
> T._notifyHarness();
>
> ... or it wouldn't run from the Harness.
>
> http://www.rectangular.com/junk/Test.Simple.tberror/tests/
> http://www.rectangular.com/junk/Test.Simple.tberror/tests/?
> file=builder_death.html;verbose=1
>
> There's probably a better way to handle that, but I don't quite grok
> the ending code.

It's supposed to be called by window.onload. The function to do so is
installed by Test.Builder, according to the docs:

=item B<_ending>

Test._ending();

This method is called by the C<window.onload> handler installed by
Test.Builder. It checks the test run and outputs any necessary ending
messages, such as "It looks like you planed 8 tests but ran 2 extra."

I can no longer tell how this works, but the relevant code seems to be:

Test.Builder.globalScope.onload = function (event, pkg) {
// The package may be passed in if onload() is called
explicitly.
// This is to get around a very weird scoping bug in my
version of
// Firefox. See Test.Harness.Browser.runTest() for this usage.
Test.Builder._finish(pkg)
};

But I could be wrong. It has been too long and I can't trace it just
by reading it for a few minutes right now. But you absolutely should
not have to call that function, of course.

Best,

David

David E. Wheeler

unread,
Aug 28, 2007, 1:38:13 PM8/28/07
to jsan-a...@googlegroups.com
On Aug 22, 2007, at 16:26, Marvin Humphrey wrote:

> The test still fails on IE6 when Test.Builder.die is set up to throw
> a normal Error.

Ooops, guess you figured it out. Sorry, I'll shut up now. :-)

Best,

David

Reply all
Reply to author
Forward
0 new messages