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


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.js

    r15482 r15484  
    199199    node.appendChild(child2);
    200200
    201     for (var i = 0; i < node.childNodes.length + 1; i++) {
    202         print("item " + i + ": " + node.childNodes.item(i));
    203     }
    204    
    205     for (var i = 0; i < node.childNodes.length + 1; i++) {
    206         print(i + ": " + node.childNodes[i]);
     201    var childNodes = node.childNodes;
     202   
     203    for (var i = 0; i < childNodes.length + 1; i++) {
     204        print("item " + i + ": " + childNodes.item(i));
     205    }
     206   
     207    for (var i = 0; i < childNodes.length + 1; i++) {
     208        print(i + ": " + childNodes[i]);
    207209    }
    208210
     
    210212    node.replaceChild(child3, child2);
    211213   
    212     for (var i = 0; i < node.childNodes.length + 1; i++) {
    213         print("item " + i + ": " + node.childNodes.item(i));
    214     }
    215 
    216     for (var i = 0; i < node.childNodes.length + 1; i++) {
    217         print(i + ": " + node.childNodes[i]);
     214    for (var i = 0; i < childNodes.length + 1; i++) {
     215        print("item " + i + ": " + childNodes.item(i));
     216    }
     217
     218    for (var i = 0; i < childNodes.length + 1; i++) {
     219        print(i + ": " + childNodes[i]);
    218220    }
    219221
Note: See TracChangeset for help on using the changeset viewer.