Closed Bug 1783915 Opened 3 years ago Closed 2 years ago

ShadowRealm wrapped functions don't correctly toString.

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: mgaudet, Assigned: mgaudet)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

sr = new ShadowRealm();
p = sr.evaluate(`var resolve;
 new Promise((r,_) => { resolve = r;}).then(
    (r) => { console.log("Resolved with"); }
    ); resolve`)

Produces TypeError: Function.prototype.toString called on incompatible object in SpiderMonkey, but works correctly in Safari Technology Preview.

Severity: -- → S3
Type: task → defect
Priority: -- → P3

Interesting, it's actually the shell complaining while trying to print p that's the issue here.

Summary: Broken ShadowRealm callable return checking → ShadowRealm wrapped functions don't correctly toString.

Minimal example: new ShadowRealm().evaluate("function f() { }; f").toString();

Assignee: nobody → mgaudet
Status: NEW → ASSIGNED
Pushed by mgaudet@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/87213cd29f42 Provide a ToStringOp for WrappedFunctionObjects to avoid JSFunction brand-check exception r=bthrall
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
Regressions: 1797682
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: