Throw if window.open is called on a window that has no chrome. Bug 306804, r+sr=jst

This commit is contained in:
bzbarsky%mit.edu 2005-09-10 04:16:59 +00:00
parent 2555a451fd
commit c96c0a25cd
3 changed files with 14 additions and 2 deletions

View File

@ -5565,6 +5565,14 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
aExtraArgument, aReturn),
NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsIWebBrowserChrome> chrome;
GetWebBrowserChrome(getter_AddRefs(chrome));
if (!chrome) {
// No chrome means we don't want to go through with this open call
// -- see nsIWindowWatcher.idl
return NS_ERROR_NOT_AVAILABLE;
}
nsXPIDLCString url;
nsresult rv = NS_OK;

View File

@ -75,7 +75,9 @@ interface nsIWindowWatcher : nsISupports {
/** Create a new window. It will automatically be added to our list
(via addWindow()).
@param aParent parent window. null if not.
@param aParent parent window, if any. Null if no parent. If it is
impossible to get to an nsIWebBrowserChrome from aParent, this
method will effectively act as if aParent were null.
@param aURL url to which to open the new window. Must already be
escaped, if applicable. can be null.
@param aName window name from JS window.open. can be null.

View File

@ -74,7 +74,9 @@ interface nsPIWindowWatcher : nsISupports
/** Like the public interface's open(), but can deal with openDialog
style arguments.
@param aParent parent window, if any. null if not.
@param aParent parent window, if any. Null if no parent. If it is
impossible to get to an nsIWebBrowserChrome from aParent, this
method will effectively act as if aParent were null.
@param aURL url to which to open the new window. Must already be
escaped, if applicable. can be null.
@param aName window name from JS window.open. can be null.