Right, that will work, although you could nsCOMPtr to make it a lot
prettier:
void test(nsIDOMWindow* aDOMWindow, nsIBaseWindow** aBaseWindow)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow);
nsCOMPtr<nsIDocShell> docShell;
if (window)
window->GetDocShell(getter_AddRefs(docShell));
nsIWebShell* rootWebShell = 0;
NS_IF_RELEASE(rootWebShell);
// return status;
}
- Kyle
On Wed, Feb 10, 2016 at 5:22 PM, Devan Shah <[email protected]> wrote:
> Do you happen to have a QueryInterface example,
>
> Would something like the following work:
>
> void test(nsIDOMWindow* aDOMWindow, nsIBaseWindow** aBaseWindow)
> {
> nsPIDOMWindow* window = 0;
> nsresult status = aDOMWindow->QueryInterface(NS_GET_IID(nsPIDOMWindow),
> (void**)&window);
> nsIDocShell* docShell = 0;
> if (window)
> window->GetDocShell(&docShell);
> nsIWebShell* rootWebShell = 0;
> NS_IF_RELEASE(rootWebShell);
> NS_IF_RELEASE(docShell);
> NS_IF_RELEASE(window);
> // return status;
> }
>
> On Wed, Feb 10, 2016 at 8:16 PM, Kyle Huey <[email protected]> wrote:
>
>> Alright, just QueryInterface between nsIDOMWindow and nsPIDOMWindow when
>> you have one and need the other and you should be fine.
>>
>> - Kyle
>>
>> On Wed, Feb 10, 2016 at 5:15 PM, Devan Shah <[email protected]>
>> wrote:
>>
>>> Currently I just want to get it up and running again on FF 45 again,
>>> with out making too much changes because we plan to deprecate this feature
>>> mid this year or so.
>>>
>>> Just need to get it working on Firefox 45, currently works perfectly on
>>> Firefox 38.
>>>
>>>
>>
>
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform