Closed Bug 1466503 Opened 6 years ago Closed 6 years ago

JSContext::currentScript should probably check same-realm instead of same-compartment

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(3 files)

It has this allowSameCompartment argument that defaults to DONT_ALLOW_CROSS_COMPARTMENT. Looking at (some of) the callers, I think changing this to allowSameRealm is the right thing to do.
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Attachment #8985641 - Flags: review?(tcampbell)
This adds a separate DescribeScriptedCallerForDirectEval function, instead of handling this case in DescribeScriptedCallerForCompilation. It's a bit simpler and it eliminates a cx->currentScript call for direct evals: the callers already know the JSOP_EVAL script/pc.
Attachment #8985643 - Flags: review?(luke)
With some minor cleanup.
Attachment #8985646 - Flags: review?(luke)
Attachment #8985641 - Flags: review?(tcampbell) → review+
Comment on attachment 8985643 [details] [diff] [review] Part 2 - Some DescribeScriptedCallerForCompilation cleanup Review of attachment 8985643 [details] [diff] [review]: ----------------------------------------------------------------- Nice!
Attachment #8985643 - Flags: review?(luke) → review+
Comment on attachment 8985646 [details] [diff] [review] Part 3 - Check realms instead of compartments in JSContext::currentScript Review of attachment 8985646 [details] [diff] [review]: ----------------------------------------------------------------- Good catch
Attachment #8985646 - Flags: review?(luke) → review+
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/0c4e97614565 part 1 - Pass script to GetIntrinsicOperation so it doesn't have to look it up. r=tcampbell https://hg.mozilla.org/integration/mozilla-inbound/rev/92d154bc6515 part 2 - Some DescribeScriptedCallerForCompilation cleanup. r=luke https://hg.mozilla.org/integration/mozilla-inbound/rev/40461ea89e0c part 3 - Check realms instead of compartments in JSContext::currentScript. r=luke
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Depends on: 1473618
No longer depends on: 1473618
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: