Ignore:
Timestamp:
Dec 10, 2015, 2:50:47 AM (10 years ago)
Author:
[email protected]
Message:

JSC Builtins should use safe array methods
https://bugs.webkit.org/show_bug.cgi?id=151501

Reviewed by Darin Adler.

Source/JavaScriptCore:

Adding @push and @shift to Array prototype.
Using @push in TypedArray built-in.

Covered by added test in LayoutTests/js/builtins

  • builtins/TypedArray.prototype.js:

(filter):

  • runtime/ArrayPrototype.cpp:

(JSC::ArrayPrototype::finishCreation):

  • runtime/CommonIdentifiers.h:

Source/WebCore:

Using @push and @shift in internal arrays in lieu of push and shift.
This cannot be disrupted by user scripts except if arrays are also made accessible to user scripts.

Covered by added tests for ReadableStream constructs.

  • Modules/mediastream/RTCPeerConnectionInternals.js:

(runNext):
(enqueueOperation):

  • Modules/streams/ReadableStreamInternals.js:

(enqueueInReadableStream):
(readFromReadableStreamReader):

  • Modules/streams/StreamInternals.js:

(dequeueValue):
(enqueueValueWithSize):

LayoutTests:

Adding shielding test for TypedArray.prototype.filter and stream enqueuing of values and read promises.

  • js/builtins/resources/shielding-typedarray.js: Added.

(Array.prototype.push):
(try.array.Int8Array.from.string_appeared_here.filter):

  • js/builtins/shielding-typedarray-expected.txt: Added.
  • js/builtins/shielding-typedarray.html: Added.
  • streams/streams-promises-expected.txt:
  • streams/streams-promises.html:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r193766 r193899  
    317317    macro(promiseRejectReactions) \
    318318    macro(promiseResult) \
     319    macro(push) \
    319320    macro(capabilities) \
    320321    macro(starDefault) \
     
    322323    macro(get) \
    323324    macro(set) \
     325    macro(shift) \
    324326    macro(allocateTypedArray) \
    325327    macro(Int8Array) \
Note: See TracChangeset for help on using the changeset viewer.