File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 5454 assert ( e . message === "foo" ) ;
5555 assert ( e instanceof ReferenceError ) ;
5656}
57+
58+ /* ES v5.1 15.4.4.3.1.
59+ Checking behavior when the function's this_argument is null */
60+ try {
61+ Array . prototype . toLocaleString . call ( null ) ;
62+ assert ( false ) ;
63+ } catch ( e ) {
64+ assert ( e instanceof TypeError ) ;
65+ }
66+
67+ /* ES v5.1 15.4.4.3.2.
68+ Checking behavior when length throws error */
69+ try {
70+ var obj = { } ;
71+ Object . defineProperty ( obj , 'length' , { 'get' : function ( ) { throw new ReferenceError ( "foo" ) ; } } ) ;
72+ Array . prototype . toLocaleString . call ( obj ) ;
73+ assert ( false ) ;
74+ } catch ( e ) {
75+ assert ( e instanceof ReferenceError ) ;
76+ assert ( e . message == "foo" ) ;
77+ }
78+
79+ /* ES v5.1 15.4.4.3.3.
80+ Checking behavior when length is an object, which has a valueOf method that throws an error */
81+ var len = { } ;
82+ Object . defineProperty ( len , 'valueOf' , { 'get' : function ( ) { throw new ReferenceError ( "vOf" ) ; } } ) ;
83+ var obj = { toLocaleString : Array . prototype . toLocaleString , length : len } ;
84+
85+ try {
86+ obj . toLocaleString ( ) ;
87+ assert ( false ) ;
88+ } catch ( e ) {
89+ assert ( e . message === 'vOf' ) ;
90+ assert ( e instanceof ReferenceError ) ;
91+ }
You can’t perform that action at this time.
0 commit comments