Closed Bug 672971 Opened 15 years ago Closed 15 years ago

can we remove SetSafeJSContext and its single caller in nsAppShellService?

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: luke, Assigned: luke)

Details

Attachments

(2 files)

Currently, there is this really strange encapsulation-breaking method whereby nsAppShellService sets the safe JS context for the main thread to the hidden window's context. mrbkap said this is stuff is from long ago and I should probably ask bz. The attached patch (which just removes it) is green on try. SetSafeJSContext isn't thing in the world, but it certainly confounds reasoning about the context stack and safe JS contexts.
Attachment #547278 - Flags: review?(bzbarsky)
Hrm... I thought we used to have code that in fact did depend on the safe context being the hidden window (or more importantly having an associated nsIScriptContext and the like), but maybe that's gone now. With this change, is the safe context just some synthetic jscontext? ccing jst too, because he may know more about this than I do (which would not be hard!).
(In reply to comment #1) > With this change, is the safe context just some synthetic jscontext? Yes, created by XPCJSContextStack::GetSafeJSContext. It has null principals and some faked-up global object.
Comment on attachment 547278 [details] [diff] [review] rm SetSafeJSContext Well, let's give this a shot.
Attachment #547278 - Flags: review?(bzbarsky) → review+
I'll have wait a bit, one of the other uses of SetSafeJSContext is dom/src/threads/nsDOMThreadService.cpp which seems to have been given reprieve for the time being.
Attached patch fix workers — — Splinter Review
Incidentally, this change did break new web workers. Easy fix, though. Over the shoulder r+ from Ben.
Attachment #548956 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: