Bug 565388 - Chrome option for the invisible docshell. r=bz

This commit is contained in:
Gabor Krizsanits 2013-10-16 15:18:42 +02:00
parent 33af92c55a
commit f0a13e2617
2 changed files with 11 additions and 4 deletions

View File

@ -17,7 +17,7 @@ interface nsIAppShell;
#include "js/TypeDecls.h"
%}
[scriptable, uuid(5c19ab54-67bf-46d0-ac5b-21abd9050c3b)]
[scriptable, uuid(3927a495-575a-4a12-b9ab-6b948f76ec1f)]
interface nsIAppShellService : nsISupports
{
/**
@ -44,7 +44,13 @@ interface nsIAppShellService : nsISupports
in long aInitialWidth,
in long aInitialHeight);
nsIWebNavigation createWindowlessBrowser();
/**
* This is the constructor for creating an invisible DocShell.
* It is used to simulate DOM windows without an actual physical
* representation.
* @param aIsChrome Set true if you want to use it for chrome content.
*/
nsIWebNavigation createWindowlessBrowser([optional] in bool aIsChrome);
[noscript]
void createHiddenWindow();

View File

@ -348,7 +348,7 @@ NS_IMPL_RELEASE(WindowlessBrowserStub)
NS_IMETHODIMP
nsAppShellService::CreateWindowlessBrowser(nsIWebNavigation **aResult)
nsAppShellService::CreateWindowlessBrowser(bool aIsChrome, nsIWebNavigation **aResult)
{
/* First, we create an instance of nsWebBrowser. Instances of this class have
* an associated doc shell, which is what we're interested in.
@ -374,7 +374,8 @@ nsAppShellService::CreateWindowlessBrowser(nsIWebNavigation **aResult)
nsCOMPtr<nsIWebNavigation> navigation = do_QueryInterface(browser);
nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(navigation);
item->SetItemType(nsIDocShellTreeItem::typeContentWrapper);
item->SetItemType(aIsChrome ? nsIDocShellTreeItem::typeChromeWrapper
: nsIDocShellTreeItem::typeContentWrapper);
/* A windowless web browser doesn't have an associated OS level window. To
* accomplish this, we initialize the window associated with our instance of