Open Bug 1770017 Opened 2 years ago Updated 2 years ago

Consider censoring ShadowRealm stacks

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: mgaudet, Unassigned)

References

(Blocks 1 open bug)

Details

Currently if you run the following test:

// |reftest| shell-option(--enable-shadow-realms) skip-if(!xulRuntime.shell)

var realm = new ShadowRealm();

function innermost() {
    assertEq(/onion/.test(realm.evaluate("new Error().stack")), false);
}

function onion1() {
    innermost();
}

function onion2() {
    onion1();
}

onion2();

if (typeof reportCompare === 'function')
    reportCompare(true, true);

The test will fail, as the stack returned from the evaluate call is the whole execution stack:

@js/src/tests/non262/ShadowRealms/errors.js:6:1
innermost@js/src/tests/non262/ShadowRealms/errors.js:6:17
onion1@js/src/tests/non262/ShadowRealms/errors.js:10:5
onion2@js/src/tests/non262/ShadowRealms/errors.js:14:5
@js/src/tests/non262/ShadowRealms/errors.js:17:1

We may wish to actually censor the stacks from inside the shadow realm to stop at the evaluate call.

(Also interesting: What is the filename reported by a new error inside of the shadow realm?)

Severity: -- → S3
Type: task → enhancement
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.