Changeset 84583 in webkit


Ignore:
Timestamp:
Apr 21, 2011 6:30:50 PM (13 years ago)
Author:
oliver@apple.com
Message:

2011-04-21 Oliver Hunt <oliver@apple.com>

Reviewed by Geoffrey Garen.

Object.create creates uncachable objects
https://bugs.webkit.org/show_bug.cgi?id=59164

Use the prototype object's inheritorID, as we
should always have done

  • runtime/ObjectConstructor.cpp: (JSC::objectConstructorCreate):
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r84556 r84583  
     12011-04-21  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Object.create creates uncachable objects
     6        https://bugs.webkit.org/show_bug.cgi?id=59164
     7
     8        Use the prototype object's inheritorID, as we
     9        should always have done
     10
     11        * runtime/ObjectConstructor.cpp:
     12        (JSC::objectConstructorCreate):
     13
    1142011-04-21  Oliver Hunt  <oliver@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp

    r84052 r84583  
    342342    if (!exec->argument(0).isObject() && !exec->argument(0).isNull())
    343343        return throwVMError(exec, createTypeError(exec, "Object prototype may only be an Object or null."));
    344     JSObject* newObject = constructEmptyObject(exec);
    345     newObject->setPrototype(exec->globalData(), exec->argument(0));
     344    JSValue proto = exec->argument(0);
     345    JSObject* newObject = proto.isObject() ? constructEmptyObject(exec, asObject(proto)->inheritorID(exec->globalData())) : constructEmptyObject(exec);
    346346    if (exec->argument(1).isUndefined())
    347347        return JSValue::encode(newObject);
Note: See TracChangeset for help on using the changeset viewer.