summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/extensions/builtin-function-arguments-caller.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/non262/extensions/builtin-function-arguments-caller.js
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/extensions/builtin-function-arguments-caller.js')
-rw-r--r--js/src/tests/non262/extensions/builtin-function-arguments-caller.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/js/src/tests/non262/extensions/builtin-function-arguments-caller.js b/js/src/tests/non262/extensions/builtin-function-arguments-caller.js
new file mode 100644
index 0000000000..2acf5f452f
--- /dev/null
+++ b/js/src/tests/non262/extensions/builtin-function-arguments-caller.js
@@ -0,0 +1,60 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = 'builtin-function-arguments-caller.js';
+var BUGNUMBER = 929642;
+var summary =
+ "Built-in functions defined in ECMAScript pick up arguments/caller " +
+ "properties from Function.prototype";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function expectNoProperty(obj, prop)
+{
+ var desc = Object.getOwnPropertyDescriptor(obj, prop);
+ assertEq(desc, undefined,
+ "should be no '" + prop + "' property on " + obj);
+}
+
+// Test a builtin that's native.
+expectNoProperty(Object, "arguments");
+expectNoProperty(Object, "caller");
+
+// Also test a builtin that's self-hosted.
+expectNoProperty(Array.prototype.indexOf, "arguments");
+expectNoProperty(Array.prototype.indexOf, "caller");
+
+// Test the Function construct for good measure, because it's so intricately
+// invovled in bootstrapping.
+expectNoProperty(Function, "arguments");
+expectNoProperty(Function, "caller");
+
+var argsDesc = Object.getOwnPropertyDescriptor(Function.prototype, "arguments");
+var callerDesc = Object.getOwnPropertyDescriptor(Function.prototype, "caller");
+
+var argsGet = argsDesc.get, argsSet = argsDesc.set;
+
+expectNoProperty(argsGet, "arguments");
+expectNoProperty(argsGet, "caller");
+expectNoProperty(argsSet, "arguments");
+expectNoProperty(argsSet, "caller");
+
+var callerGet = callerDesc.get, callerSet = callerDesc.set;
+
+expectNoProperty(callerGet, "arguments");
+expectNoProperty(callerGet, "caller");
+expectNoProperty(callerSet, "arguments");
+expectNoProperty(callerSet, "caller");
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");