Changeset 207204 in webkit


Ignore:
Timestamp:
Oct 12, 2016 1:41:25 AM (8 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r204868. rdar://problem/28216263

Location:
branches/safari-602-branch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-602-branch/JSTests/ChangeLog

    r207202 r207204  
     12016-10-12  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r204868. rdar://problem/28216263
     4
     5    2016-08-23  Keith Miller  <keith_miller@apple.com>
     6
     7            %TypedArray%.prototype.slice needs to check that the source and destination have not been detached.
     8            https://bugs.webkit.org/show_bug.cgi?id=161031
     9            <rdar://problem/27937019>
     10
     11            Reviewed by Geoffrey Garen.
     12
     13            * stress/typedarray-slice.js:
     14            (get let):
     15            (get try):
     16            (testSpeciesWithTransferring):
     17
    1182016-10-12  Matthew Hanson  <matthew_hanson@apple.com>
    219
  • branches/safari-602-branch/JSTests/stress/typedarray-slice.js

    r204434 r207204  
    136136    });
    137137}
    138 
    139138shouldBeTrue("forEachTypedArray(subclasses, testSpeciesWithSameBuffer)");
    140139
     140function testSpeciesWithTransferring(unused, constructor) {
     141
     142    let array = new constructor(10);
     143    Object.defineProperty(constructor, Symbol.species, { get() {
     144        transferArrayBuffer(array.buffer);
     145        return undefined;
     146    }, configurable: true });
     147
     148    try {
     149        array.slice(0,1);
     150        return false;
     151    } catch (e) { }
     152
     153    array = new constructor(10);
     154    Object.defineProperty(constructor, Symbol.species, { get() {
     155        return function(len) {
     156            let a = new constructor(len);
     157            transferArrayBuffer(a.buffer);
     158            return a;
     159        }
     160    }, configurable: true });
     161
     162    try {
     163        array.slice(0,1);
     164        return false;
     165    } catch (e) { }
     166
     167    return true;
     168}
     169
     170shouldBeTrue("forEachTypedArray(typedArrays, testSpeciesWithTransferring)");
    141171
    142172finishJSTest();
  • branches/safari-602-branch/Source/JavaScriptCore/ChangeLog

    r207202 r207204  
     12016-10-12  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r204868. rdar://problem/28216263
     4
     5    2016-08-23  Keith Miller  <keith_miller@apple.com>
     6
     7            %TypedArray%.prototype.slice needs to check that the source and destination have not been detached.
     8            https://bugs.webkit.org/show_bug.cgi?id=161031
     9            <rdar://problem/27937019>
     10
     11            Reviewed by Geoffrey Garen.
     12
     13            * runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
     14            (JSC::speciesConstruct):
     15            (JSC::genericTypedArrayViewProtoFuncSlice):
     16
    1172016-10-12  Matthew Hanson  <matthew_hanson@apple.com>
    218
  • branches/safari-602-branch/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h

    r203360 r207204  
    7070        return nullptr;
    7171
    72     if (JSArrayBufferView* view = jsDynamicCast<JSArrayBufferView*>(result))
    73         return view;
     72    if (JSArrayBufferView* view = jsDynamicCast<JSArrayBufferView*>(result)) {
     73        if (!view->isNeutered())
     74            return view;
     75
     76        throwTypeError(exec, typedArrayBufferHasBeenDetachedErrorMessage);
     77        return nullptr;
     78    }
    7479
    7580    throwTypeError(exec, ASCIILiteral("species constructor did not return a TypedArray View"));
     
    442447        return JSValue::encode(JSValue());
    443448
     449    ASSERT(!result->isNeutered());
     450    if (thisObject->isNeutered())
     451        return throwVMTypeError(exec, typedArrayBufferHasBeenDetachedErrorMessage);
     452
    444453    // We return early here since we don't allocate a backing store if length is 0 and memmove does not like nullptrs
    445454    if (!length)
Note: See TracChangeset for help on using the changeset viewer.