Closed Bug 804495 Opened 12 years ago Closed 12 years ago

Allow nsGlobalWindow to support GetInterface(nsILoadContext)

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: jduell.mcbugs, Assigned: jduell.mcbugs)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached patch v1 (obsolete) — Splinter Review
We already special-case a lot of interfaces, so this one seems ok too?

Otherwise we're starting to get code like the nsOfflineCacheUpdateService.cpp case here.

Patch applied over that for bug 794663
Attachment #674145 - Flags: review?(bzbarsky)
Attached patch v1 for realz (obsolete) — Splinter Review
now with actual code changes!
Attachment #674145 - Attachment is obsolete: true
Attachment #674145 - Flags: review?(bzbarsky)
Attachment #674149 - Flags: review?(bzbarsky)
Comment on attachment 674149 [details] [diff] [review]
v1 for realz

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

::: dom/base/nsGlobalWindow.cpp
@@ +8596,5 @@
> +    if (mDocShell) {
> +      nsCOMPtr<nsILoadContext> loadContext(do_QueryInterface(mDocShell));
> +      if (loadContext) {
> +        *aSink = loadContext;
> +        NS_ADDREF(((nsISupports *) *aSink));

Make this loadContext.forget(aSink);
Comment on attachment 674149 [details] [diff] [review]
v1 for realz

r=me with ms2ger's nit.  Note that if you do it that way, you don't have to null-check either mDocShell or loadContext.  So you can do it like so:

  FORWARD_TO_OUTER(GetInterface, (aIID, aSink), NS_ERROR_NOT_INITIALIZED);
  nsCOMPtr<nsILoadContext> loadContext(do_QueryInterface(mDocShell));
  loadContext.forget(aSink);
Attachment #674149 - Flags: review?(bzbarsky) → review+
Trivial update: I'm assuming if we want the style in comment 3, we might as well use it elsewhere in the function too.  Not even sure this needs review, really...
Attachment #674149 - Attachment is obsolete: true
Attachment #674982 - Flags: review?(bzbarsky)
Comment on attachment 674982 [details] [diff] [review]
v2: use forget() convention in rest of GetInterface

r=me
Attachment #674982 - Flags: review?(bzbarsky) → review+
I have a vague memory of seeing a patch with some awkward code because it had a window and wanted a load context. If only I could remember where it was...
https://hg.mozilla.org/mozilla-central/rev/ef5d003dbeac
Assignee: nobody → jduell.mcbugs
Status: NEW → RESOLVED
Closed: 12 years ago
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.