[Webkit-unassigned] [Bug 181011] New: JavaScript subclasses of typed arrays produce incorrect type when .of() is called

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 19 16:40:56 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=181011

            Bug ID: 181011
           Summary: JavaScript subclasses of typed arrays produce
                    incorrect type when .of() is called
           Product: WebKit
           Version: Safari 11
          Hardware: iPhone / iPad
                OS: iOS 11
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: garett.ridge at gmail.com

I show a very small demo of this bug here:

https://jsfiddle.net/dumb_lowtax/4pfn6e6L/

The short snippet there outputs a different result on iPhones and iPads than everywhere else.  It tries subclassing Float32Array and adding to it a method called "times()" for multiplying by a scalar.  This custom method comes up as undefined when using iOS.  In practice this means that my WebGL game engine works on all platforms except Apple, where all the basic vector types don't work.

The snippet helpfully logs the result of "v instanceof Vec" where Vec extends a typed array and v was created with .of(). That too shows different results only on those devices, exposing the root problem.  The built in of() functionality is returning type Float32Array instead of Vec.  Hovering over the variable in Web Inspector corroborates this.

Weirdness that I've experienced in the past with subclassing the typed arrays and getting unexpected behavior is already the reason I'm having to use "Vec.of( 1,2,3 )" everywhere, instead of just saying "new Vec( 1,2,3 )".

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20171220/6d6b0224/attachment.html>


More information about the webkit-unassigned mailing list