mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Teaching window.open how to open chrome.
This commit is contained in:
parent
334dd15a25
commit
1b41f77bb5
@ -1459,6 +1459,8 @@ GlobalWindowImpl::Open(JSContext *cx,
|
||||
mChrome |= WinHasOption(options, "resizable") ? NS_CHROME_WINDOW_RESIZE_ON : 0;
|
||||
mChrome |= NS_CHROME_WINDOW_CLOSE_ON;
|
||||
|
||||
mChrome |= WinHasOption(options, "chrome") ? NS_CHROME_OPEN_AS_CHROME : 0;
|
||||
|
||||
mWidth = WinHasOption(options, "innerWidth") | WinHasOption(options, "width");
|
||||
mHeight = WinHasOption(options, "innerHeight") | WinHasOption(options, "height");
|
||||
|
||||
|
@ -46,6 +46,7 @@ struct nsRect;
|
||||
#define NS_CHROME_PERSONAL_TOOLBAR_ON 0x080
|
||||
#define NS_CHROME_SCROLLBARS_ON 0x100
|
||||
#define NS_CHROME_TITLEBAR_ON 0x200
|
||||
#define NS_CHROME_OPEN_AS_CHROME 0x400
|
||||
|
||||
/**
|
||||
* API to a "browser window". A browser window contains a toolbar, a web shell
|
||||
|
@ -899,6 +899,22 @@ NS_IMETHODIMP
|
||||
nsWebShellWindow::NewWebShell(PRUint32 aChromeMask, PRBool aVisible,
|
||||
nsIWebShell *&aNewWebShell)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
|
||||
if ((aChromeMask & NS_CHROME_OPEN_AS_CHROME) != 0) {
|
||||
// Just do a nice normal create of a web shell and
|
||||
// return it immediately.
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_FALSE, *getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 615, 480);
|
||||
newWindow->GetWebShell(aNewWebShell); // GetWebShell does the addref.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef XP_PC // XXX: Won't work on any other platforms yet. Sigh.
|
||||
// We need to create a new top level window and then enter a nested
|
||||
// loop. Eventually the new window will be told that it has loaded,
|
||||
@ -907,7 +923,6 @@ nsWebShellWindow::NewWebShell(PRUint32 aChromeMask, PRBool aVisible,
|
||||
|
||||
// First push a nested event queue for event processing from netlib
|
||||
// onto our UI thread queue stack.
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Unable to obtain queue service.");
|
||||
@ -920,11 +935,6 @@ nsWebShellWindow::NewWebShell(PRUint32 aChromeMask, PRBool aVisible,
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
appShell->CreateTopLevelWindow(nsnull, urlObj, PR_FALSE, *getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 615, 480);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user