Search the web
Sign In
New User? Sign Up
jsunit
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
IE timing issues, operation aborted   Message List  
Reply | Forward Message #1213 of 1231 |
I've had problems getting the tests to run consistently in IE.

2 issues:

- the test is reported to have timed out even though the frame loaded it
- Operation aborted message appears when running some tests.

I have found that the timing issues is something to do with the the onload
listener in the frame either not being called or being called before the js file
is loaded to set the load flag to false. I added a setTimeout to call the
onload function

The operation aborted problem occurs when a tests uses appendChild before the
dom object is truly ready. The frame reported it was ready too soon.

I have fixed this using a setTimeout on the setTestPage and on the _callback to
add a small buffer to guarantee the frame is ready. while my tests run a bit
slower, at least they don't randomly fail anymore.

I suspect these issue might be more prevalent when loading up some the larger js
libraries.


I thought I'd share the code in case it helps someone before MS fixes IE.


//Force the onload event to happen again for IE timing issues, sometimes it
either fires before the initial setting of the variable to false
// or the load is done and setting a new listenere never happens
var isIE = navigator.userAgent.indexOf ("MSIE") > -1;
if (isIE) {
setTimeout(newOnLoadEvent, 1000);
}



jsUnitTestManager.prototype.loadPage = function (testFileName)
{
this._testFileName = testFileName;
this._loadAttemptStartTime = new Date();
this.setStatus('Opening Test Page "' + this._testFileName + '"');
// IE is being optimistic about its reporting, I have seen that there are
timing problems running the onload handlers and returning before its ready
// These timeouts are making sure things are really ready. If tests use
appendChild, then that can cause the browser to die with operation aborted.

if (isIE) {
var func_test_name = 'func_test_name'+(new Date()).getTime();
var that = this
// Create some unique functions to call after setTimeout
window[func_test_name] = function()
{that.containerController.setTestPage(that._testFileName);
var funcname = 'testfunc'+(new Date()).getTime();
window[funcname] = function () {that._callBackWhenPageIsLoaded();};
setTimeout('window.'+funcname+'();', 500);
};
setTimeout('window.'+func_test_name+'();', 50);
}
else {
this.containerController.setTestPage(this._testFileName);
this._callBackWhenPageIsLoaded();
}
// - END
}






Fri May 1, 2009 3:34 pm

jwehrman4
Offline Offline
Send Email Send Email

Forward
Message #1213 of 1231 |
Expand Messages Author Sort by Date

I've had problems getting the tests to run consistently in IE. 2 issues: - the test is reported to have timed out even though the frame loaded it - Operation...
jwehrman4
Offline Send Email
May 21, 2009
5:49 pm

Are you sure it's an IE problem? I know IE has problems, I've reported one in IE8 where exceptions are not thrown across the frame boundaries. However, I've...
tony_t_tubbs
Offline Send Email
May 22, 2009
3:28 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help