Ignore:
Timestamp:
May 14, 2009, 4:14:52 AM (16 years ago)
Author:
[email protected]
Message:

Fix <https://bugs.webkit.org/show_bug.cgi?id=25785>. Bug 25785: Segfault in mark when using JSObjectMakeConstructor

Reviewed by Oliver Hunt.

  • API/JSObjectRef.cpp:

(JSObjectMakeConstructor): OpaqueJSClass::prototype can return 0. We need to use the default object prototype when it does.

  • API/tests/testapi.c:

(main): Add a test case.

  • runtime/JSObject.h:

(JSC::JSObject::putDirect): Add a clearer assertion for a null value. The assertion on the next line does catch this,
but the cause of the failure is not clear from the assertion itself.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/tests/testapi.c

    r43603 r43692  
    11371137    JSStringRelease(script);
    11381138
     1139    // Verify that creating a constructor for a class with no static functions does not trigger
     1140    // an assert inside putDirect or lead to a crash during GC. <https://bugs.webkit.org/show_bug.cgi?id=25785>
     1141    nullDefinition = kJSClassDefinitionEmpty;
     1142    nullClass = JSClassCreate(&nullDefinition);
     1143    myConstructor = JSObjectMakeConstructor(context, nullClass, 0);
     1144    JSClassRelease(nullClass);
     1145
    11391146    char* scriptUTF8 = createStringWithContentsOfFile(scriptPath);
    11401147    if (!scriptUTF8) {
     
    11641171    o = NULL;
    11651172    globalObject = NULL;
     1173    myConstructor = NULL;
    11661174
    11671175    JSStringRelease(jsEmptyIString);
Note: See TracChangeset for help on using the changeset viewer.