Changeset 15473 in webkit for trunk/JavaScriptCore/API/testapi.js


Ignore:
Timestamp:
Jul 16, 2006, 6:48:27 PM (19 years ago)
Author:
ggaren
Message:

Reviewed by Maciej.


  • Properly document and handle NULL callbacks for static properties. We throw an exception in any case other than a ReadOnly property with a NULL setProperty callback, because a NULL callback almost certainly indicates a programming error. Also throw an exception if hasProperty returns true for a property that getProperty can't get.


  • If a static setProperty callback returns 'false', to indicate that the property was not set, we no longer forward the set request up the class chain, because that's almost certainly not what the programmer expected.
  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::getOwnPropertySlot): (KJS::JSCallbackObject::put): (KJS::JSCallbackObject::staticValueGetter): (KJS::JSCallbackObject::staticFunctionGetter): (KJS::JSCallbackObject::callbackGetter):
  • API/JSObjectRef.h:
  • API/minidom.js:
  • API/testapi.c: (MyObject_hasProperty):
  • API/testapi.js:
File:
1 edited

Legend:

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

    r15462 r15473  
    4040}
    4141
     42function shouldThrow(a)
     43{
     44    var result = "__FAIL__: " + a + " did not throw an exception.";
     45   
     46    var evalA;
     47    try {
     48        eval(a);
     49    } catch(e) {
     50        result = "PASS: " + a + " threw: " + e;
     51    }
     52   
     53    print(result);
     54}
     55
    4256shouldBe("typeof MyObject", "function"); // our object implements 'call'
    4357MyObject.cantFind = 1;
     
    6983      : "__FAIL__: MyObject.regularType was not enumerated");
    7084
     85myObject = new MyObject();
     86
    7187shouldBe("delete MyObject.regularType", true);
    7288shouldBe("MyObject.regularType", undefined);
    7389shouldBe("MyObject(0)", 1);
    7490shouldBe("MyObject()", undefined);
    75 shouldBe("typeof new MyObject()", "object");
     91shouldBe("typeof myObject", "object");
    7692shouldBe("MyObject ? 1 : 0", true); // toBoolean
    7793shouldBe("+MyObject", 1); // toNumber
     
    8399shouldBe("typeof constructedObject", "object");
    84100shouldBe("constructedObject.value", 1);
    85 shouldBe("(new MyObject()) instanceof MyObject", true);
     101shouldBe("myObject instanceof MyObject", true);
    86102shouldBe("(new Object()) instanceof MyObject", false);
     103
     104shouldThrow("MyObject.nullGetSet = 1");
     105shouldThrow("MyObject.nullGetSet");
     106shouldThrow("MyObject.nullCall()");
     107shouldThrow("MyObject.hasPropertyLie");
Note: See TracChangeset for help on using the changeset viewer.