Closed
Bug 837941
Opened 12 years ago
Closed 12 years ago
Properties referring to ArrayIndexOf in self-hosted code may be undefined on first use
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla23
People
(Reporter: mozillabugs, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 1 obsolete file)
Utilities.js contains the definition of a class List, whose prototype contains a property
proto.indexOf = std_Array_indexOf;
Functions using in instance of this class find that on first use of the containing function indexOf is undefined, while on later uses indexOf is defined. Changing the property definition to
proto.indexOf = ArrayIndexOf;
does not change the behavior.
To reproduce, install the attached patch, rebuild the js shell, and provide the following input to js:
js> print(Array.TestIndexOf(false))
js> print(Array.TestIndexOf(false))
js> print(Array.TestIndexOf(true))
js> print(Array.TestIndexOf(true))
The output currently is:
js> print(Array.TestIndexOf(false))
Call 0 failed; error message list.indexOf is not a function.
Call 1 failed; error message list.indexOf is not a function.
Call 2 failed; error message list.indexOf is not a function.
Call 3 failed; error message list.indexOf is not a function.
Call 4 failed; error message list.indexOf is not a function.
js> print(Array.TestIndexOf(false))
Call 0 succeeded.
Call 1 succeeded.
Call 2 succeeded.
Call 3 succeeded.
Call 4 succeeded.
js> print(Array.TestIndexOf(true))
Call 0 failed; error message list.indexOf is not a function.
Call 1 failed; error message list.indexOf is not a function.
Call 2 failed; error message list.indexOf is not a function.
Call 3 failed; error message list.indexOf is not a function.
Call 4 failed; error message list.indexOf is not a function.
js> print(Array.TestIndexOf(true))
Call 0 succeeded.
Call 1 succeeded.
Call 2 succeeded.
Call 3 succeeded.
Call 4 succeeded.
Reporter | ||
Comment 1•12 years ago
|
||
Excised bit rot.
Attachment #709963 -
Attachment is obsolete: true
Reporter | ||
Comment 2•12 years ago
|
||
Till, you'll recognize this workaround: it's extracted from your draft patch for bug 851763. Feel free to swap author/reviewer. It seems to fix the problem for List and the internationalization API, but I think we still want to find the underlying issue.
Attachment #731749 -
Flags: review?(tschneidereit)
Attachment #731749 -
Flags: checkin?(tschneidereit)
Reporter | ||
Updated•12 years ago
|
Whiteboard: [leave open]
Comment 3•12 years ago
|
||
Comment on attachment 731749 [details] [diff] [review]
Workaround: Use alternate prototype initialization for self-hosted List class
Review of attachment 731749 [details] [diff] [review]:
-----------------------------------------------------------------
I wouldn't even say it's a workaround: initializing the prototype in the ctor was a workaround for when object cloning didn't work, no?
I'll check this in once the tree reopens. Or tomorrow, whichever comes first for me.
Attachment #731749 -
Flags: review?(tschneidereit) → review+
Reporter | ||
Comment 4•12 years ago
|
||
You're right, this initialization of the prototype is perfectly valid and better than the previous version. It's a workaround only in the sense that the bug that prevented the previous version from working reliably is still hiding somewhere.
Comment 5•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ee16c6da2c75
(In reply to Norbert Lindenberg from comment #4)
> You're right, this initialization of the prototype is perfectly valid and
> better than the previous version. It's a workaround only in the sense that
> the bug that prevented the previous version from working reliably is still
> hiding somewhere.
Point taken, yes. I've honestly got no idea why that's happening, unfortunately. Nothing in my rather extensive debugging hinted at a reason for it even vaguely.
Comment 6•12 years ago
|
||
Comment on attachment 731749 [details] [diff] [review]
Workaround: Use alternate prototype initialization for self-hosted List class
Rather impressively, I managed not to realize that this patch is entirely subsumed by the one in bug 851763, which I pushed at the same time. So pushing this created an empty changelog. At least, I managed to bungle the description, so there's that ...
Attachment #731749 -
Flags: checkin?(tschneidereit) → checkin+
Comment 7•12 years ago
|
||
I did at least file bug 857529 for the unsolved underlying here.
Whiteboard: [leave open]
Comment 8•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in
before you can comment on or make changes to this bug.
Description
•