diff options
author | David Fugate <dfugate@microsoft.com> | 2011-10-03 12:20:26 -0700 |
---|---|---|
committer | David Fugate <dfugate@microsoft.com> | 2011-10-03 12:20:26 -0700 |
commit | 69a1080bb68f1b28abd72e33b730f790bbb69aae (patch) | |
tree | 7cceccd22522fa9ceacd8f8b0ab510567f5c7c27 /test/suite/ch10/10.4 | |
parent | 6c9436f9775c83ad2ac18dfdab36d2a3aceff24e (diff) |
Renamed Sputnik directories.
Diffstat (limited to 'test/suite/ch10/10.4')
28 files changed, 822 insertions, 0 deletions
diff --git a/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T1.js b/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T1.js new file mode 100644 index 000000000..0c45db329 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Variable instantiation is performed using the global object as + * the variable object and using property attributes { DontDelete } + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.1_Global_Code/S10.2.1_A1_T1.js + * @description Checking if deleting variable x, that is defined as var x = 1, fails + * @noStrict + */ + +var x = 1; + +if (this.x !== 1) { + $ERROR("#1: variable x is a property of global object"); +} + +if(delete this.x !== false){ + $ERROR("#2: variable x has property attribute DontDelete"); +} + diff --git a/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T2.js b/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T2.js new file mode 100644 index 000000000..62649b112 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Variable instantiation is performed using the global object as + * the variable object and using property attributes { DontDelete } + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.1_Global_Code/S10.2.1_A1_T2.js + * @description Checking if deleting variable x, that is defined as x = 1, fails + * @noStrict + */ + +x = 1; + +if (this.x !== 1) { + $ERROR("#1: variable x is a property of global object"); +} + +if(delete this.x !== true){ + $ERROR("#2: variable x has property attribute DontDelete"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2.1_A1.js b/test/suite/ch10/10.4/10.4.2/S10.4.2.1_A1.js new file mode 100644 index 000000000..764096f5e --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2.1_A1.js @@ -0,0 +1,17 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.4.2.1_A1.js + * @description Strict indirect eval should not leak top level + * declarations into the global scope + * @onlyStrict + */ + +"use strict"; +if (!('foo' in this)) { + (1,eval)('"use strict"; var foo = 88;'); + if ('foo' in this) { + $ERROR("Strict indirect eval leaked a top level declaration"); + } +} diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js new file mode 100644 index 000000000..392671d41 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T1.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +x = 1; +y = 2; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T10.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T10.js new file mode 100644 index 000000000..b70968fcc --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T10.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T10.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +var x = 1; +var y = 2; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T11.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T11.js new file mode 100644 index 000000000..592c20d57 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T11.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T11.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +this.x = 1; +this.y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T2.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T2.js new file mode 100644 index 000000000..488b9f687 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T2.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +var x = 1; +var y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T3.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T3.js new file mode 100644 index 000000000..2e3154445 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T3.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +this.x = 1; +this.y = 2; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T4.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T4.js new file mode 100644 index 000000000..766f56e0f --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T4.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T4.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T5.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T5.js new file mode 100644 index 000000000..ae42f8a44 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T5.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T5.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +var x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +var y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T6.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T6.js new file mode 100644 index 000000000..e2672f2fe --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T6.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T6.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +this.x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +this.y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T7.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T7.js new file mode 100644 index 000000000..0e8dbd75e --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T7.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T7.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +var y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T8.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T8.js new file mode 100644 index 000000000..9790ee0be --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T8.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T8.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +this.x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +var y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T9.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T9.js new file mode 100644 index 000000000..7c17ef319 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T9.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T9.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +x = 1; +y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T1.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T1.js new file mode 100644 index 000000000..c15e1c94e --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T1.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + x = 1; + y = 2; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + return (str1 === str2); +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T10.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T10.js new file mode 100644 index 000000000..8dfd67ad0 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T10.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T10.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + var x = 1; + var y = 2; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T11.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T11.js new file mode 100644 index 000000000..3e9050a1f --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T11.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T11.js + * @description eval within global execution context + * @noStrict + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + this.x = 1; + this.y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T2.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T2.js new file mode 100644 index 000000000..a369d83f8 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T2.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + var x = 1; + var y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T3.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T3.js new file mode 100644 index 000000000..73fface0f --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T3.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + this.x = 1; + this.y = 2; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T4.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T4.js new file mode 100644 index 000000000..41e682e93 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T4.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T4.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T5.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T5.js new file mode 100644 index 000000000..167f4c00d --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T5.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T5.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + var x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + var y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T6.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T6.js new file mode 100644 index 000000000..0287368d4 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T6.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T6.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + this.x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + this.y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T7.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T7.js new file mode 100644 index 000000000..07793ab96 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T7.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T7.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + var y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T8.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T8.js new file mode 100644 index 000000000..78d1e533f --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T8.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T8.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + this.x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + var y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T9.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T9.js new file mode 100644 index 000000000..5f8ee314c --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T9.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T9.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + x = 1; + y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + diff --git a/test/suite/ch10/10.4/10.4.3/S10.4.3_A1.js b/test/suite/ch10/10.4/10.4.3/S10.4.3_A1.js new file mode 100644 index 000000000..3b6f8f8d4 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.3/S10.4.3_A1.js @@ -0,0 +1,16 @@ +// Copyright 2011 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.3_Entering_Function_Code/S10.4.3_A1.js + * @description When calling a strict anonymous function as a + * function, "this" should be bound to undefined. + * @onlyStrict + */ + +"use strict"; +var that = (function() { return this; })(); +if (that !== undefined) { + $ERROR('#1: "this" leaked as: ' + that); +} + diff --git a/test/suite/ch10/10.4/S10.4A1.1_T2.js b/test/suite/ch10/10.4/S10.4A1.1_T2.js new file mode 100644 index 000000000..ff1c394b1 --- /dev/null +++ b/test/suite/ch10/10.4/S10.4A1.1_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every function call enters a new execution context + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/S10.2_A1.1_T2.js + * @description Recursive function call + */ + +var y; + +function f(a){ + var x; + + if (a === 1) + return x; + else { + if(x === undefined) { + x = 0; + } else { + x = 1; + } + return f(1); + } +} + +y = f(0); + +if(!(y === undefined)){ + $ERROR("#1: Recursive function calls shares execution context"); +} + diff --git a/test/suite/ch10/10.4/S10.4_A1.1_T1.js b/test/suite/ch10/10.4/S10.4_A1.1_T1.js new file mode 100644 index 000000000..87768c693 --- /dev/null +++ b/test/suite/ch10/10.4/S10.4_A1.1_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every function call enters a new execution context + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/S10.2_A1.1_T1.js + * @description Sequence of function calls + */ + +var y; + +function f(){ + var x; + + if(x === undefined) { + x = 0; + } else { + x = 1; + } + + return x; +} + +y = f(); +y = f(); + +if(!(y === 0)){ + $ERROR("#1: Sequenced function calls shares execution context"); +} + |