Ignore:
Timestamp:
May 27, 2011, 5:28:56 PM (14 years ago)
Author:
[email protected]
Message:

2011-05-27 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.

JS API is too aggressive about throwing exceptions for NULL get or set operations
https://bugs.webkit.org/show_bug.cgi?id=61678

  • API/JSCallbackObject.h: Changed our staticValueGetter to a regular function that returns a JSValue, so it can fail and still forward to normal property lookup.
  • API/JSCallbackObjectFunctions.h: (JSC::::getOwnPropertySlot): Don't throw an exception when failing to access a static property -- just forward the access. This allows objects to observe get/set operations but still let the JS object manage lifetime.

(JSC::::put): Ditto.

(JSC::::getStaticValue): Same as JSCallbackObject.h.

  • API/tests/testapi.c: (MyObject_set_nullGetForwardSet):
  • API/tests/testapi.js: Updated tests to reflect slightly less strict behavior, which matches headerdoc claims.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackObject.h

    r87586 r87588  
    189189    static EncodedJSValue JSC_HOST_CALL construct(ExecState*);
    190190   
    191     static JSValue staticValueGetter(ExecState*, JSValue, const Identifier&);
     191    JSValue getStaticValue(ExecState*, const Identifier&);
    192192    static JSValue staticFunctionGetter(ExecState*, JSValue, const Identifier&);
    193193    static JSValue callbackGetter(ExecState*, JSValue, const Identifier&);
Note: See TracChangeset for help on using the changeset viewer.