Changeset 266529 in webkit for trunk/Source/JavaScriptCore/runtime/JSDataView.cpp
- Timestamp:
- Sep 3, 2020, 10:04:09 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSDataView.cpp
r261755 r266529 49 49 50 50 ASSERT(buffer); 51 if (buffer->isNeutered()) { 52 throwTypeError(globalObject, scope, "Buffer is already detached"_s); 53 return nullptr; 54 } 51 55 if (!ArrayBufferView::verifySubRangeLength(*buffer, byteOffset, byteLength, sizeof(uint8_t))) { 52 throw VMError(globalObject, scope, createRangeError(globalObject, "Length out of range of buffer"_s));56 throwRangeError(globalObject, scope, "Length out of range of buffer"_s); 53 57 return nullptr; 54 58 } 55 59 if (!ArrayBufferView::verifyByteOffsetAlignment(byteOffset, sizeof(uint8_t))) { 56 throw Exception(globalObject, scope, createRangeError(globalObject, "Byte offset is not aligned"_s));60 throwRangeError(globalObject, scope, "Byte offset is not aligned"_s); 57 61 return nullptr; 58 62 } 63 59 64 ConstructionContext context( 60 65 structure, buffer.copyRef(), byteOffset, byteLength, ConstructionContext::DataView); … … 98 103 { 99 104 return DataView::create(unsharedBuffer(), byteOffset(), length()); 100 }101 102 bool JSDataView::getOwnPropertySlot(103 JSObject* object, JSGlobalObject* globalObject, PropertyName propertyName, PropertySlot& slot)104 {105 VM& vm = globalObject->vm();106 JSDataView* thisObject = jsCast<JSDataView*>(object);107 if (propertyName == vm.propertyNames->byteLength) {108 slot.setValue(thisObject, PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly, jsNumber(thisObject->m_length));109 return true;110 }111 if (propertyName == vm.propertyNames->byteOffset) {112 slot.setValue(thisObject, PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly, jsNumber(thisObject->byteOffset()));113 return true;114 }115 116 return Base::getOwnPropertySlot(thisObject, globalObject, propertyName, slot);117 105 } 118 106
Note:
See TracChangeset
for help on using the changeset viewer.