Skip to content

Commit 466361f

Browse files
committed
Arguments.callee is always the same function in strict mode
1 parent 82290ba commit 466361f

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/changes/changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
<body>
1010
<release version="4.11.0" date="March xx, 2025" description="Chrome/Edge 134, Firefox 136, Rhino RegExp, less dependencies, Bugfixes">
11+
<action type="fix" dev="rbri">
12+
core-js: Arguments.callee is always the same function in strict mode.
13+
</action>
1114
<action type="fix" dev="rbri">
1215
core-js: Arguments.caller is not available in real browsers.
1316
</action>

src/test/java/org/htmlunit/javascript/ArgumentsTest.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,53 @@ public void argumentsAsParameter() throws Exception {
229229

230230
loadPageVerifyTitle2(html);
231231
}
232+
233+
/**
234+
* @throws Exception if the test fails
235+
*/
236+
@Test
237+
@Alerts({"function/", "function/", "true"})
238+
public void argumentsCallee() throws Exception {
239+
final String html = DOCTYPE_HTML
240+
+ "<html><body>"
241+
+ "<script>\n"
242+
+ " 'use strict';\n"
243+
+ LOG_TITLE_FUNCTION
244+
+ "function foo() {\n"
245+
+ " let desc = Object.getOwnPropertyDescriptor(arguments, 'callee');\n"
246+
+ " log(typeof desc.get + '/' + desc.get.name);\n"
247+
+ " log(typeof desc.set + '/' + desc.set.name);\n"
248+
+ " log(desc.get === desc.set);\n"
249+
+ "}\n"
250+
+ "foo();\n"
251+
+ "</script></body></html>";
252+
253+
loadPageVerifyTitle2(html);
254+
}
255+
256+
/**
257+
* @throws Exception if the test fails
258+
*/
259+
@Test
260+
@Alerts({"true", "true"})
261+
public void argumentsCalleeDifferentFunctions() throws Exception {
262+
final String html = DOCTYPE_HTML
263+
+ "<html><body>"
264+
+ "<script>\n"
265+
+ " 'use strict';\n"
266+
+ LOG_TITLE_FUNCTION
267+
+ "function foo1() {\n"
268+
+ " return Object.getOwnPropertyDescriptor(arguments, 'callee');\n"
269+
+ "}\n"
270+
+ "function foo2() {\n"
271+
+ " return Object.getOwnPropertyDescriptor(arguments, 'callee');\n"
272+
+ "}\n"
273+
+ "let desc1 = foo1();\n"
274+
+ "let desc2 = foo2();\n"
275+
+ "log(desc1.get === desc2.get);\n"
276+
+ "log(desc1.set === desc2.set);\n"
277+
+ "</script></body></html>";
278+
279+
loadPageVerifyTitle2(html);
280+
}
232281
}

0 commit comments

Comments
 (0)