diff options
| author | Russell Brenner <russellbrenner@google.com> | 2010-11-18 17:33:13 -0800 |
|---|---|---|
| committer | Russell Brenner <russellbrenner@google.com> | 2010-12-02 13:47:21 -0800 |
| commit | 6b70adc33054f8aee8c54d0f460458a9df11b8a5 (patch) | |
| tree | 103a13998c33944d6ab3b8318c509a037e639460 /JavaScriptCore/runtime/JSFunction.cpp | |
| parent | bdf4ebc8e70b2d221b6ee7a65660918ecb1d33aa (diff) | |
| download | external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.zip external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.gz external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.bz2 | |
Merge WebKit at r72274: Initial merge by git.
Change-Id: Ie51f0b4a16da82942bd516dce59cfb79ebbe25fb
Diffstat (limited to 'JavaScriptCore/runtime/JSFunction.cpp')
| -rw-r--r-- | JavaScriptCore/runtime/JSFunction.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp index 0697fc3..ba89d04 100644 --- a/JavaScriptCore/runtime/JSFunction.cpp +++ b/JavaScriptCore/runtime/JSFunction.cpp @@ -45,9 +45,7 @@ namespace JSC { #if ENABLE(JIT) EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState* exec) { - CodeBlock* codeBlock = exec->callerFrame()->codeBlock(); - unsigned vPCIndex = codeBlock->bytecodeOffset(exec, exec->returnPC()); - return throwVMError(exec, createNotAConstructorError(exec, exec->callee(), vPCIndex, codeBlock)); + return throwVMError(exec, createNotAConstructorError(exec, exec->callee())); } #endif @@ -284,6 +282,10 @@ bool JSFunction::getOwnPropertyDescriptor(ExecState* exec, const Identifier& pro void JSFunction::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { if (!isHostFunction() && (mode == IncludeDontEnumProperties)) { + // Make sure prototype has been reified. + PropertySlot slot; + getOwnPropertySlot(exec, exec->propertyNames().prototype, slot); + propertyNames.add(exec->propertyNames().arguments); propertyNames.add(exec->propertyNames().callee); propertyNames.add(exec->propertyNames().caller); @@ -298,6 +300,12 @@ void JSFunction::put(ExecState* exec, const Identifier& propertyName, JSValue va Base::put(exec, propertyName, value, slot); return; } + if (propertyName == exec->propertyNames().prototype) { + // Make sure prototype has been reified, such that it can only be overwritten + // following the rules set out in ECMA-262 8.12.9. + PropertySlot slot; + getOwnPropertySlot(exec, propertyName, slot); + } if (jsExecutable()->isStrictMode()) { if (propertyName == exec->propertyNames().arguments) { throwTypeError(exec, StrictModeArgumentsAccessError); |
