Bug 24268 - RuntimeArray is not a fully implemented JSArray
Summary: RuntimeArray is not a fully implemented JSArray
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Oliver Hunt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-28 23:54 PST by sofro
Modified: 2009-03-08 03:47 PDT (History)
1 user (show)

See Also:


Attachments
Fixeration (1.44 KB, patch)
2009-03-01 01:05 PST, Oliver Hunt
zwarich: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sofro 2009-02-28 23:54:10 PST
RuntimeArray class from WebCore/bridge has the class info parent JSArray::info. Therefore, it will be treated like a JSArray in function arrayProtoFuncConcat from JavaScriptCore::ArrayPrototype class. When an object of type RuntimeArray will be cast to JSArray, the cast will succeed, but the function arrayProtoFuncConcat will crash when attempting to call length method, that is implemented in JSArray but not in RuntimeArray.
Comment 1 Oliver Hunt 2009-03-01 00:01:43 PST
The issue is relatively trivial to fix -- we shouldn't be blindly casting to a JSArray just because an object descends from Array in JS.
Comment 2 Oliver Hunt 2009-03-01 01:05:22 PST
Created attachment 28136 [details]
Fixeration

This fixes the error
Comment 3 Alexey Proskuryakov 2009-03-01 05:48:48 PST
> arrayProtoFuncConcat will crash when attempting to call length method, that is

Can a test case be written for this?
Comment 4 Oliver Hunt 2009-03-01 05:53:32 PST
I'm unsure how to get a runtime array to be created... conceivably i could get drt to instantiate a fabricated class that just claimed to be a JSArray.  Will look into it.
Comment 5 Darin Adler 2009-03-01 10:52:26 PST
Comment on attachment 28136 [details]
Fixeration

I'm not going to say review+ because I think this needs a regression test.
Comment 6 Oliver Hunt 2009-03-08 03:27:09 PDT
Making a testcase for this appears infeasible -- i've tried for  afew hours just to make a java applet that is capable of scripting to no avail.  I am honestly not surprised applets died given my experience with them.  DRT is also unable to fudge an appropriate JS object as it doesn't have access to the required SPI.
Comment 7 Cameron Zwarich (cpst) 2009-03-08 03:32:48 PDT
Comment on attachment 28136 [details]
Fixeration

r=me, although you should explain that you can't make a test in your ChangeLog.
Comment 8 Oliver Hunt 2009-03-08 03:47:46 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	JavaScriptCore/ChangeLog
	M	JavaScriptCore/runtime/ArrayPrototype.cpp
Committed r41518