• vabr's avatar
    Fix error message for invalid buffer offset · 1dd803f9
    vabr authored
    The constructor for TypedArray in js/typedarray.js emitted
    kInvalidTypedArrayAlignment if the array offset exceeded the size of the
    underlying buffer. This seems like a typo introduced in
    https://codereview.chromium.org/2090353003.
    
    The error message to be emitted instead coincides with the already existing
    kInvalidDataViewOffset. The message string is independent of whether the
    object in question is a DataView or a typed array, so this CL:
      (1) renames kInvalidDataViewOffset to just kInvalidOffset, and
      (2) uses kInvalidOffset instead of kInvalidTypedArrayAlignment for cases
          when the TypedArray is constructed with an offset exceeding the buffer
          size.
    
    BUG=v8:5733
    TEST=Run d8, execute "new Uint8Array(new ArrayBuffer(1),2)", see the error message mention the invalid offset 2.
    
    Review-Url: https://codereview.chromium.org/2692753002
    Cr-Commit-Position: refs/heads/master@{#43151}
    1dd803f9
builtins-dataview.cc 12.7 KB