Closed
Bug 25333
Opened 25 years ago
Closed 25 years ago
for () with only two arguments causes function not to be defined
Categories
(Core :: JavaScript Engine, defect, P2)
Tracking
()
RESOLVED
FIXED
M14
People
(Reporter: alecf, Assigned: waterson)
Details
this is REALLY wierd. I had an onload handler like this: function onLoad { . . for (var i=0; i<window.arguments) dump("arguments[" + i + "] = " + window.arguments[i] + "\n"); } and two odd things happened: 1) the XUL document freaked out: ###!!! ASSERTION: waaah!: 'Not Reached', file nsXULPrototypeDocument.cpp, line 446 ###!!! Break: at file nsXULPrototypeDocument.cpp, line 446 ###!!! ASSERTION: Failed to get a global Object Owner: 'PR_FALSE', file nsJSEnvironment.cpp, line 83 ###!!! Break: at file nsJSEnvironment.cpp, line 83 The line in nsXULDocument.cpp is from nsXULProtoTypeDocument::GetGlobalObjectOwner() 2) And then the onload handler was not defined: JavaScript Error: ReferenceError: onLoad is not defined I discovered that the problem was the for() had a typo, and only had two of the three 'arguments' - note there is no i++ Granted this is incorrect JS syntax, but it should have told me instead of freaking out like it did. CC'ing waterson because of the nsXULDocumentPrototype.cpp involvement
Comment 1•25 years ago
|
||
Hm. Your for statement is a syntax error - so whatever code is evaluating that javascript should bail out with an error. If the code is eval'd from javascript itself, you'll get a catchable SyntaxError exception. Your whole script will bail out (I think) and your onload handler definitely won't be defined. You're right - it doesn't look like we're handling the failure case properly. Waterson, any clues where to assign this?
Assignee | ||
Comment 2•25 years ago
|
||
I'll take a look at that cry-baby nsXULPrototypeDocument.
Assignee: mccabe → waterson
Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Target Milestone: M15
Assignee | ||
Comment 3•25 years ago
|
||
this is biting a lot of people. pulling to M14 and raising the priority. i'll fix it today.
Priority: P3 → P2
Target Milestone: M15 → M14
Assignee | ||
Comment 4•25 years ago
|
||
needed to implement nsIScriptGLobalObjectOwner on nsXULPrototypeDocument.cpp. fix checked in. r=scc
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•