Changeset 25256 in webkit for trunk/JavaScriptCore/API/testapi.c


Ignore:
Timestamp:
Aug 26, 2007, 11:02:50 PM (18 years ago)
Author:
bdash
Message:

2007-08-26 Mark Rowe <[email protected]>

Reviewed by Darin Adler.

<rdar://problem/5438496> JSGlobalContextCreate crashes when passed a custom class

  • API/JSContextRef.cpp: (JSGlobalContextCreate): Specify jsNull() as the prototype and let Interpreter's constructor fix it up to point at builtinObjectPrototype().
  • API/testapi.c: (main): Use an instance of a custom class as the global object to ensure the code path is exercised in the test.
File:
1 edited

Legend:

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

    r21342 r25256  
    478478    assert(Base_didFinalize);
    479479
    480     context = JSGlobalContextCreate(NULL);
     480    JSClassDefinition globalObjectClassDefinition = kJSClassDefinitionEmpty;
     481    JSClassRef globalObjectClass = JSClassCreate(&globalObjectClassDefinition);
     482    context = JSGlobalContextCreate(globalObjectClass);
    481483   
    482484    JSObjectRef globalObject = JSContextGetGlobalObject(context);
     
    815817    JSGlobalContextRelease(context);
    816818    JSGarbageCollect(context);
     819    JSClassRelease(globalObjectClass);
    817820
    818821    printf("PASS: Program exited normally.\n");
Note: See TracChangeset for help on using the changeset viewer.