Ignore:
Timestamp:
Mar 28, 2011, 4:39:16 PM (14 years ago)
Author:
[email protected]
Message:

2011-03-28 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

instanceof Array test fails when using iframes
https://bugs.webkit.org/show_bug.cgi?id=17250

Add test cases for correct behaviour

  • fast/js/js-constructors-use-correct-global-expected.txt: Added.
  • fast/js/js-constructors-use-correct-global.html: Added.
  • fast/js/resources/js-constructors-use-correct-global.js: Added.

2011-03-28 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

instanceof Array test fails when using iframes
https://bugs.webkit.org/show_bug.cgi?id=17250

This is a problem with all built in constructors, the use of
lexicalGlobalObject rather than the constructors own
global object reference means that a builtin will always use
the prototype from the lexical global object rather than that
of the constructors origin.

  • API/JSObjectRef.cpp: (JSObjectMakeFunction): (JSObjectMakeRegExp):
  • JavaScriptCore.exp:
  • runtime/ArrayConstructor.cpp: (JSC::constructArrayWithSizeQuirk):
  • runtime/BooleanConstructor.cpp: (JSC::constructBoolean): (JSC::constructBooleanFromImmediateBoolean):
  • runtime/BooleanConstructor.h:
  • runtime/DateConstructor.cpp: (JSC::constructDate):
  • runtime/DateInstance.cpp:
  • runtime/DateInstance.h:
  • runtime/ErrorConstructor.cpp: (JSC::constructWithErrorConstructor): (JSC::callErrorConstructor):
  • runtime/FunctionConstructor.cpp: (JSC::constructWithFunctionConstructor): (JSC::callFunctionConstructor): (JSC::constructFunction):
  • runtime/FunctionConstructor.h:
  • runtime/JSCell.cpp: (JSC::JSCell::getOwnPropertySlot): (JSC::JSCell::put): (JSC::JSCell::deleteProperty): (JSC::JSCell::toThisObject): (JSC::JSCell::toObject):
  • runtime/JSCell.h: (JSC::JSCell::JSValue::toObject):
  • runtime/JSNotAnObject.cpp: (JSC::JSNotAnObject::toObject):
  • runtime/JSNotAnObject.h:
  • runtime/JSObject.cpp: (JSC::JSObject::toObject):
  • runtime/JSObject.h:
  • runtime/JSString.cpp: (JSC::StringObject::create): (JSC::JSString::toObject): (JSC::JSString::toThisObject):
  • runtime/JSString.h:
  • runtime/JSValue.cpp: (JSC::JSValue::toObjectSlowCase): (JSC::JSValue::toThisObjectSlowCase): (JSC::JSValue::synthesizeObject):
  • runtime/JSValue.h:
  • runtime/NumberConstructor.cpp: (JSC::constructWithNumberConstructor):
  • runtime/NumberObject.cpp: (JSC::constructNumber):
  • runtime/NumberObject.h:
  • runtime/ObjectConstructor.cpp: (JSC::constructObject): (JSC::constructWithObjectConstructor): (JSC::callObjectConstructor):
  • runtime/RegExpConstructor.cpp: (JSC::constructRegExp): (JSC::constructWithRegExpConstructor): (JSC::callRegExpConstructor):
  • runtime/RegExpConstructor.h:
  • runtime/StringConstructor.cpp: (JSC::constructWithStringConstructor):
  • runtime/StringObject.h:

2011-03-25 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

instanceof Array test fails when using iframes
https://bugs.webkit.org/show_bug.cgi?id=17250

Up date for new toObject api

  • UserObjectImp.cpp: (UserObjectImp::toPrimitive): (UserObjectImp::toBoolean): (UserObjectImp::toNumber): (UserObjectImp::toString):

2011-03-28 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

instanceof Array test fails when using iframes
https://bugs.webkit.org/show_bug.cgi?id=17250

Update for new function and date apis

Test: fast/js/js-constructors-use-correct-global.html

  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSDOMBinding.cpp: (WebCore::jsDateOrNull):
  • bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::initializeJSFunction):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSString.cpp

    r81071 r82173  
    254254}
    255255
    256 inline StringObject* StringObject::create(ExecState* exec, JSString* string)
    257 {
    258     return new (exec) StringObject(exec->globalData(), exec->lexicalGlobalObject()->stringObjectStructure(), string);
    259 }
    260 
    261 JSObject* JSString::toObject(ExecState* exec) const
    262 {
    263     return StringObject::create(exec, const_cast<JSString*>(this));
     256inline StringObject* StringObject::create(ExecState* exec, JSGlobalObject* globalObject, JSString* string)
     257{
     258    return new (exec) StringObject(exec->globalData(), globalObject->stringObjectStructure(), string);
     259}
     260
     261JSObject* JSString::toObject(ExecState* exec, JSGlobalObject* globalObject) const
     262{
     263    return StringObject::create(exec, globalObject, const_cast<JSString*>(this));
    264264}
    265265
    266266JSObject* JSString::toThisObject(ExecState* exec) const
    267267{
    268     return StringObject::create(exec, const_cast<JSString*>(this));
     268    return StringObject::create(exec, exec->lexicalGlobalObject(), const_cast<JSString*>(this));
    269269}
    270270
Note: See TracChangeset for help on using the changeset viewer.