WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
126004
Implement ArrayBuffer.isView
https://bugs.webkit.org/show_bug.cgi?id=126004
Summary
Implement ArrayBuffer.isView
Brent Fulgham
Reported
2013-12-19 11:49:11 PST
We need an implementation of ArrayBuffer.isView, added to the ECMA specification as of the May 14, 2013 draft: 15.13.5.4.2 ArrayBuffer.isView ( arg ) The isView function takes one argument arg, and performs the following steps are taken: 1. If Type(arg) is not Object, return false. 2. If arg is an exotic Array object, then return true. 3. If arg has a [[ViewedArrayBuffer]] internal data property, then return true. 4. Return false. This is needed to fully comply with WebGL requirements.
Attachments
Patch
(3.71 KB, patch)
2013-12-19 15:25 PST
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
Patch
(4.16 KB, patch)
2013-12-19 16:30 PST
,
Brent Fulgham
fpizlo
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Brent Fulgham
Comment 1
2013-12-19 15:22:44 PST
<
rdar://problem/15201822
>
Brent Fulgham
Comment 2
2013-12-19 15:25:13 PST
Created
attachment 219690
[details]
Patch
Oliver Hunt
Comment 3
2013-12-19 15:52:08 PST
Comment on
attachment 219690
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=219690&action=review
Almost there :)
> Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp:56 > + putDirectNativeFunction(vm, globalObject(), makeIdentifier(vm, ("isView")), 1, arrayBufferFuncIsView, NoIntrinsic, DontEnum |Function);
JSC_NATIVE_FUNCTION(vm.propertyNames->isView, arrayBufferFuncIsView, DontEnum, 1); Add isView to CommonIdentifiers
Brent Fulgham
Comment 4
2013-12-19 16:06:18 PST
Comment on
attachment 219690
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=219690&action=review
>> Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp:56 >> + putDirectNativeFunction(vm, globalObject(), makeIdentifier(vm, ("isView")), 1, arrayBufferFuncIsView, NoIntrinsic, DontEnum |Function); > > JSC_NATIVE_FUNCTION(vm.propertyNames->isView, arrayBufferFuncIsView, DontEnum, 1); > > Add isView to CommonIdentifiers
I tried using JSC_NATIVE_FUNCTION, but it assumes "globalObject" is defined in the current scope (except as a function), so the macro gives a syntax error.
Filip Pizlo
Comment 5
2013-12-19 16:10:17 PST
Comment on
attachment 219690
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=219690&action=review
R=me unless Oliver has super strong opinions about that macro.
>>> Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp:56 >>> + putDirectNativeFunction(vm, globalObject(), makeIdentifier(vm, ("isView")), 1, arrayBufferFuncIsView, NoIntrinsic, DontEnum |Function); >> >> JSC_NATIVE_FUNCTION(vm.propertyNames->isView, arrayBufferFuncIsView, DontEnum, 1); >> >> Add isView to CommonIdentifiers > > I tried using JSC_NATIVE_FUNCTION, but it assumes "globalObject" is defined in the current scope (except as a function), so the macro gives a syntax error.
Yeah, other places that use JSC_NATIVE_FUNCTION often have some pro-forma setup like: JSGlobalObject* globalObject = prototype->globalObjects(); Or whatever is appropriate. I don't mind that you're calling putDirectNativeFunction directly. But, you should add isView to CommonIdentifiers. Then you'll access it by saying vm.propertyNames->isView. This isn't a big deal, but it's nice to be consistent.
Brent Fulgham
Comment 6
2013-12-19 16:30:20 PST
Created
attachment 219699
[details]
Patch
Brent Fulgham
Comment 7
2013-12-19 16:39:37 PST
Committed
r160876
: <
http://trac.webkit.org/changeset/160876
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug