blob: 17d24dd2742cf828fdfedffebc08df95b24415c5 [file] [log] [blame]
This performs a number of different tests on JavaScript getters and setters.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
the get set object declaration syntax
PASS o1.b is 8
PASS o1.b is 11
__defineGetter__ and __defineSetter__
PASS o2.b is 8
PASS o2.b is 11
Setting a value without having a setter
PASS o3.x = 10; o3.x is 42
Getting a value without having a getter
PASS o4.x is undefined.
__lookupGetter__ and __lookupSetter__
PASS o4.__lookupGetter__('b') is getB
PASS o4.__lookupSetter__('b') is setB
__defineGetter__ and __defineSetter__ with various invalid arguments
PASS o5.__defineSetter__('a', null) threw exception TypeError: invalid setter usage.
PASS o5.__defineSetter__('a', o5) threw exception TypeError: invalid setter usage.
PASS o5.__defineGetter__('a', null) threw exception TypeError: invalid getter usage.
PASS o5.__defineGetter__('a', o5) threw exception TypeError: invalid getter usage.
setters and getters with exceptions
PASS x = o6.x threw exception Exception in get.
PASS x is 0
PASS o6.x = 42 threw exception Exception in set.
Defining a setter should also define a getter for the same property which returns undefined. Thus, a getter defined on the prototype should not be called.
PASS o7.x is undefined.
If an object has a property and its prototype has a setter function for that property, then setting the property should set the property directly and not call the setter function.
PASS o8.numSets is 0
PASS typeof testObj.getter is 'string'
the get set with string property name
PASS o9.b is 8
PASS o9.b is 11
the get set with numeric property name
PASS o10[42] is 8
PASS o10[42] is 11
Defining getter only and accessing __lookupSetter__ should not crash
PASS o11.__lookupSetter__('b') is void 0
Defining setter only and accessing __lookupGetter__ should not crash
PASS o12.__lookupGetter__('b') is void 0
When undefined, accessing __lookupGetter__ and __lookupSetter__ should not crash
PASS o13.__lookupGetter__('b') is void 0
PASS o13.__lookupSetter__('b') is void 0
__defineGetter__ and __defineSetter__ should throw exceptions when acting on sealed objects
PASS o14.__defineGetter__('a', function(){}) threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
PASS o14.__defineGetter__('b', function(){}) threw exception TypeError: Attempting to define property on object that is not extensible..
PASS o14.__defineSetter__('a', function(){}) threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
PASS o14.__defineSetter__('b', function(){}) threw exception TypeError: Attempting to define property on object that is not extensible..
__defineGetter__ and __defineSetter__ should throw exceptions when acting on frozen objects
PASS o15.__defineGetter__('a', function(){}) threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
PASS o15.__defineGetter__('b', function(){}) threw exception TypeError: Attempting to define property on object that is not extensible..
PASS o15.__defineSetter__('a', function(){}) threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
PASS o15.__defineSetter__('b', function(){}) threw exception TypeError: Attempting to define property on object that is not extensible..
__defineGetter__ and __defineSetter__ should throw exceptions when acting on unconfigurable properties
PASS o16.__defineGetter__('a', function(){}) did not throw exception.
PASS o16.__defineSetter__('a', function(){}) did not throw exception.
PASS o16.__defineSetter__('b', function(){}) threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
PASS o16.__defineSetter__('b', function(){}) threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
__lookupGetter__ can be interrupted by a proxy throwing an exception
PASS o17.property is "WebKit!"
PASS o17.__lookupGetter__('property') is getter17
PASS o17.__lookupSetter__('property') is undefined
PASS o17Proxy.__lookupGetter__('property') threw exception o17 Proxy raised exception.
PASS o17Proxy.__lookupSetter__('property') threw exception o17 Proxy raised exception.
PASS o17Proxy.property is "WebKit!"
PASS o17.property is "WebKit!"
PASS o17.__lookupGetter__('property') is getter17
__lookupSetter__ can be interrupted by a proxy throwing an exception
PASS o18.property = 5 is 5
PASS o18.property is undefined
PASS o18.value is 5
PASS o18.__lookupGetter__('property') is undefined
PASS o18.__lookupSetter__('property') is setter18
PASS o18Proxy.__lookupGetter__('property') threw exception o18 Proxy raised exception.
PASS o18Proxy.__lookupSetter__('property') threw exception o18 Proxy raised exception.
PASS o18Proxy.property = 'JavaScriptCore!' threw exception o18 Proxy raised exception.
PASS o18Proxy.property is undefined
PASS o18Proxy.value is 5
PASS o18.property = 'JavaScriptCore!' is "JavaScriptCore!"
PASS o18.property is undefined
PASS o18.value is "JavaScriptCore!"
PASS o18.__lookupGetter__('property') is undefined
PASS o18.__lookupSetter__('property') is setter18
PASS successfullyParsed is true
TEST COMPLETE