Changeset 15484 in webkit for trunk/JavaScriptCore/API/minidom.c


Ignore:
Timestamp:
Jul 17, 2006, 3:49:28 AM (19 years ago)
Author:
ggaren
Message:

Reviewed by Maciej.


  • Removed the exception parameter from the initialize callback and, by extension, JSObjectMake. We have never had a need for exceptions when iniitializing, so the parameter seemed likely to "get in the way."


Also, an exception in JavaScript is thrown in response to input --
"invalid URL", "index not a number", etc., so it's the job of the
constructor function, not the initialize method, to throw.


If initialize *really* wants to throw, it can communicate the throw to
the constructor through the constructed object's private data (e.g., set
it to NULL, signaling to the consntructor that initialization failed.)


  • Added JSObjectMakeWithData, which enables a constructor to set private data on an object *before* it has been initialized. That way, the initialize methods can properly operate on the data.
  • API/JSNode.c: Moved ref into the initialize method, for better encapsulation, now that it's possible.
  • API/JSNodeList.c: ditto
  • API/minidom.c: (main): Do more aggressive garbage collection to test ref/deref and initialize/finalize.
  • API/minidom.js: store childNodes in a temporary so it doesn't get re-created like a thousand times. This makes debugging ref/deref easier
File:
1 edited

Legend:

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

    r15482 r15484  
    6565    free(scriptUTF8);
    6666
    67 #if 0 // used for leak/finalize debugging   
    68     int i;
    69     for (i = 0; i < 1000; i++) {
    70         JSObjectRef o = JSObjectMake(context, NULL, NULL);
    71         (void)o;
    72     }
    73     JSGarbageCollect();
    74 #endif
    75    
     67    globalObject = 0;
    7668    JSGlobalContextRelease(context);
     69    JSGarbageCollect(context);
    7770    printf("PASS: Program exited normally.\n");
    7871    return 0;
Note: See TracChangeset for help on using the changeset viewer.