Skip to content

Commit ce9f10b

Browse files
committed
Fix Object.getOwnPropertyDescriptor prototype and update tests
- Fix Object.getOwnPropertyDescriptor to set returned object prototype to Object.prototype in src/js_object.rs - Add test case for arguments.callee descriptor in js-scripts/function_arguments_callee.js - Increase test limit to 70 in .github/workflows/test262.yml
1 parent 0f35ba1 commit ce9f10b

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

.github/workflows/test262.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
env:
2929
FAIL_ON_FAILURE: 'true'
3030
run: |
31-
bash ci/run_test262.sh --limit 60 --fail-on-failure --focus language
31+
bash ci/run_test262.sh --limit 70 --fail-on-failure --focus language
3232
3333
- name: Upload results
3434
if: ${{ !cancelled() }}

js-scripts/function_arguments_callee.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
"use strict";
22

3+
function assert(condition, message) {
4+
if (!condition) {
5+
throw new Error(message || "Assertion failed");
6+
}
7+
}
8+
39
/*
410
// Non-strict mode test for arguments.callee
511
@@ -89,4 +95,21 @@ try {
8995
}
9096
}
9197

98+
{
99+
console.log("=== Test arguments.callee property descriptor ===");
100+
101+
function testcase() {
102+
var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
103+
104+
assert(desc.configurable === false, 'desc.configurable');
105+
assert(desc.enumerable === false, 'desc.enumerable');
106+
assert(desc.hasOwnProperty('value') === false, 'desc.hasOwnProperty("value")');
107+
assert(desc.hasOwnProperty('writable') === false, 'desc.hasOwnProperty("writable")');
108+
assert(desc.hasOwnProperty('get') === true, 'desc.hasOwnProperty("get")');
109+
assert(desc.hasOwnProperty('set') === true, 'desc.hasOwnProperty("set")');
110+
}
111+
112+
testcase();
113+
}
114+
92115
return true;

src/js_object.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ pub fn handle_object_method<'gc>(
492492

493493
if let Some(val_rc) = object_get_key_value(&obj, &key) {
494494
let desc_obj = new_js_object_data(mc);
495+
crate::core::set_internal_prototype_from_constructor(mc, &desc_obj, env, "Object")?;
495496

496497
match &*val_rc.borrow() {
497498
Value::Property { value, getter, setter } => {

0 commit comments

Comments
 (0)