Closed Bug 807410 Opened 7 years ago Closed 7 years ago

Pass some things to the nsJSContext constructor instead of using setters

Categories

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

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: Ms2ger, Assigned: Ms2ger)

Details

Attachments

(2 files)

SetGCOnDestruction and SetGlobalObject are only used right after we constructed the object. Making those constructor arguments makes that clearer.
Attachment #677075 - Flags: review?(jst)
Attachment #677077 - Flags: review?(jst)
Comment on attachment 677075 [details] [diff] [review]
Part a: Global object

- In class nsJSRuntime:

-  virtual already_AddRefed<nsIScriptContext> CreateContext();
+  virtual already_AddRefed<nsIScriptContext> CreateContext(nsIScriptGlobalObject* aGlobalObject = nullptr);

Why a default value? I'd much rather see callers of this being explicit.
Because only nsGlobalWindow passed one, but sure.
Comment on attachment 677075 [details] [diff] [review]
Part a: Global object

r=jst, but please remove the default argument and make the few callers of CreateContext() be explicit about what they want to pass in.
Attachment #677075 - Flags: review?(jst) → review+
Comment on attachment 677077 [details] [diff] [review]
Part b: GC on destruction

r=jst. Thanks for the patches!
Attachment #677077 - Flags: review?(jst) → review+
https://hg.mozilla.org/mozilla-central/rev/40e08e6b0fda
https://hg.mozilla.org/mozilla-central/rev/8e21cdfce89c
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.