Closed Bug 95463 Opened 23 years ago Closed 23 years ago

Javascript: setTimeout executes code and then creates javascript errors and stops execution

Categories

(Core :: DOM: Core & HTML, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: peterjez, Assigned: jst)

References

()

Details

Visit my above smoketest testcase. In getBookmarkWindow I call a setTimeout that
uses gBookmarksShell.open. The function is executed... but it does not allow the
rest of the code after setTimeout to execute (ie the alert and the rest of it).

Error: 
Source File: http://pos.mcom.com/autosmoke/tests/bookmarksTest.html
Line: 39

Error: uncaught exception: [Exception... "Component returned failure code:
0x80004005 (NS_ERROR_FAILURE) [nsIDOMJSWindow.setTimeout]"  nsresult:
"0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
http://pos.mcom.com/autosmoke/tests/bookmarksTest.html :: getBookmarkWindow ::
line 39"  data: no]
BTW, in order to use the testcase, add the following line to your prefs.js:

user_pref("signed.applets.codebase_principal_support",true);
This bug is invalid. The error comes from the line:

  currentWindow.setTimeout(openNewWindow(currentWindow,
                           bookmarksTree.selectedItems[0]),1);

which is incorrect. What you want is:

currentWindow.setTimeout(openNewWindow, 1, currentWindow,
                         bookmarksTree.selectedItems[0]);

Change that and it should work, if not reopen this bug.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
johnny,
i could not reach the reporter and the url is not valid anymore. i was looking
at u'r comments. 
window.setTimeout("func()", 1); is a valid syntax rite.
thanks
Yes, window.setTimeout("func()", 1); is valid, so is window.setTimeout(func,
1);, but window.setTimeout(func(), 1); is not (unless calling func() returns a
function or string that should be executed).

verifying invalid based on johnny's comments and not have not heard from reporter.
Status: RESOLVED → VERIFIED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.