nsISupports
Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)Implemented by: @mozilla.org/appshell/appShellService;1
as a service:
var appShellService = Components.classes["@mozilla.org/appshell/appShellService;1"] .getService(Components.interfaces.nsIAppShellService);
void closeTopLevelWindow(in nsIXULWindow aWindow); Obsolete since Gecko 1.8 |
void createHiddenWindow(in nsIAppShell aAppShell); Native code only! |
boolean createStartupState(in long aWindowWidth, in long aWindowHeight); Obsolete since Gecko 1.8 |
nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent, in nsIURI aUrl, in PRUint32 aChromeMask, in long aInitialWidth, in long aInitialHeight, in nsIAppShell aAppShell); |
nsIWebNav createWindowlessBrowser (in bool aIsChrome) |
void destroyHiddenWindow(); |
void doProfileStartup(in nsICmdLineService aCmdLineService, in boolean canInteract); Obsolete since Gecko 1.8 |
void ensure1Window(in nsICmdLineService aCmdLineService); Obsolete since Gecko 1.8 |
void enterLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 |
void exitLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 |
void getHiddenWindowAndJSContext(out nsIDOMWindow aHiddenDOMWindow, out JSContext aJSContext); Native code only! |
void hideSplashScreen(); Obsolete since Gecko 1.8 |
void initialize(in nsICmdLineService aCmdLineService, in nsISupports nativeAppSupportOrSplashScreen); Obsolete since Gecko 1.8 |
void quit(in PRUint32 aFerocity); Obsolete since Gecko 1.8 |
void registerTopLevelWindow(in nsIXULWindow aWindow); |
void run(); Obsolete since Gecko 1.8 |
void topLevelWindowIsModal(in nsIXULWindow aWindow, in boolean aModal); Obsolete since Gecko 1.9.1 |
void unregisterTopLevelWindow(in nsIXULWindow aWindow); |
Note: Prior to Gecko 8.0, all references to nsIDOMWindow
used in this interface were nsIDOMWindowInternal
.
Attribute | Type | Description |
applicationProvidedHiddenWindow |
boolean |
Return true if the application hidden window was provided by the application. If it was not, the default hidden window was used. This will usually be false on all non-mac platforms. Read only. |
hiddenDOMWindow |
nsIDOMWindow |
Return the (singleton) application hidden window, automatically created and maintained by this AppShellService. Read only. |
hiddenWindow |
nsIXULWindow |
Return the (singleton) application hidden window, automatically created and maintained by this AppShellService. Read only. |
nativeAppSupport |
nsINativeAppSupport |
Getter for "native application support." Read only. Obsolete since Gecko 1.8 |
Constant | Value | Description |
SIZE_TO_CONTENT |
-1 |
Create a window, which will be initially invisible. |
eConsiderQuit |
1 |
Attempt to quit if all windows are closed. Obsolete since Gecko 1.8 |
eAttemptQuit |
2 |
Try to close all windows, then quit if successful. Obsolete since Gecko 1.8 |
eForceQuit |
3 |
Force all windows to close, then quit. Obsolete since Gecko 1.8 |
Close a window.
void closeTopLevelWindow( in nsIXULWindow aWindow );
aWindow
Creates a hidden window.
void createHiddenWindow( in nsIAppShell aAppShell );
aAppShell
Creates the initial state of the application by launching tasks specfied by "general.startup.*" prefs.
SIZE_TO_CONTENT
may be used for width or height.boolean createStartupState( in long aWindowWidth, in long aWindowHeight );
aWindowWidth
aWindowHeight
true
if a window was opened.
This method creates a window, which will be initially invisible.
nsIXULWindow createTopLevelWindow( in nsIXULWindow aParent, in nsIURI aUrl, in boolean aShowWindow, in boolean aLoadDefaultPage, in PRUint32 aChromeMask, in long aInitialWidth, in long aInitialHeight, in nsIAppShell aAppShell );
aParent
aUrl
aShowWindow
Obsolete since Gecko 1.8PR_FALSE
.aLoadDefaultPage
Obsolete since Gecko 1.8aChromeMask
nsIBrowserWindow
for bit/flag definitions).aInitialWidth
NS_SIZETOCONTENT
to force the window to wrap to its contents.aInitialHeight
NS_SIZETOCONTENT
to force the window to wrap to its contents.aAppShell
Returns the newly created window.
Destroys a hidden window.
void destroyHiddenWindow();
None.
Starts up the profile manager with the given arguments.
void doProfileStartup( in nsICmdLineService aCmdLineService, in boolean canInteract );
aCmdLineService
canInteract
false
and UI is needed, will fail.Ensures that at least one window exists after creating the startup state. If one has not been made, this will create a browser window.
void ensure1Window( in nsICmdLineService aCmdLineService );
aCmdLineService
During application startup (and at other times!) we may temporarily encounter a situation where all application windows will be closed but we do not want to take this as a signal to quit the application. Bracket the code where the last window could close with these. (And at application startup, on platforms that do not normally quit when the last window has closed, call Enter once, but not Exit)
void enterLastWindowClosingSurvivalArea();
None.
void exitLastWindowClosingSurvivalArea();
None.
Return the (singleton) application hidden window as an nsIDOMWindow
, and, the corresponding JavaScript context pointer. This is useful if you'd like to subsequently call OpenDialog on the hidden window.
void getHiddenWindowAndJSContext( out nsIDOMWindow aHiddenDOMWindow, out JSContext aJSContext );
aHiddenDOMWindow
QueryInterface
'd to type nsIDOMWindow
.aJSContext
Remove the splash screen (if visible). This need be called only once per application session.
void hideSplashScreen();
None.
Required initialization routine.
void initialize( in nsICmdLineService aCmdLineService, in nsISupports nativeAppSupportOrSplashScreen );
aCmdLineService
nativeAppSupportOrSplashScreen
QueryInterface
'd to either an nsINativeAppSupport
or nsISplashScreen
; this object will be used to implement HideSplashScreen.Exit the event loop, shut down the app.
void quit( in PRUint32 aFerocity );
aFerocity
This method creates a browser that does not have a window. If the browser is exited, this windowless browser will not prevent Firefox from exiting. E10s notes: The browser is created in process. To get an out of process element you want to communicate with via message manager, then append a browser element with remote attribute set to true. Follow this bug - Bugzilla - Bug 1280028
nsIWebNav createWindowlessBrowser( in bool aIsChrome );
var webnav = Services.appShell.createWindowlessBrowser(true); var docshell = webnav.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDocShell); var systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal); docshell.createAboutBlankContentViewer(systemPrincipal); var contentWindow = docshell.contentViewer.DOMDocument.defaultView; // when you are done with it, destroy it if (webnav.close) { webnav.close() }; // only available in Firefox 46+, and is needed for good measure webnav = null; // in Firefox <= 45 setting to null will cause it to get GC'ed which will destroy it
Add a window to the application's registry of windows. These windows are generally shown in the Windows taskbar, and the application knows it can not quit until it is out of registered windows.
void registerTopLevelWindow( in nsIXULWindow aWindow );
aWindow
Runs an application event loop: normally the main event pump which defines the lifetime of the application.
void run();
None.
The appshell service needs to be informed of modal XUL windows currently open. Call this method as a window becomes modal or as it becomes nonmodal.
void topLevelWindowIsModal( in nsIXULWindow aWindow, in boolean aModal );
aWindow
aModal
true
if aWindow
is becoming modal or false
if aWindow
is becoming nonmodal (or being closed).Remove a window from the application's window registry.
void unregisterTopLevelWindow( in nsIXULWindow aWindow );
aWindow