EncodedJSValue JSC_HOST_CALL dataViewProtoGetterByteOffset(ExecState* exec) { VM& vm = exec->vm(); auto scope = DECLARE_THROW_SCOPE(vm); JSDataView* view = jsDynamicCast<JSDataView*>(exec->thisValue()); if (!view) return throwVMTypeError(exec, scope, "DataView.prototype.buffer expects |this| to be a DataView object"); return JSValue::encode(jsNumber(view->byteOffset())); }
bool JSDataView::getOwnPropertySlot( JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSDataView* thisObject = jsCast<JSDataView*>(object); if (propertyName == exec->propertyNames().byteLength) { slot.setValue(thisObject, DontEnum | ReadOnly, jsNumber(thisObject->m_length)); return true; } if (propertyName == exec->propertyNames().byteOffset) { slot.setValue(thisObject, DontEnum | ReadOnly, jsNumber(thisObject->byteOffset())); return true; } return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); }