yep
This is how I was using nsIDOMWindow before:
NS_IMETHODIMP WebBrowserChrome::OnLocationChange(nsIWebProgress*
aWebProgress,
nsIRequest* aRequest,
nsIURI *location,
uint32_t aFlags)
{
PRBool isSubFrameLoad = PR_FALSE; // Is this a subframe load
if (aWebProgress) {
nsCOMPtr<nsIDOMWindow> domWindow;
nsCOMPtr<nsIDOMWindow> topDomWindow;
aWebProgress->GetDOMWindow(getter_AddRefs(domWindow));
if (domWindow) { // Get root domWindow
domWindow->GetTop(getter_AddRefs(topDomWindow));
}
if (domWindow != topDomWindow)
isSubFrameLoad = PR_TRUE;
}
if (!isSubFrameLoad)
CWebBrowserChromeUI::UpdateCurrentURI(this);
return NS_OK;
}
So here just changing nsCOMPtr<nsIDOMWindow> to nsCOMPtr<nsPIDOMWindow> and
using QueryInterface should do the trick right?
Also I am using a function called SizeToContent() from nsIDOMWindow which I
do not see exists any more in nsPIDOMWindow either was this one removed
completly.
On Wed, Feb 10, 2016 at 8:24 PM, Kyle Huey <[email protected]> wrote:
> 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