Closed Bug 1276309 Opened 4 years ago Closed 4 years ago

Stop relying on the precise value of nsIScriptContext::GetNativeContext

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(2 files, 1 obsolete file)

We obviously need this to move to one JSContext per runtime.

Current places that do this are:

1)  nsGlobalWindow::FinalClose.  I think we can switch this to GetEntryGlobal.

2)  nsScriptLoader::EvaluateScript in the module case.  This should be using aes.cx().

I think that's it.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #8757419 - Attachment is obsolete: true
Attachment #8757419 - Flags: review?(bugs)
Comment on attachment 8757415 [details] [diff] [review]
part 1.  Stop depending on the exact value of nsIScriptContext::GetNativeContext in the scriptloader

Review of attachment 8757415 [details] [diff] [review]:
-----------------------------------------------------------------

Since aes is initialized with the same context, this should be equivalent AFAICT.
Attachment #8757415 - Flags: review?(bkelly) → review+
Comment on attachment 8757421 [details] [diff] [review]
part 2.  Stop depending on the exact value of nsIScriptContext::GetNativeContext in nsGlobalWindow::FinalClose

Doesn't the fix rely on us using AutoJSAPI vs AutoEntryScript correctly, since
AutoJSAPI ends up pushing stuff to stack, but only AutoEntryScript updates the entryglobal? AutoJSAPI vs. AutoEntryScript usage has been a bit ad hoc, but hopefully it is better these days.

So, better to push to try and see how this behaves.
Attachment #8757421 - Flags: review?(bugs) → review+
> Doesn't the fix rely on us using AutoJSAPI vs AutoEntryScript correctly

Yes, it does.  I did push this to try as part of https://treeherder.mozilla.org/#/jobs?repo=try&revision=ed3d2c0aa0df and it's looking pretty good.
https://hg.mozilla.org/mozilla-central/rev/eb35c54faae8
https://hg.mozilla.org/mozilla-central/rev/6210926fe4f3
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.