From a4e969f4965059196ca948db781e52f7cfebf19e Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 24 May 2016 08:28:08 +0000 Subject: webkitgtk-2.12.3 --- .../runtime/JSArrayBufferConstructor.cpp | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp') diff --git a/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp b/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp index ca7e030e8..03f077784 100644 --- a/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp +++ b/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (C) 2013, 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,17 +28,18 @@ #include "Error.h" #include "ExceptionHelpers.h" +#include "GetterSetter.h" #include "JSArrayBuffer.h" #include "JSArrayBufferPrototype.h" #include "JSGlobalObject.h" -#include "Operations.h" +#include "JSCInlines.h" namespace JSC { static EncodedJSValue JSC_HOST_CALL arrayBufferFuncIsView(ExecState*); const ClassInfo JSArrayBufferConstructor::s_info = { - "Function", &Base::s_info, 0, 0, + "Function", &Base::s_info, 0, CREATE_METHOD_TABLE(JSArrayBufferConstructor) }; @@ -47,22 +48,23 @@ JSArrayBufferConstructor::JSArrayBufferConstructor(VM& vm, Structure* structure) { } -void JSArrayBufferConstructor::finishCreation(VM& vm, JSArrayBufferPrototype* prototype) +void JSArrayBufferConstructor::finishCreation(VM& vm, JSArrayBufferPrototype* prototype, GetterSetter* speciesSymbol) { - Base::finishCreation(vm, "ArrayBuffer"); + Base::finishCreation(vm, ASCIILiteral("ArrayBuffer")); putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontEnum | DontDelete | ReadOnly); + putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); JSGlobalObject* globalObject = this->globalObject(); - JSC_NATIVE_FUNCTION(vm.propertyNames->isView, arrayBufferFuncIsView, DontEnum, 1); + JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->isView, arrayBufferFuncIsView, DontEnum, 1); } -JSArrayBufferConstructor* JSArrayBufferConstructor::create(VM& vm, Structure* structure, JSArrayBufferPrototype* prototype) +JSArrayBufferConstructor* JSArrayBufferConstructor::create(VM& vm, Structure* structure, JSArrayBufferPrototype* prototype, GetterSetter* speciesSymbol) { JSArrayBufferConstructor* result = new (NotNull, allocateCell(vm.heap)) JSArrayBufferConstructor(vm, structure); - result->finishCreation(vm, prototype); + result->finishCreation(vm, prototype, speciesSymbol); return result; } @@ -92,14 +94,19 @@ static EncodedJSValue JSC_HOST_CALL constructArrayBuffer(ExecState* exec) RefPtr buffer = ArrayBuffer::create(length, 1); if (!buffer) - return throwVMError(exec, createOutOfMemoryError(constructor->globalObject())); - - JSArrayBuffer* result = JSArrayBuffer::create( - exec->vm(), constructor->globalObject()->arrayBufferStructure(), buffer); + return throwVMError(exec, createOutOfMemoryError(exec)); + + Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), constructor->globalObject()->arrayBufferStructure()); + JSArrayBuffer* result = JSArrayBuffer::create(exec->vm(), arrayBufferStructure, buffer.release()); return JSValue::encode(result); } +static EncodedJSValue JSC_HOST_CALL callArrayBuffer(ExecState* exec) +{ + return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(exec, "ArrayBuffer")); +} + ConstructType JSArrayBufferConstructor::getConstructData( JSCell*, ConstructData& constructData) { @@ -109,7 +116,7 @@ ConstructType JSArrayBufferConstructor::getConstructData( CallType JSArrayBufferConstructor::getCallData(JSCell*, CallData& callData) { - callData.native.function = constructArrayBuffer; + callData.native.function = callArrayBuffer; return CallTypeHost; } -- cgit v1.2.1