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.
<rdar://problem/15201822>
Created attachment 219690 [details] Patch
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
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.
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.
Created attachment 219699 [details] Patch
Committed r160876: <http://trac.webkit.org/changeset/160876>