mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
change window ownership model to match Mozilla's (self-referential). bug 76522 r=adamlock,hyatt
This commit is contained in:
parent
8e05fc6f8b
commit
faa7681f86
@ -193,8 +193,9 @@ NS_IMETHODIMP WebBrowserChrome::CreateBrowserWindow(PRUint32 aChromeFlags,
|
||||
|
||||
nsIWebBrowserChrome *parent = aChromeFlags & nsIWebBrowserChrome::CHROME_DEPENDENT ? this : 0;
|
||||
|
||||
nsIWebBrowserChrome *newChrome = nsnull;
|
||||
rv = AppCallbacks::CreateBrowserWindow(aChromeFlags, parent, &newChrome);
|
||||
nsCOMPtr<nsIWebBrowserChrome> newChrome;
|
||||
rv = AppCallbacks::CreateBrowserWindow(aChromeFlags, parent,
|
||||
getter_AddRefs(newChrome));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
newChrome->GetWebBrowser(_retval);
|
||||
|
@ -280,9 +280,9 @@ nsresult OpenWebPage(const char *url)
|
||||
// with an extra reference so that it can released correctly during
|
||||
// destruction (via Win32UI::Destroy)
|
||||
|
||||
nsIWebBrowserChrome *chrome = nsnull;
|
||||
nsCOMPtr<nsIWebBrowserChrome> chrome;
|
||||
rv = AppCallbacks::CreateBrowserWindow(nsIWebBrowserChrome::CHROME_ALL,
|
||||
nsnull, &chrome);
|
||||
nsnull, getter_AddRefs(chrome));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
WebBrowserChromeUI::ShowWindow(chrome, PR_TRUE);
|
||||
@ -1275,7 +1275,12 @@ nsresult AppCallbacks::CreateBrowserWindow(PRUint32 aChromeFlags,
|
||||
if (!chrome)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// the interface to return and one addref, which we assume will be
|
||||
// immediately released
|
||||
CallQueryInterface(NS_STATIC_CAST(nsIWebBrowserChrome*, chrome), aNewWindow);
|
||||
// now an extra addref; the window owns itself (to be released by
|
||||
// WebBrowserChromeUI::Destroy)
|
||||
NS_ADDREF(*aNewWindow);
|
||||
|
||||
chrome->SetChromeFlags(aChromeFlags);
|
||||
chrome->SetParent(aParent);
|
||||
|
Loading…
Reference in New Issue
Block a user