diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/language/directive-prologue | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/directive-prologue')
64 files changed, 1297 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-1-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-1-s.js new file mode 100644 index 0000000000..a0d3d38f42 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-1-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-1-s +description: > + Strict Mode - Use Strict Directive Prologue is 'use strict'; + which contains two space between 'use' and 'strict' +flags: [noStrict] +---*/ + +function testcase() { + "use strict"; + var public = 1; + + assert.sameValue(public, 1); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-10-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-10-s.js new file mode 100644 index 0000000000..9cafeb1c18 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-10-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-10-s +description: > + Strict Mode - Use Strict Directive Prologue is ''USE STRICT';' in + which all characters are uppercase +flags: [noStrict] +---*/ + +function testcase() { + "USE STRICT"; + var public = 1; + + assert.sameValue(public, 1); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-11-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-11-s.js new file mode 100644 index 0000000000..1a9dc93623 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-11-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-11-s +description: > + Strict Mode - Eval code is strict code with a Use Strict Directive + at the beginning of the block +flags: [noStrict] +---*/ + +var err = null; + + try { + eval("'use strict'; var public = 1; var anotherVariableNotReserveWord = 2;"); + } catch (e) { + err = e; + } + +assert(err instanceof SyntaxError, 'err instanceof SyntaxError'); +assert.sameValue(typeof public, "undefined", 'typeof public'); +assert.sameValue(typeof anotherVariableNotReserveWord, "undefined", 'typeof anotherVariableNotReserveWord'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-12-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-12-s.js new file mode 100644 index 0000000000..7fa116d4ef --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-12-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-12-s +description: > + Strict Mode - Eval code is strict eval code with a Use Strict + Directive in the middle of the block +flags: [noStrict] +---*/ + + eval("var public = 1; 'use strict'; var anotherVariableNotReserveWord = 2;"); + +assert.sameValue(public, 1, 'public'); +assert.sameValue(anotherVariableNotReserveWord, 2, 'anotherVariableNotReserveWord'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-13-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-13-s.js new file mode 100644 index 0000000000..1a77bc5bb8 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-13-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-13-s +description: > + Strict Mode - Eval code is strict eval code with a Use Strict + Directive at the end of the block +flags: [noStrict] +---*/ + + eval("var public = 1; var anotherVariableNotReserveWord = 2; 'use strict';"); + +assert.sameValue(public, 1, 'public'); +assert.sameValue(anotherVariableNotReserveWord, 2, 'anotherVariableNotReserveWord'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-14-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-14-s.js new file mode 100644 index 0000000000..85a50eec22 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-14-s.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-14-s +description: > + Strict Mode - The call to eval function is contained in a Strict + Mode block +flags: [noStrict] +---*/ + +assert.throws(SyntaxError, function() { + 'use strict'; + + eval("var public = 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-28-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-28-s.js new file mode 100644 index 0000000000..a1e6888836 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-28-s.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-28-s +description: > + Strict Mode - Function code of Accessor PropertyAssignment + contains Use Strict Directive which appears at the end of the + block(setter) +flags: [noStrict] +---*/ + + var obj = {}; + var data; + + Object.defineProperty(obj, "accProperty", { + set: function (value) { + var _10_1_1_28_s = {a:1, a:2}; + data = value; + "use strict"; + } + }); + obj.accProperty = "overrideData"; + +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-29-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-29-s.js new file mode 100644 index 0000000000..9fce1cfde2 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-29-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-29-s +description: > + Strict Mode - The built-in Function constructor is contained in + use strict code +flags: [noStrict] +---*/ + +function testcase() { + "use strict"; + var funObj = new Function("a", "eval('public = 1;');"); + funObj(); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-2gs.js b/js/src/tests/test262/language/directive-prologue/10.1.1-2gs.js new file mode 100644 index 0000000000..df4b4bcce6 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-2gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-2gs +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict'' + which lost the last character ';' +negative: + phase: parse + type: SyntaxError +flags: [raw] +---*/ + +"use strict" +throw "Test262: This statement should not be evaluated."; +var public = 1; diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-3-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-3-s.js new file mode 100644 index 0000000000..2baf04c868 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-3-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-3-s +description: > + Strict Mode - Use Strict Directive Prologue is '' use strict';' + which the first character is space +flags: [noStrict] +---*/ + +function testcase() { + " use strict"; + var public = 1; + + assert.sameValue(public, 1); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-30-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-30-s.js new file mode 100644 index 0000000000..a23c53a373 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-30-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-30-s +description: > + Strict Mode - Function code of built-in Function constructor + contains Use Strict Directive which appears at the start of the + block +flags: [noStrict] +---*/ + + +assert.throws(SyntaxError, function() { + var funObj = new Function("a", "'use strict'; eval('public = 1;');"); + funObj(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-31-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-31-s.js new file mode 100644 index 0000000000..f5b2492323 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-31-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-31-s +description: > + Strict Mode - Function code of built-in Function constructor + contains Use Strict Directive which appears in the middle of the + block +flags: [noStrict] +---*/ + + + var funObj = new Function("a", "eval('public = 1;'); 'use strict'; anotherVariable = 2;"); + funObj(); + +assert.sameValue(public, 1, 'public'); +assert.sameValue(anotherVariable, 2, 'anotherVariable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-32-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-32-s.js new file mode 100644 index 0000000000..0c09479a6d --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-32-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-32-s +description: > + Strict Mode - Function code of built-in Function constructor + contains Use Strict Directive which appears at the end of the block +flags: [noStrict] +---*/ + + + var funObj = new Function("a", "eval('public = 1;'); anotherVariable = 2; 'use strict';"); + funObj(); + +assert.sameValue(public, 1, 'public'); +assert.sameValue(anotherVariable, 2, 'anotherVariable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-4-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-4-s.js new file mode 100644 index 0000000000..7e3edb476b --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-4-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-4-s +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict ';' + which the last character is space +flags: [noStrict] +---*/ + +function testcase() { + "use strict "; + var public = 1; + + assert.sameValue(public, 1); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-5-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-5-s.js new file mode 100644 index 0000000000..cebf07e674 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-5-s.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-5-s +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict';' + which appears at the beginning of the block +flags: [noStrict] +---*/ + +assert.throws(SyntaxError, function() { + "use strict"; + + eval("var public = 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-5gs.js b/js/src/tests/test262/language/directive-prologue/10.1.1-5gs.js new file mode 100644 index 0000000000..f3f8e2acf1 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-5gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-5gs +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict';' + which appears at the start of the code +negative: + phase: parse + type: SyntaxError +flags: [raw] +---*/ + +"use strict"; +throw "Test262: This statement should not be evaluated."; +var public = 1; diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-6-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-6-s.js new file mode 100644 index 0000000000..b86009ff26 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-6-s.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-6-s +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict';' + which appears in the middle of the block +flags: [noStrict] +---*/ + +function testcase() { + var interface = 2; + "use strict"; + var public = 1; + + assert.sameValue(public, 1, 'public'); + assert.sameValue(interface, 2, 'interface'); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-7-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-7-s.js new file mode 100644 index 0000000000..2d6f1bd903 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-7-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-7-s +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict';' + which appears at the end of the block +flags: [noStrict] +---*/ + +function testcase() { + var public = 1; + assert.sameValue(public, 1); + "use strict"; + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-8-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-8-s.js new file mode 100644 index 0000000000..af68bf0635 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-8-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-8-s +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict';' + which appears twice in the directive prologue +flags: [noStrict] +---*/ + +assert.throws(SyntaxError, function() { + "use strict"; + "use strict"; + + eval("var public = 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-8gs.js b/js/src/tests/test262/language/directive-prologue/10.1.1-8gs.js new file mode 100644 index 0000000000..33f979ef05 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-8gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-8gs +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict';' + which appears twice in the code +negative: + phase: parse + type: SyntaxError +flags: [raw] +---*/ + +"use strict"; +"use strict"; +throw "Test262: This statement should not be evaluated."; +var public = 1; diff --git a/js/src/tests/test262/language/directive-prologue/10.1.1-9-s.js b/js/src/tests/test262/language/directive-prologue/10.1.1-9-s.js new file mode 100644 index 0000000000..4f4de68a2e --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/10.1.1-9-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1-9-s +description: > + Strict Mode - Use Strict Directive Prologue is ''Use strict';' in + which the first character is uppercase +flags: [noStrict] +---*/ + +function testcase() { + "Use strict"; + var public = 1; + assert.sameValue(public, 1); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-1-s.js b/js/src/tests/test262/language/directive-prologue/14.1-1-s.js new file mode 100644 index 0000000000..109c3a118c --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-1-s.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-1-s +description: "'use strict' directive - correct usage" +flags: [noStrict] +---*/ + + function foo() + { + 'use strict'; + return(this === undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-10-s.js b/js/src/tests/test262/language/directive-prologue/14.1-10-s.js new file mode 100644 index 0000000000..10426de78e --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-10-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-10-s +description: other directives - may follow 'use strict' directive +flags: [noStrict] +---*/ + + function foo() + { + "use strict"; + "bogus directive"; + return (this === undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-11-s.js b/js/src/tests/test262/language/directive-prologue/14.1-11-s.js new file mode 100644 index 0000000000..56db5c0fb8 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-11-s.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-11-s +description: comments may precede 'use strict' directive +flags: [noStrict] +---*/ + + function foo() + { + // comment + /* comment */ "use strict"; + + return(this === undefined); + + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-12-s.js b/js/src/tests/test262/language/directive-prologue/14.1-12-s.js new file mode 100644 index 0000000000..edd46c3b53 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-12-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-12-s +description: comments may follow 'use strict' directive +flags: [noStrict] +---*/ + + function foo() + { + "use strict"; /* comment */ // comment + + return (this === undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-13-s.js b/js/src/tests/test262/language/directive-prologue/14.1-13-s.js new file mode 100644 index 0000000000..2d6fa23350 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-13-s.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-13-s +description: semicolon insertion works for'use strict' directive +flags: [noStrict] +---*/ + + function foo() + { + "use strict" + return (this === undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-14-s.js b/js/src/tests/test262/language/directive-prologue/14.1-14-s.js new file mode 100644 index 0000000000..46171b8ccb --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-14-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-14-s +description: semicolon insertion may come before 'use strict' directive +flags: [noStrict] +---*/ + + function foo() + { + "another directive" + "use strict" ; + return (this === undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-15-s.js b/js/src/tests/test262/language/directive-prologue/14.1-15-s.js new file mode 100644 index 0000000000..148e53bdd4 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-15-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-15-s +description: blank lines may come before 'use strict' directive +flags: [noStrict] +---*/ + + function foo() + { + + + + + + + "use strict" ; + return (this === undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-16-s.js b/js/src/tests/test262/language/directive-prologue/14.1-16-s.js new file mode 100644 index 0000000000..e009c959f6 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-16-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-16-s +description: > + 'use strict' directive - not recognized if it follow an empty + statement +flags: [noStrict] +---*/ + + function foo() + { + ; 'use strict'; + return (this !== undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-17-s.js b/js/src/tests/test262/language/directive-prologue/14.1-17-s.js new file mode 100644 index 0000000000..dfb9fa2e2a --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-17-s.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-17-s +description: > + 'use strict' directive - not recognized if it follow some other + statment empty statement +flags: [noStrict] +---*/ + + function foo() + { + var x; + 'use strict'; + return (this !== undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-2-s.js b/js/src/tests/test262/language/directive-prologue/14.1-2-s.js new file mode 100644 index 0000000000..1f9fa6fddd --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-2-s.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-2-s +description: "\"use strict\" directive - correct usage double quotes" +flags: [noStrict] +---*/ + + function foo() + { + "use strict"; + return (this === undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-3-s.js b/js/src/tests/test262/language/directive-prologue/14.1-3-s.js new file mode 100644 index 0000000000..138af81dda --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-3-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-3-s +description: > + 'use strict' directive - not recognized if it contains extra + whitespace +flags: [noStrict] +---*/ + + function foo() + { + ' use strict '; + return (this !== undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-4-s.js b/js/src/tests/test262/language/directive-prologue/14.1-4-s.js new file mode 100644 index 0000000000..10c027a0d7 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-4-s.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-4-s +description: > + 'use strict' directive - not recognized if contains Line + Continuation +flags: [noStrict] +---*/ + + function foo() + { + 'use str\ +ict'; + return (this !== undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-4gs.js b/js/src/tests/test262/language/directive-prologue/14.1-4gs.js new file mode 100644 index 0000000000..d401a5192f --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-4gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-4gs +description: > + StrictMode - a Use Strict Directive followed by a strict mode + violation +negative: + phase: parse + type: SyntaxError +flags: [raw] +---*/ + +"use strict"; +throw "Test262: This statement should not be evaluated."; +eval = 42; diff --git a/js/src/tests/test262/language/directive-prologue/14.1-5-s.js b/js/src/tests/test262/language/directive-prologue/14.1-5-s.js new file mode 100644 index 0000000000..61e1cab562 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-5-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-5-s +description: > + 'use strict' directive - not recognized if contains a + EscapeSequence +flags: [noStrict] +---*/ + + function foo() + { + 'use\u0020strict'; + return(this !== undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-5gs.js b/js/src/tests/test262/language/directive-prologue/14.1-5gs.js new file mode 100644 index 0000000000..e1f2977e7a --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-5gs.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-5gs +description: > + StrictMode - a Use Strict Directive embedded in a directive + prologue followed by a strict mode violation +negative: + phase: parse + type: SyntaxError +flags: [raw] +---*/ + +"a"; +"use strict"; +"c"; +throw "Test262: This statement should not be evaluated."; +eval = 42; diff --git a/js/src/tests/test262/language/directive-prologue/14.1-6-s.js b/js/src/tests/test262/language/directive-prologue/14.1-6-s.js new file mode 100644 index 0000000000..c1e529ee3d --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-6-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-6-s +description: > + 'use strict' directive - not recognized if contains a <TAB> + instead of a space +flags: [noStrict] +---*/ + + function foo() + { + 'use strict'; + return (this !== undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-7-s.js b/js/src/tests/test262/language/directive-prologue/14.1-7-s.js new file mode 100644 index 0000000000..1552b2a472 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-7-s.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-7-s +description: "'use strict' directive - not recognized if upper case" +flags: [noStrict] +---*/ + + function foo() + { + 'Use Strict'; + return (this !== undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-8-s.js b/js/src/tests/test262/language/directive-prologue/14.1-8-s.js new file mode 100644 index 0000000000..4f63e7711c --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-8-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-8-s +description: "'use strict' directive - may follow other directives" +flags: [noStrict] +---*/ + + function foo() + { + "bogus directive"; + "use strict"; + return (this === undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/14.1-9-s.js b/js/src/tests/test262/language/directive-prologue/14.1-9-s.js new file mode 100644 index 0000000000..fbbfa5cfde --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/14.1-9-s.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 14.1-9-s +description: "'use strict' directive - may occur multiple times" +flags: [noStrict] +---*/ + + function foo() + { + 'use strict'; + "use strict"; + return (this === undefined); + } + +assert(foo.call(undefined)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/browser.js b/js/src/tests/test262/language/directive-prologue/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/browser.js diff --git a/js/src/tests/test262/language/directive-prologue/func-decl-final-runtime.js b/js/src/tests/test262/language/directive-prologue/func-decl-final-runtime.js new file mode 100644 index 0000000000..ee4ef9b21c --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-decl-final-runtime.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-21-s +description: > + Strict Mode - Function code of a FunctionDeclaration contains Use + Strict Directive which appears at the end of the block +flags: [noStrict] +---*/ + function fun() { + test262unresolvable = null; + assert.sameValue(test262unresolvable, null); + "use strict"; + } + fun(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/func-decl-inside-func-decl-parse.js b/js/src/tests/test262/language/directive-prologue/func-decl-inside-func-decl-parse.js new file mode 100644 index 0000000000..edc592c1b9 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-decl-inside-func-decl-parse.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-15-s +description: > + Strict Mode - Function code that is part of a FunctionDeclaration + is strict function code if FunctionDeclaration is contained in use + strict +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +function testcase() { + "use strict"; + function fun() { + var static; + } +} diff --git a/js/src/tests/test262/language/directive-prologue/func-decl-inside-func-decl-runtime.js b/js/src/tests/test262/language/directive-prologue/func-decl-inside-func-decl-runtime.js new file mode 100644 index 0000000000..ee1ab73c2e --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-decl-inside-func-decl-runtime.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-15-s +description: > + Strict Mode - Function code that is part of a FunctionDeclaration + is strict function code if FunctionDeclaration is contained in use + strict +flags: [noStrict] +---*/ + +function testcase() { + "use strict"; + function fun() { + test262unresolvable = null; + } + + assert.throws(ReferenceError, function() { + fun(); + }); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/func-decl-no-semi-parse.js b/js/src/tests/test262/language/directive-prologue/func-decl-no-semi-parse.js new file mode 100644 index 0000000000..cce1dd7677 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-decl-no-semi-parse.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-2-s +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict'' + which lost the last character ';' +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +function fun() { + "use strict" + var static; +} diff --git a/js/src/tests/test262/language/directive-prologue/func-decl-no-semi-runtime.js b/js/src/tests/test262/language/directive-prologue/func-decl-no-semi-runtime.js new file mode 100644 index 0000000000..0938e2c2ad --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-decl-no-semi-runtime.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-2-s +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict'' + which lost the last character ';' +flags: [noStrict] +---*/ + +function fun() { + "use strict" + test262unresolvable = null; +} + +assert.throws(ReferenceError, function() { + fun(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/func-decl-not-first-runtime.js b/js/src/tests/test262/language/directive-prologue/func-decl-not-first-runtime.js new file mode 100644 index 0000000000..c9712409a0 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-decl-not-first-runtime.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-20-s +description: > + Strict Mode - Function code of a FunctionDeclaration contains Use + Strict Directive which appears in the middle of the block +flags: [noStrict] +---*/ + + function fun() { + test262unresolvable = null; + "use strict"; + assert.sameValue(test262unresolvable, null); + } + fun(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/func-decl-parse.js b/js/src/tests/test262/language/directive-prologue/func-decl-parse.js new file mode 100644 index 0000000000..50fbb86a1e --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-decl-parse.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-19-s +description: > + Strict Mode - Function code of a FunctionDeclaration contains Use + Strict Directive which appears at the start of the block +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +function fun() { + "use strict"; + var static; +} diff --git a/js/src/tests/test262/language/directive-prologue/func-decl-runtime.js b/js/src/tests/test262/language/directive-prologue/func-decl-runtime.js new file mode 100644 index 0000000000..3f0f2d5f8e --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-decl-runtime.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-19-s +description: > + Strict Mode - Function code of a FunctionDeclaration contains Use + Strict Directive which appears at the start of the block +flags: [noStrict] +---*/ + + function fun() { + "use strict"; + + test262unresolvable = null; + } + +assert.throws(ReferenceError, function() { + fun(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/func-expr-final-runtime.js b/js/src/tests/test262/language/directive-prologue/func-expr-final-runtime.js new file mode 100644 index 0000000000..fe0697b0e9 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-expr-final-runtime.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-24-s +description: > + Strict Mode - Function code of a FunctionExpression contains Use + Strict Directive which appears at the end of the block +flags: [noStrict] +---*/ + + (function () { + test262unresolvable = null; + "use strict"; + + assert.sameValue(test262unresolvable, null); + }) (); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/func-expr-inside-func-decl-parse.js b/js/src/tests/test262/language/directive-prologue/func-expr-inside-func-decl-parse.js new file mode 100644 index 0000000000..9c79770e93 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-expr-inside-func-decl-parse.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-16-s +description: > + Strict Mode - Function code that is part of a FunctionExpression + is strict function code if FunctionExpression is contained in use + strict +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +function testcase() { + "use strict"; + var static; +} diff --git a/js/src/tests/test262/language/directive-prologue/func-expr-inside-func-decl-runtime.js b/js/src/tests/test262/language/directive-prologue/func-expr-inside-func-decl-runtime.js new file mode 100644 index 0000000000..bf2444c674 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-expr-inside-func-decl-runtime.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-16-s +description: > + Strict Mode - Function code that is part of a FunctionExpression + is strict function code if FunctionExpression is contained in use + strict +flags: [noStrict] +---*/ + +function testcase() { + "use strict"; + + assert.throws(ReferenceError, function() { + test262unresolvable = null; + }); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/func-expr-no-semi-parse.js b/js/src/tests/test262/language/directive-prologue/func-expr-no-semi-parse.js new file mode 100644 index 0000000000..824b5a2977 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-expr-no-semi-parse.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-2-s +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict'' + which lost the last character ';' +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +(function() { + "use strict" + + var static; +}); diff --git a/js/src/tests/test262/language/directive-prologue/func-expr-no-semi-runtime.js b/js/src/tests/test262/language/directive-prologue/func-expr-no-semi-runtime.js new file mode 100644 index 0000000000..e6d791f4f6 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-expr-no-semi-runtime.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-2-s +description: > + Strict Mode - Use Strict Directive Prologue is ''use strict'' + which lost the last character ';' +flags: [noStrict] +---*/ + +assert.throws(ReferenceError, function() { + "use strict" + + test262unresolvable = null; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/func-expr-not-first-runtime.js b/js/src/tests/test262/language/directive-prologue/func-expr-not-first-runtime.js new file mode 100644 index 0000000000..b8c4206bd7 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-expr-not-first-runtime.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-23-s +description: > + Strict Mode - Function code of a FunctionExpression contains Use + Strict Directive which appears in the middle of the block +flags: [noStrict] +---*/ + + (function () { + test262unresolvable = null; + assert.sameValue(test262unresolvable, null); + "use strict"; + }) (); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/func-expr-parse.js b/js/src/tests/test262/language/directive-prologue/func-expr-parse.js new file mode 100644 index 0000000000..6433ea9092 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-expr-parse.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-22-s +description: > + Strict Mode - Function code of a FunctionExpression contains Use + Strict Directive which appears at the start of the block +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +(function() { + "use strict"; + + var static; +}); diff --git a/js/src/tests/test262/language/directive-prologue/func-expr-runtime.js b/js/src/tests/test262/language/directive-prologue/func-expr-runtime.js new file mode 100644 index 0000000000..a9e14846c3 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/func-expr-runtime.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-22-s +description: > + Strict Mode - Function code of a FunctionExpression contains Use + Strict Directive which appears at the start of the block +flags: [noStrict] +---*/ + +assert.throws(ReferenceError, function () { + "use strict"; + + test262unresolvable = null; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/get-accsr-inside-func-expr-runtime.js b/js/src/tests/test262/language/directive-prologue/get-accsr-inside-func-expr-runtime.js new file mode 100644 index 0000000000..872d6990ea --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/get-accsr-inside-func-expr-runtime.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-17-s +description: > + Strict Mode - Function code that is part of a Accessor + PropertyAssignment is in Strict Mode if Accessor + PropertyAssignment is contained in use strict(getter) +flags: [noStrict] +---*/ + +assert.throws(ReferenceError, function() { + "use strict"; + var obj = {}; + Object.defineProperty(obj, "accProperty", { + get: function () { + test262unresolvable = null; + return 11; + } + }); + + var temp = obj.accProperty === 11; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/get-accsr-not-first-runtime.js b/js/src/tests/test262/language/directive-prologue/get-accsr-not-first-runtime.js new file mode 100644 index 0000000000..9323136e76 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/get-accsr-not-first-runtime.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-27-s +description: > + Strict Mode - Function code of Accessor PropertyAssignment + contains Use Strict Directive which appears in the middle of the + block(getter) +flags: [noStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "accProperty", { + get: function () { + test262unresolvable = null; + "use strict"; + return 11; + } + }); + +assert.sameValue(obj.accProperty, 11, 'obj.accProperty'); +assert.sameValue(test262unresolvable, null); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/get-accsr-runtime.js b/js/src/tests/test262/language/directive-prologue/get-accsr-runtime.js new file mode 100644 index 0000000000..508cbfb8c2 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/get-accsr-runtime.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-25-s +description: > + Strict Mode - Function code of Accessor PropertyAssignment + contains Use Strict Directive which appears at the start of the + block(getter) +flags: [noStrict] +---*/ + + +assert.throws(ReferenceError, function() { + var obj = {}; + Object.defineProperty(obj, "accProperty", { + get: function () { + "use strict"; + test262unresolvable = null; + return 11; + } + }); + var temp = obj.accProperty === 11; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/set-accsr-inside-func-expr-runtime.js b/js/src/tests/test262/language/directive-prologue/set-accsr-inside-func-expr-runtime.js new file mode 100644 index 0000000000..9b883cf824 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/set-accsr-inside-func-expr-runtime.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-18-s +description: > + Strict Mode - Function code that is part of a Accessor + PropertyAssignment is in Strict Mode if Accessor + PropertyAssignment is contained in use strict(setter) +flags: [noStrict] +---*/ + +var data = "data"; + +assert.throws(ReferenceError, function() { + "use strict"; + + var obj = {}; + Object.defineProperty(obj, "accProperty", { + set: function (value) { + test262unresolvable = null; + data = value; + } + }); + + obj.accProperty = "overrideData"; +}); + +assert.sameValue(data, "data", 'data unchanged'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/set-accsr-not-first-runtime.js b/js/src/tests/test262/language/directive-prologue/set-accsr-not-first-runtime.js new file mode 100644 index 0000000000..7ff6e52b57 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/set-accsr-not-first-runtime.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-26-s +description: > + Strict Mode - Function code of Accessor PropertyAssignment + contains Use Strict Directive which appears at the start of the + block(setter) +flags: [noStrict] +---*/ + +var data = "data"; + +assert.throws(ReferenceError, function() { + var obj = {}; + Object.defineProperty(obj, "accProperty", { + set: function (value) { + "use strict"; + test262unresolvable = null; + data = value; + } + }); + + obj.accProperty = "overrideData"; +}); + +assert.sameValue(data, "data", 'data unchanged'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/set-accsr-runtime.js b/js/src/tests/test262/language/directive-prologue/set-accsr-runtime.js new file mode 100644 index 0000000000..3ac3d6895e --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/set-accsr-runtime.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: use-strict-directive +es5id: 10.1.1-25-s +description: > + Strict Mode - Function code of Accessor PropertyAssignment + contains Use Strict Directive which appears at the start of the + block(getter) +flags: [noStrict] +---*/ + + +assert.throws(ReferenceError, function() { + var obj = {}; + Object.defineProperty(obj, "accProperty", { + set: function () { + "use strict"; + test262unresolvable = null; + return 11; + } + }); + obj.accProperty = "overrideData"; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/directive-prologue/shell.js b/js/src/tests/test262/language/directive-prologue/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/directive-prologue/shell.js |