summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/comments/hashbang
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/language/comments/hashbang
parentInitial commit. (diff)
downloadfirefox-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/comments/hashbang')
-rw-r--r--js/src/tests/test262/language/comments/hashbang/browser.js0
-rw-r--r--js/src/tests/test262/language/comments/hashbang/escaped-bang-041.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/escaped-bang-u0021.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/escaped-bang-u21.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/escaped-bang-x21.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/escaped-hash-043.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/escaped-hash-u0023.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/escaped-hash-u23.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/escaped-hash-x23.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/escaped-hashbang.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/eval-indirect.js18
-rw-r--r--js/src/tests/test262/language/comments/hashbang/eval.js18
-rw-r--r--js/src/tests/test262/language/comments/hashbang/function-body.js21
-rw-r--r--js/src/tests/test262/language/comments/hashbang/function-constructor.js29
-rw-r--r--js/src/tests/test262/language/comments/hashbang/line-terminator-carriage-return.js30
-rw-r--r--js/src/tests/test262/language/comments/hashbang/line-terminator-line-separator.js30
-rw-r--r--js/src/tests/test262/language/comments/hashbang/line-terminator-paragraph-separator.js30
-rw-r--r--js/src/tests/test262/language/comments/hashbang/module.js17
-rw-r--r--js/src/tests/test262/language/comments/hashbang/multi-line-comment.js21
-rw-r--r--js/src/tests/test262/language/comments/hashbang/no-line-separator.js16
-rw-r--r--js/src/tests/test262/language/comments/hashbang/not-empty.js17
-rw-r--r--js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue-sc.js21
-rw-r--r--js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue.js21
-rw-r--r--js/src/tests/test262/language/comments/hashbang/preceding-empty-statement.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/preceding-hashbang.js21
-rw-r--r--js/src/tests/test262/language/comments/hashbang/preceding-line-comment.js21
-rw-r--r--js/src/tests/test262/language/comments/hashbang/preceding-multi-line-comment.js21
-rw-r--r--js/src/tests/test262/language/comments/hashbang/preceding-whitespace.js20
-rw-r--r--js/src/tests/test262/language/comments/hashbang/shell.js0
-rw-r--r--js/src/tests/test262/language/comments/hashbang/statement-block.js22
-rw-r--r--js/src/tests/test262/language/comments/hashbang/use-strict.js19
31 files changed, 613 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/comments/hashbang/browser.js b/js/src/tests/test262/language/comments/hashbang/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/browser.js
diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-bang-041.js b/js/src/tests/test262/language/comments/hashbang/escaped-bang-041.js
new file mode 100644
index 0000000000..c232decb83
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/escaped-bang-041.js
@@ -0,0 +1,20 @@
+#\041
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed to have encoded characters \041
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-bang-u0021.js b/js/src/tests/test262/language/comments/hashbang/escaped-bang-u0021.js
new file mode 100644
index 0000000000..52b012bff0
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/escaped-bang-u0021.js
@@ -0,0 +1,20 @@
+#\u0021
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed to have encoded characters \u0021
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-bang-u21.js b/js/src/tests/test262/language/comments/hashbang/escaped-bang-u21.js
new file mode 100644
index 0000000000..75f7e4d5af
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/escaped-bang-u21.js
@@ -0,0 +1,20 @@
+#\u{21}
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed to have encoded characters \u{21}
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-bang-x21.js b/js/src/tests/test262/language/comments/hashbang/escaped-bang-x21.js
new file mode 100644
index 0000000000..f6233833da
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/escaped-bang-x21.js
@@ -0,0 +1,20 @@
+#\x21
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed to have encoded characters \x21
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hash-043.js b/js/src/tests/test262/language/comments/hashbang/escaped-hash-043.js
new file mode 100644
index 0000000000..0c9e27d0b6
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/escaped-hash-043.js
@@ -0,0 +1,20 @@
+\043!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed to have encoded characters \043
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hash-u0023.js b/js/src/tests/test262/language/comments/hashbang/escaped-hash-u0023.js
new file mode 100644
index 0000000000..2cb370a63e
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/escaped-hash-u0023.js
@@ -0,0 +1,20 @@
+\u0023!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed to have encoded characters \u0023
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hash-u23.js b/js/src/tests/test262/language/comments/hashbang/escaped-hash-u23.js
new file mode 100644
index 0000000000..96859b568b
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/escaped-hash-u23.js
@@ -0,0 +1,20 @@
+\u{23}!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed to have encoded characters \u{23}
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hash-x23.js b/js/src/tests/test262/language/comments/hashbang/escaped-hash-x23.js
new file mode 100644
index 0000000000..82ae6c48c2
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/escaped-hash-x23.js
@@ -0,0 +1,20 @@
+\x23!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed to have encoded characters \x23
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hashbang.js b/js/src/tests/test262/language/comments/hashbang/escaped-hashbang.js
new file mode 100644
index 0000000000..9cfe30afce
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/escaped-hashbang.js
@@ -0,0 +1,20 @@
+\u0023\u0021
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed to have encoded characters
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/eval-indirect.js b/js/src/tests/test262/language/comments/hashbang/eval-indirect.js
new file mode 100644
index 0000000000..2e43a6fd59
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/eval-indirect.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should be available in Script evaluator contexts. (indirect eval)
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+features: [hashbang]
+---*/
+
+assert.sameValue((0, eval)('#!\n'), undefined);
+assert.sameValue((0, eval)('#!\n1'), 1)
+assert.sameValue((0, eval)('#!2\n'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/comments/hashbang/eval.js b/js/src/tests/test262/language/comments/hashbang/eval.js
new file mode 100644
index 0000000000..3d2cc6603a
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/eval.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should be available in Script evaluator contexts. (direct eval)
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+features: [hashbang]
+---*/
+
+assert.sameValue(eval('#!\n'), undefined);
+assert.sameValue(eval('#!\n1'), 1)
+assert.sameValue(eval('#!2\n'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/comments/hashbang/function-body.js b/js/src/tests/test262/language/comments/hashbang/function-body.js
new file mode 100644
index 0000000000..1e2f5f9f63
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/function-body.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should only be allowed at the start of source texts and should not be allowed within function bodies.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+$DONOTEVALUATE();
+
+function fn() {#!
+}
diff --git a/js/src/tests/test262/language/comments/hashbang/function-constructor.js b/js/src/tests/test262/language/comments/hashbang/function-constructor.js
new file mode 100644
index 0000000000..cc75e78e47
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/function-constructor.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be allowed in function evaluator contexts.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+features: [hashbang]
+---*/
+
+const AsyncFunction = (async function (){}).constructor;
+const GeneratorFunction = (function *(){}).constructor;
+const AsyncGeneratorFunction = (async function *(){}).constructor;
+for (const ctor of [
+ Function,
+ AsyncFunction,
+ GeneratorFunction,
+ AsyncGeneratorFunction,
+]) {
+ assert.throws(SyntaxError, () => ctor('#!\n_', ''), `${ctor.name} Call argument`);
+ assert.throws(SyntaxError, () => ctor('#!\n_'), `${ctor.name} Call body`);
+ assert.throws(SyntaxError, () => new ctor('#!\n_', ''), `${ctor.name} Construct argument`);
+ assert.throws(SyntaxError, () => new ctor('#!\n_'), `${ctor.name} Construct body`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/comments/hashbang/line-terminator-carriage-return.js b/js/src/tests/test262/language/comments/hashbang/line-terminator-carriage-return.js
new file mode 100644
index 0000000000..56d66b15d2
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/line-terminator-carriage-return.js
@@ -0,0 +1,30 @@
+#! this comment ends with a Carriage Return (U+000D) {
+}
+
+// Copyright (C) 2019 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments are terminated by the first LineTerminator: Carriage Return
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+
+ SingleLineCommentChars::
+ SingleLineCommentChar SingleLineCommentChars[opt]
+
+ SingleLineCommentChar::
+ SourceCharacter but not LineTerminator
+
+ LineTerminator::
+ <LF>
+ <CR>
+ <LS>
+ <PS>
+flags: [raw]
+features: [hashbang]
+---*/
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/comments/hashbang/line-terminator-line-separator.js b/js/src/tests/test262/language/comments/hashbang/line-terminator-line-separator.js
new file mode 100644
index 0000000000..62829d0f3e
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/line-terminator-line-separator.js
@@ -0,0 +1,30 @@
+#! this comment ends with a Line Separator (U+2028)
{
+}
+
+// Copyright (C) 2019 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments are terminated by the first LineTerminator: Line Separator
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+
+ SingleLineCommentChars::
+ SingleLineCommentChar SingleLineCommentChars[opt]
+
+ SingleLineCommentChar::
+ SourceCharacter but not LineTerminator
+
+ LineTerminator::
+ <LF>
+ <CR>
+ <LS>
+ <PS>
+flags: [raw]
+features: [hashbang]
+---*/
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/comments/hashbang/line-terminator-paragraph-separator.js b/js/src/tests/test262/language/comments/hashbang/line-terminator-paragraph-separator.js
new file mode 100644
index 0000000000..1b6e906046
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/line-terminator-paragraph-separator.js
@@ -0,0 +1,30 @@
+#! this comment ends with a Paragraph Separator (U+2029)
{
+}
+
+// Copyright (C) 2019 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments are terminated by the first LineTerminator: Paragraph Separator
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+
+ SingleLineCommentChars::
+ SingleLineCommentChar SingleLineCommentChars[opt]
+
+ SingleLineCommentChar::
+ SourceCharacter but not LineTerminator
+
+ LineTerminator::
+ <LF>
+ <CR>
+ <LS>
+ <PS>
+flags: [raw]
+features: [hashbang]
+---*/
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/comments/hashbang/module.js b/js/src/tests/test262/language/comments/hashbang/module.js
new file mode 100644
index 0000000000..d789ef11d4
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/module.js
@@ -0,0 +1,17 @@
+#!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should be allowed in Modules.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [module, raw]
+features: [hashbang]
+---*/
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/comments/hashbang/multi-line-comment.js b/js/src/tests/test262/language/comments/hashbang/multi-line-comment.js
new file mode 100644
index 0000000000..c6956b334e
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/multi-line-comment.js
@@ -0,0 +1,21 @@
+#!/*
+throw "Test262: This statement should not be evaluated.";
+these characters should not be considered within a comment
+*/
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not interpret multi-line comments.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
diff --git a/js/src/tests/test262/language/comments/hashbang/no-line-separator.js b/js/src/tests/test262/language/comments/hashbang/no-line-separator.js
new file mode 100644
index 0000000000..6e9c422f61
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/no-line-separator.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not require a newline afterwards
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+features: [hashbang]
+---*/
+
+assert.sameValue(eval('#!'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/comments/hashbang/not-empty.js b/js/src/tests/test262/language/comments/hashbang/not-empty.js
new file mode 100644
index 0000000000..0be0d4bf1a
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/not-empty.js
@@ -0,0 +1,17 @@
+#! these characters should be treated as a comment
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should be allowed in Scripts and should not be required to be empty.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+features: [hashbang]
+---*/
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue-sc.js b/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue-sc.js
new file mode 100644
index 0000000000..bc010e7212
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue-sc.js
@@ -0,0 +1,21 @@
+"use strict";
+#!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should only be allowed at start of source texts and should not be preceded by DirectivePrologues.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue.js b/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue.js
new file mode 100644
index 0000000000..42cae8422c
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue.js
@@ -0,0 +1,21 @@
+"use strict"
+#!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should only be allowed at start of source texts and should not be preceded by DirectivePrologues.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-empty-statement.js b/js/src/tests/test262/language/comments/hashbang/preceding-empty-statement.js
new file mode 100644
index 0000000000..7a66922372
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/preceding-empty-statement.js
@@ -0,0 +1,20 @@
+;#!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should only be allowed at the start of source texts and should not be preceded by empty statements.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-hashbang.js b/js/src/tests/test262/language/comments/hashbang/preceding-hashbang.js
new file mode 100644
index 0000000000..166457f37c
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/preceding-hashbang.js
@@ -0,0 +1,21 @@
+#!
+#!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should only be allowed at the start of source texts and should not be preceded by Hashbang comments.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-line-comment.js b/js/src/tests/test262/language/comments/hashbang/preceding-line-comment.js
new file mode 100644
index 0000000000..f30e609487
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/preceding-line-comment.js
@@ -0,0 +1,21 @@
+//
+#!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should only be allowed at the start of source texts and should not be preceded by line comments.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-multi-line-comment.js b/js/src/tests/test262/language/comments/hashbang/preceding-multi-line-comment.js
new file mode 100644
index 0000000000..f582e29996
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/preceding-multi-line-comment.js
@@ -0,0 +1,21 @@
+/*
+*/#!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should only be allowed at the start of source texts and should not be preceded by multi-line comments.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-whitespace.js b/js/src/tests/test262/language/comments/hashbang/preceding-whitespace.js
new file mode 100644
index 0000000000..03afd1b872
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/preceding-whitespace.js
@@ -0,0 +1,20 @@
+ #!
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should only be allowed at the start of source texts and should not be preceded by whitespace.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
diff --git a/js/src/tests/test262/language/comments/hashbang/shell.js b/js/src/tests/test262/language/comments/hashbang/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/shell.js
diff --git a/js/src/tests/test262/language/comments/hashbang/statement-block.js b/js/src/tests/test262/language/comments/hashbang/statement-block.js
new file mode 100644
index 0000000000..3d322fc700
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/statement-block.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should only be allowed at the start of source texts and should not be allowed within blocks.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [hashbang]
+---*/
+
+$DONOTEVALUATE();
+
+{
+ #!
+}
diff --git a/js/src/tests/test262/language/comments/hashbang/use-strict.js b/js/src/tests/test262/language/comments/hashbang/use-strict.js
new file mode 100644
index 0000000000..7c86b066a0
--- /dev/null
+++ b/js/src/tests/test262/language/comments/hashbang/use-strict.js
@@ -0,0 +1,19 @@
+#!"use strict"
+
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ Hashbang comments should not be interpreted and should not generate DirectivePrologues.
+info: |
+ HashbangComment::
+ #! SingleLineCommentChars[opt]
+flags: [raw]
+features: [hashbang]
+---*/
+
+with ({}) {}
+
+reportCompare(0, 0);