2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 sw=2 et tw=80: */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Travis Bogard <travis@netscape.com>
|
|
|
|
* Dan Rosen <dr@netscape.com>
|
|
|
|
* Vidur Apparao <vidur@netscape.com>
|
|
|
|
* Johnny Stenback <jst@netscape.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef nsGlobalWindow_h___
|
|
|
|
#define nsGlobalWindow_h___
|
|
|
|
|
|
|
|
// Local Includes
|
|
|
|
// Helper Classes
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsHashtable.h"
|
|
|
|
#include "nsDataHashtable.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2008-02-12 20:17:18 -08:00
|
|
|
#include "nsDOMScriptObjectHolder.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Interfaces Needed
|
|
|
|
#include "nsDOMWindowList.h"
|
|
|
|
#include "nsIBaseWindow.h"
|
|
|
|
#include "nsIBrowserDOMWindow.h"
|
|
|
|
#include "nsIDocShellTreeOwner.h"
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
#include "nsIDOMClientInformation.h"
|
|
|
|
#include "nsIDOMViewCSS.h"
|
2007-05-14 02:11:38 -07:00
|
|
|
#include "nsIDOMEventTarget.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDOM3EventTarget.h"
|
|
|
|
#include "nsIDOMNSEventTarget.h"
|
|
|
|
#include "nsIDOMNavigator.h"
|
|
|
|
#include "nsIDOMNSLocation.h"
|
|
|
|
#include "nsIDOMWindowInternal.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
|
|
|
#include "nsIDOMJSWindow.h"
|
|
|
|
#include "nsIDOMChromeWindow.h"
|
|
|
|
#include "nsIScriptGlobalObject.h"
|
|
|
|
#include "nsIScriptContext.h"
|
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
|
|
|
#include "nsIScriptTimeoutHandler.h"
|
|
|
|
#include "nsITimer.h"
|
|
|
|
#include "nsIWebBrowserChrome.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
2007-07-26 10:52:26 -07:00
|
|
|
#include "nsIDOMModalContentWindow.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIScriptSecurityManager.h"
|
|
|
|
#include "nsIEventListenerManager.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
|
|
|
#include "nsIDOMCrypto.h"
|
|
|
|
#include "nsIDOMPkcs11.h"
|
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsPluginArray.h"
|
|
|
|
#include "nsMimeTypeArray.h"
|
|
|
|
#include "nsIXPCScriptable.h"
|
|
|
|
#include "nsPoint.h"
|
|
|
|
#include "nsSize.h"
|
|
|
|
#include "mozFlushType.h"
|
|
|
|
#include "prclist.h"
|
|
|
|
#include "nsIDOMStorage.h"
|
|
|
|
#include "nsIDOMStorageList.h"
|
|
|
|
#include "nsIDOMStorageWindow.h"
|
2007-05-29 02:45:30 -07:00
|
|
|
#include "nsIDOMOfflineResourceList.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsPIDOMEventTarget.h"
|
2007-07-26 10:52:26 -07:00
|
|
|
#include "nsIArray.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
|
|
|
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
|
|
|
|
|
|
|
class nsIDOMBarProp;
|
|
|
|
class nsIDocument;
|
|
|
|
class nsIContent;
|
|
|
|
class nsPresContext;
|
|
|
|
class nsIDOMEvent;
|
|
|
|
class nsIScrollableView;
|
2007-10-13 09:42:44 -07:00
|
|
|
class nsIControllers;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsBarProp;
|
|
|
|
class nsLocation;
|
|
|
|
class nsNavigator;
|
|
|
|
class nsScreen;
|
|
|
|
class nsHistory;
|
|
|
|
class nsIDocShellLoadInfo;
|
|
|
|
class WindowStateHolder;
|
|
|
|
class nsGlobalWindowObserver;
|
|
|
|
class nsGlobalWindow;
|
2007-10-09 18:24:28 -07:00
|
|
|
#ifdef OJI
|
|
|
|
class nsDummyJavaPluginOwner;
|
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-05-29 02:45:30 -07:00
|
|
|
class nsDOMOfflineResourceList;
|
2007-07-08 23:19:27 -07:00
|
|
|
class nsDOMOfflineLoadStatusList;
|
2007-05-29 02:45:30 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// permissible values for CheckOpenAllow
|
|
|
|
enum OpenAllowValue {
|
|
|
|
allowNot = 0, // the window opening is denied
|
|
|
|
allowNoAbuse, // allowed: not a popup
|
|
|
|
allowWhitelisted // allowed: it's whitelisted or popup blocking is disabled
|
|
|
|
};
|
|
|
|
|
|
|
|
extern nsresult
|
2008-01-29 18:11:48 -08:00
|
|
|
NS_CreateJSTimeoutHandler(nsGlobalWindow *aWindow,
|
2007-07-03 15:38:04 -07:00
|
|
|
PRBool *aIsInterval,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 *aInterval,
|
|
|
|
nsIScriptTimeoutHandler **aRet);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Timeout struct that holds information about each script
|
|
|
|
* timeout. Holds a strong reference to an nsIScriptTimeoutHandler, which
|
|
|
|
* abstracts the language specific cruft.
|
|
|
|
*/
|
|
|
|
struct nsTimeout : PRCList
|
|
|
|
{
|
|
|
|
nsTimeout();
|
|
|
|
~nsTimeout();
|
|
|
|
|
|
|
|
nsrefcnt Release();
|
|
|
|
nsrefcnt AddRef();
|
|
|
|
|
|
|
|
nsTimeout* Next() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTimeout*>(PR_NEXT_LINK(this));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTimeout* Prev() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTimeout*>(PR_PREV_LINK(this));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Window for which this timeout fires
|
|
|
|
nsRefPtr<nsGlobalWindow> mWindow;
|
|
|
|
|
|
|
|
// The actual timer object
|
|
|
|
nsCOMPtr<nsITimer> mTimer;
|
|
|
|
|
|
|
|
// True if the timeout was cleared
|
|
|
|
PRPackedBool mCleared;
|
|
|
|
|
|
|
|
// True if this is one of the timeouts that are currently running
|
|
|
|
PRPackedBool mRunning;
|
|
|
|
|
|
|
|
// Returned as value of setTimeout()
|
|
|
|
PRUint32 mPublicId;
|
|
|
|
|
|
|
|
// Non-zero interval in milliseconds if repetitive timeout
|
|
|
|
PRUint32 mInterval;
|
|
|
|
|
|
|
|
// Nominal time (in microseconds since the epoch) to run this
|
|
|
|
// timeout
|
|
|
|
PRTime mWhen;
|
|
|
|
|
|
|
|
// Principal with which to execute
|
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
|
|
|
|
|
|
// stack depth at which timeout is firing
|
|
|
|
PRUint32 mFiringDepth;
|
|
|
|
|
|
|
|
// The popup state at timeout creation time if not created from
|
|
|
|
// another timeout
|
|
|
|
PopupControlState mPopupState;
|
|
|
|
|
|
|
|
// The language-specific information about the callback.
|
|
|
|
nsCOMPtr<nsIScriptTimeoutHandler> mScriptHandler;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// reference count for shared usage
|
|
|
|
PRInt32 mRefCnt;
|
|
|
|
};
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
// nsGlobalWindow: Global Object for Scripting
|
|
|
|
//*****************************************************************************
|
|
|
|
// Beware that all scriptable interfaces implemented by
|
|
|
|
// nsGlobalWindow will be reachable from JS, if you make this class
|
|
|
|
// implement new interfaces you better know what you're
|
|
|
|
// doing. Security wise this is very sensitive code. --
|
|
|
|
// jst@netscape.com
|
|
|
|
|
|
|
|
// nsGlobalWindow inherits PRCList for maintaining a list of all inner
|
2008-01-29 17:31:29 -08:00
|
|
|
// windows still in memory for any given outer window. This list is
|
2007-03-22 10:30:00 -07:00
|
|
|
// needed to ensure that mOuterWindow doesn't end up dangling. The
|
|
|
|
// nature of PRCList means that the window itself is always in the
|
|
|
|
// list, and an outer window's list will also contain all inner window
|
|
|
|
// objects that are still in memory (and in reality all inner window
|
|
|
|
// object's lists also contain its outer and all other inner windows
|
|
|
|
// belonging to the same outer window, but that's an unimportant
|
|
|
|
// side effect of inheriting PRCList).
|
|
|
|
|
|
|
|
class nsGlobalWindow : public nsPIDOMWindow,
|
|
|
|
public nsIScriptGlobalObject,
|
|
|
|
public nsIDOMJSWindow,
|
|
|
|
public nsIScriptObjectPrincipal,
|
2007-05-14 02:11:38 -07:00
|
|
|
public nsIDOMEventTarget,
|
2007-03-22 10:30:00 -07:00
|
|
|
public nsPIDOMEventTarget,
|
|
|
|
public nsIDOM3EventTarget,
|
|
|
|
public nsIDOMNSEventTarget,
|
|
|
|
public nsIDOMViewCSS,
|
|
|
|
public nsIDOMStorageWindow,
|
|
|
|
public nsSupportsWeakReference,
|
|
|
|
public nsIInterfaceRequestor,
|
|
|
|
public PRCListStr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// public methods
|
|
|
|
nsPIDOMWindow* GetPrivateParent();
|
|
|
|
// callback for close event
|
|
|
|
void ReallyCloseWindow();
|
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIScriptGlobalObject
|
|
|
|
virtual nsIScriptContext *GetContext();
|
|
|
|
virtual JSObject *GetGlobalJSObject();
|
|
|
|
|
|
|
|
virtual nsresult EnsureScriptEnvironment(PRUint32 aLangID);
|
|
|
|
|
|
|
|
virtual nsIScriptContext *GetScriptContext(PRUint32 lang);
|
|
|
|
virtual void *GetScriptGlobal(PRUint32 lang);
|
|
|
|
|
|
|
|
// Set a new script language context for this global. The native global
|
|
|
|
// for the context is created by the context's GetNativeGlobal() method.
|
|
|
|
virtual nsresult SetScriptContext(PRUint32 lang, nsIScriptContext *aContext);
|
|
|
|
|
|
|
|
virtual void OnFinalize(PRUint32 aLangID, void *aScriptGlobal);
|
|
|
|
virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts);
|
|
|
|
virtual nsresult SetNewArguments(nsIArray *aArguments);
|
|
|
|
|
|
|
|
// nsIScriptObjectPrincipal
|
|
|
|
virtual nsIPrincipal* GetPrincipal();
|
|
|
|
|
|
|
|
// nsIDOMWindow
|
|
|
|
NS_DECL_NSIDOMWINDOW
|
|
|
|
|
|
|
|
// nsIDOMWindow2
|
|
|
|
NS_DECL_NSIDOMWINDOW2
|
|
|
|
|
|
|
|
// nsIDOMWindowInternal
|
|
|
|
NS_DECL_NSIDOMWINDOWINTERNAL
|
|
|
|
|
|
|
|
// nsIDOMJSWindow
|
|
|
|
NS_DECL_NSIDOMJSWINDOW
|
|
|
|
|
|
|
|
// nsIDOMEventTarget
|
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
|
|
|
|
|
|
|
// nsIDOM3EventTarget
|
|
|
|
NS_DECL_NSIDOM3EVENTTARGET
|
|
|
|
|
|
|
|
// nsIDOMNSEventTarget
|
|
|
|
NS_DECL_NSIDOMNSEVENTTARGET
|
|
|
|
|
|
|
|
// nsPIDOMWindow
|
|
|
|
virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
|
|
|
|
virtual NS_HIDDEN_(nsresult) Activate();
|
|
|
|
virtual NS_HIDDEN_(nsresult) Deactivate();
|
|
|
|
virtual NS_HIDDEN_(nsIFocusController*) GetRootFocusController();
|
|
|
|
|
|
|
|
virtual NS_HIDDEN_(void) SetOpenerScriptPrincipal(nsIPrincipal* aPrincipal);
|
|
|
|
virtual NS_HIDDEN_(nsIPrincipal*) GetOpenerScriptPrincipal();
|
|
|
|
|
|
|
|
virtual NS_HIDDEN_(PopupControlState) PushPopupControlState(PopupControlState state, PRBool aForce) const;
|
|
|
|
virtual NS_HIDDEN_(void) PopPopupControlState(PopupControlState state) const;
|
|
|
|
virtual NS_HIDDEN_(PopupControlState) GetPopupControlState() const;
|
|
|
|
|
|
|
|
virtual NS_HIDDEN_(nsresult) SaveWindowState(nsISupports **aState);
|
|
|
|
virtual NS_HIDDEN_(nsresult) RestoreWindowState(nsISupports *aState);
|
|
|
|
virtual NS_HIDDEN_(nsresult) ResumeTimeouts();
|
|
|
|
virtual NS_HIDDEN_(nsresult) FireDelayedDOMEvents();
|
2008-01-16 13:54:33 -08:00
|
|
|
virtual NS_HIDDEN_(PRBool) IsFrozen() const
|
|
|
|
{
|
|
|
|
return mIsFrozen;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual NS_HIDDEN_(PRBool) WouldReuseInnerWindow(nsIDocument *aNewDocument);
|
|
|
|
|
2007-04-17 02:18:36 -07:00
|
|
|
virtual NS_HIDDEN_(nsPIDOMEventTarget*) GetTargetForDOMEvent()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsPIDOMEventTarget*>(GetOuterWindowInternal());
|
2007-04-17 02:18:36 -07:00
|
|
|
}
|
|
|
|
virtual NS_HIDDEN_(nsPIDOMEventTarget*) GetTargetForEventTargetChain()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsPIDOMEventTarget*>(GetCurrentInnerWindowInternal());
|
2007-04-17 02:18:36 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual NS_HIDDEN_(nsresult) PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
|
|
|
virtual NS_HIDDEN_(nsresult) PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
|
|
|
virtual NS_HIDDEN_(nsresult) DispatchDOMEvent(nsEvent* aEvent,
|
|
|
|
nsIDOMEvent* aDOMEvent,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
nsEventStatus* aEventStatus);
|
2007-05-14 02:11:38 -07:00
|
|
|
virtual NS_HIDDEN_(nsresult) GetListenerManager(PRBool aCreateIfNotFound,
|
|
|
|
nsIEventListenerManager** aResult);
|
|
|
|
virtual NS_HIDDEN_(nsresult) AddEventListenerByIID(nsIDOMEventListener *aListener,
|
|
|
|
const nsIID& aIID);
|
|
|
|
virtual NS_HIDDEN_(nsresult) RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
|
|
|
const nsIID& aIID);
|
|
|
|
virtual NS_HIDDEN_(nsresult) GetSystemEventGroup(nsIDOMEventGroup** aGroup);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual NS_HIDDEN_(void) SetDocShell(nsIDocShell* aDocShell);
|
|
|
|
virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,
|
|
|
|
nsISupports *aState,
|
|
|
|
PRBool aClearScopeHint);
|
|
|
|
virtual NS_HIDDEN_(void) SetOpenerWindow(nsIDOMWindowInternal *aOpener,
|
|
|
|
PRBool aOriginalOpener);
|
|
|
|
virtual NS_HIDDEN_(void) EnsureSizeUpToDate();
|
|
|
|
|
|
|
|
virtual NS_HIDDEN_(void) EnterModalState();
|
|
|
|
virtual NS_HIDDEN_(void) LeaveModalState();
|
|
|
|
|
|
|
|
// nsIDOMViewCSS
|
|
|
|
NS_DECL_NSIDOMVIEWCSS
|
|
|
|
|
|
|
|
// nsIDOMAbstractView
|
|
|
|
NS_DECL_NSIDOMABSTRACTVIEW
|
|
|
|
|
|
|
|
// nsIDOMStorageWindow
|
|
|
|
NS_DECL_NSIDOMSTORAGEWINDOW
|
|
|
|
|
|
|
|
// nsIInterfaceRequestor
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
|
|
|
|
// Object Management
|
|
|
|
nsGlobalWindow(nsGlobalWindow *aOuterWindow);
|
|
|
|
|
|
|
|
static nsGlobalWindow *FromWrapper(nsIXPConnectWrappedNative *wrapper)
|
|
|
|
{
|
|
|
|
// Make sure this matches the casts we do in QueryInterface().
|
|
|
|
return (nsGlobalWindow *)(nsIScriptGlobalObject *)wrapper->Native();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIScriptContext *GetContextInternal()
|
|
|
|
{
|
|
|
|
if (mOuterWindow) {
|
|
|
|
return GetOuterWindowInternal()->mContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIScriptContext *GetScriptContextInternal(PRUint32 aLangID)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(NS_STID_VALID(aLangID), "Invalid language");
|
|
|
|
if (mOuterWindow) {
|
|
|
|
return GetOuterWindowInternal()->mScriptContexts[NS_STID_INDEX(aLangID)];
|
|
|
|
}
|
|
|
|
|
|
|
|
return mScriptContexts[NS_STID_INDEX(aLangID)];
|
|
|
|
}
|
|
|
|
|
|
|
|
nsGlobalWindow *GetOuterWindowInternal()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsGlobalWindow *>(GetOuterWindow());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsGlobalWindow *GetCurrentInnerWindowInternal()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsGlobalWindow *>(mInnerWindow);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsGlobalWindow *EnsureInnerWindowInternal()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsGlobalWindow *>(EnsureInnerWindow());
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
PRBool IsCreatingInnerWindow() const
|
|
|
|
{
|
|
|
|
return mCreatingInnerWindow;
|
|
|
|
}
|
|
|
|
|
2007-08-02 16:34:38 -07:00
|
|
|
PRBool IsChromeWindow() const
|
|
|
|
{
|
|
|
|
return mIsChrome;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult Observe(nsISupports* aSubject, const char* aTopic,
|
|
|
|
const PRUnichar* aData);
|
|
|
|
|
|
|
|
static void ShutDown();
|
2008-02-12 20:17:18 -08:00
|
|
|
static void CleanupCachedXBLHandlers(nsGlobalWindow* aWindow);
|
2007-03-22 10:30:00 -07:00
|
|
|
static PRBool IsCallerChrome();
|
|
|
|
static void CloseBlockScriptTerminationFunc(nsISupports *aRef);
|
|
|
|
|
|
|
|
static void RunPendingTimeoutsRecursive(nsGlobalWindow *aTopWindow,
|
|
|
|
nsGlobalWindow *aWindow);
|
|
|
|
|
|
|
|
friend class WindowStateHolder;
|
|
|
|
|
2008-02-12 20:17:18 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
|
|
|
|
nsIScriptGlobalObject)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-10-09 18:24:28 -07:00
|
|
|
void InitJavaProperties();
|
|
|
|
|
2008-02-12 20:17:18 -08:00
|
|
|
virtual NS_HIDDEN_(void*)
|
|
|
|
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey);
|
|
|
|
|
|
|
|
virtual NS_HIDDEN_(void)
|
|
|
|
CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
|
|
|
nsScriptObjectHolder& aHandler);
|
|
|
|
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
// Object Management
|
|
|
|
virtual ~nsGlobalWindow();
|
|
|
|
void CleanUp();
|
|
|
|
void ClearControllers();
|
|
|
|
|
|
|
|
void FreeInnerObjects(PRBool aClearScope);
|
2008-01-29 21:30:11 -08:00
|
|
|
nsGlobalWindow *CallerInnerWindow();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult SetNewDocument(nsIDocument *aDocument,
|
|
|
|
nsISupports *aState,
|
|
|
|
PRBool aClearScopeHint,
|
|
|
|
PRBool aIsInternalCall);
|
|
|
|
|
|
|
|
// Get the parent, returns null if this is a toplevel window
|
|
|
|
nsIDOMWindowInternal *GetParentInternal();
|
|
|
|
|
|
|
|
// popup tracking
|
|
|
|
PRBool IsPopupSpamWindow()
|
|
|
|
{
|
|
|
|
if (IsInnerWindow() && !mOuterWindow) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GetOuterWindowInternal()->mIsPopupSpam;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetPopupSpamWindow(PRBool aPopup)
|
|
|
|
{
|
|
|
|
if (IsInnerWindow() && !mOuterWindow) {
|
|
|
|
NS_ERROR("SetPopupSpamWindow() called on inner window w/o an outer!");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetOuterWindowInternal()->mIsPopupSpam = aPopup;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Window Control Functions
|
|
|
|
/**
|
|
|
|
* @param aURL the URL to load in the new window
|
|
|
|
* @param aName the name to use for the new window
|
|
|
|
* @param aOptions the window options to use for the new window
|
|
|
|
* @param aDialog true when called from variants of OpenDialog. If this is
|
|
|
|
* true, this method will skip popup blocking checks. The
|
|
|
|
* aDialog argument is passed on to the window watcher.
|
|
|
|
* @param aCalledNoScript true when called via the [noscript] open()
|
|
|
|
* and openDialog() methods. When this is true, we do
|
|
|
|
* NOT want to use the JS stack for things like caller
|
|
|
|
* determination.
|
|
|
|
* @param aDoJSFixups true when this is the content-accessible JS version of
|
|
|
|
* window opening. When true, popups do not cause us to
|
|
|
|
* throw, we save the caller's principal in the new window
|
|
|
|
* for later consumption, and we make sure that there is a
|
|
|
|
* document in the newly-opened window. Note that this
|
|
|
|
* last will only be done if the newly-opened window is
|
|
|
|
* non-chrome.
|
|
|
|
* @param argv The arguments to pass to the new window. The first
|
|
|
|
* three args, if present, will be aURL, aName, and aOptions. So
|
|
|
|
* this param only matters if there are more than 3 arguments.
|
|
|
|
* @param argc The number of arguments in argv.
|
|
|
|
* @param aExtraArgument Another way to pass arguments in. This is mutually
|
|
|
|
* exclusive with the argv/argc approach.
|
|
|
|
* @param aJSCallerContext The calling script's context. This must be nsnull
|
|
|
|
* when aCalledNoScript is true.
|
|
|
|
* @param aReturn [out] The window that was opened, if any.
|
|
|
|
*
|
|
|
|
* @note that the boolean args are const because the function shouldn't be
|
|
|
|
* messing with them. That also makes it easier for the compiler to sort out
|
|
|
|
* its build warning stuff.
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(nsresult) OpenInternal(const nsAString& aUrl,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aOptions,
|
|
|
|
PRBool aDialog,
|
2007-09-07 13:30:15 -07:00
|
|
|
PRBool aContentModal,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool aCalledNoScript,
|
|
|
|
PRBool aDoJSFixups,
|
|
|
|
nsIArray *argv,
|
|
|
|
nsISupports *aExtraArgument,
|
|
|
|
nsIPrincipal *aCalleePrincipal,
|
|
|
|
JSContext *aJSCallerContext,
|
|
|
|
nsIDOMWindow **aReturn);
|
|
|
|
|
|
|
|
static void CloseWindow(nsISupports* aWindow);
|
|
|
|
static void ClearWindowScope(nsISupports* aWindow);
|
|
|
|
|
|
|
|
// Timeout Functions
|
|
|
|
// Language agnostic timeout function (all args passed)
|
|
|
|
nsresult SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
|
|
|
|
PRInt32 interval,
|
|
|
|
PRBool aIsInterval, PRInt32 *aReturn);
|
|
|
|
nsresult ClearTimeoutOrInterval(PRInt32 aTimerID);
|
|
|
|
|
|
|
|
// JS specific timeout functions (JS args grabbed from context).
|
|
|
|
nsresult SetTimeoutOrInterval(PRBool aIsInterval, PRInt32* aReturn);
|
|
|
|
nsresult ClearTimeoutOrInterval();
|
|
|
|
|
|
|
|
// The timeout implementation functions.
|
|
|
|
void RunTimeout(nsTimeout *aTimeout);
|
|
|
|
|
|
|
|
void ClearAllTimeouts();
|
|
|
|
// Insert aTimeout into the list, before all timeouts that would
|
|
|
|
// fire after it, but no earlier than mTimeoutInsertionPoint, if any.
|
|
|
|
void InsertTimeoutIntoList(nsTimeout *aTimeout);
|
|
|
|
static void TimerCallback(nsITimer *aTimer, void *aClosure);
|
|
|
|
|
|
|
|
// Helper Functions
|
|
|
|
nsresult GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner);
|
|
|
|
nsresult GetTreeOwner(nsIBaseWindow** aTreeOwner);
|
|
|
|
nsresult GetWebBrowserChrome(nsIWebBrowserChrome** aBrowserChrome);
|
|
|
|
// GetScrollInfo does not flush. Callers should do it themselves as needed,
|
|
|
|
// depending on which info they actually want off the scrollable view.
|
|
|
|
nsresult GetScrollInfo(nsIScrollableView** aScrollableView);
|
|
|
|
nsresult SecurityCheckURL(const char *aURL);
|
|
|
|
nsresult BuildURIfromBase(const char *aURL,
|
|
|
|
nsIURI **aBuiltURI,
|
|
|
|
PRBool *aFreeSecurityPass, JSContext **aCXused);
|
|
|
|
PopupControlState CheckForAbusePoint();
|
|
|
|
OpenAllowValue CheckOpenAllow(PopupControlState aAbuseLevel);
|
|
|
|
void FireAbuseEvents(PRBool aBlocked, PRBool aWindow,
|
|
|
|
const nsAString &aPopupURL,
|
|
|
|
const nsAString &aPopupWindowName,
|
|
|
|
const nsAString &aPopupWindowFeatures);
|
|
|
|
void FireOfflineStatusEvent();
|
|
|
|
|
|
|
|
void FlushPendingNotifications(mozFlushType aType);
|
|
|
|
void EnsureReflowFlushAndPaint();
|
|
|
|
nsresult CheckSecurityWidthAndHeight(PRInt32* width, PRInt32* height);
|
|
|
|
nsresult CheckSecurityLeftAndTop(PRInt32* left, PRInt32* top);
|
|
|
|
static PRBool CanSetProperty(const char *aPrefName);
|
|
|
|
|
|
|
|
static void MakeScriptDialogTitle(nsAString &aOutTitle);
|
|
|
|
|
2008-03-19 13:27:34 -07:00
|
|
|
static PRBool CanMoveResizeWindows();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Helper for window.find()
|
|
|
|
nsresult FindInternal(const nsAString& aStr, PRBool caseSensitive,
|
|
|
|
PRBool backwards, PRBool wrapAround, PRBool wholeWord,
|
|
|
|
PRBool searchInFrames, PRBool showDialog,
|
|
|
|
PRBool *aReturn);
|
|
|
|
|
|
|
|
nsresult ConvertCharset(const nsAString& aStr, char** aDest);
|
|
|
|
|
|
|
|
PRBool GetBlurSuppression();
|
|
|
|
|
|
|
|
// If aDoFlush is true, we'll flush our own layout; otherwise we'll try to
|
|
|
|
// just flush our parent and only flush ourselves if we think we need to.
|
|
|
|
nsresult GetScrollXY(PRInt32* aScrollX, PRInt32* aScrollY,
|
|
|
|
PRBool aDoFlush);
|
|
|
|
nsresult GetScrollMaxXY(PRInt32* aScrollMaxX, PRInt32* aScrollMaxY);
|
2008-04-01 15:20:45 -07:00
|
|
|
|
|
|
|
nsresult GetOuterSize(nsIntSize* aSizeCSSPixels);
|
|
|
|
nsresult SetOuterSize(PRInt32 aLengthCSSPixels, PRBool aIsWidth);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
PRBool IsFrame()
|
|
|
|
{
|
|
|
|
return GetParentInternal() != nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool DispatchCustomEvent(const char *aEventName);
|
|
|
|
|
|
|
|
// If aLookForCallerOnJSStack is true, this method will look at the JS stack
|
|
|
|
// to determine who the caller is. If it's false, it'll use |this| as the
|
|
|
|
// caller.
|
|
|
|
PRBool WindowExists(const nsAString& aName, PRBool aLookForCallerOnJSStack);
|
|
|
|
|
|
|
|
already_AddRefed<nsIWidget> GetMainWidget();
|
|
|
|
|
2008-04-15 11:02:22 -07:00
|
|
|
void SuspendTimeouts();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
void Freeze()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(!IsFrozen(), "Double-freezing?");
|
|
|
|
mIsFrozen = PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Thaw()
|
|
|
|
{
|
|
|
|
mIsFrozen = PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool IsInModalState();
|
|
|
|
|
|
|
|
nsTimeout* FirstTimeout() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTimeout*>(PR_LIST_HEAD(&mTimeouts));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTimeout* LastTimeout() {
|
|
|
|
// Note: might not actually return an nsTimeout. Use IsTimeout to check.
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTimeout*>(PR_LIST_TAIL(&mTimeouts));
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
PRBool IsTimeout(PRCList* aList) {
|
|
|
|
return aList != &mTimeouts;
|
|
|
|
}
|
|
|
|
|
2008-02-13 15:41:17 -08:00
|
|
|
static void NotifyDOMWindowDestroyed(nsGlobalWindow* aWindow);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// When adding new member variables, be careful not to create cycles
|
|
|
|
// through JavaScript. If there is any chance that a member variable
|
|
|
|
// could own objects that are implemented in JavaScript, then those
|
|
|
|
// objects will keep the global object (this object) alive. To prevent
|
|
|
|
// these cycles, ownership of such members must be released in
|
|
|
|
// |CleanUp| and |SetDocShell|.
|
|
|
|
|
|
|
|
// This member is also used on both inner and outer windows, but
|
|
|
|
// for slightly different purposes. On inner windows it means the
|
|
|
|
// inner window is held onto by session history and should not
|
|
|
|
// change. On outer windows it means that the window is in a state
|
|
|
|
// where we don't want to force creation of a new inner window since
|
|
|
|
// we're in the middle of doing just that.
|
|
|
|
PRPackedBool mIsFrozen : 1;
|
|
|
|
|
2007-10-09 18:24:28 -07:00
|
|
|
// True if the Java properties have been initialized on this
|
|
|
|
// window. Only used on inner windows.
|
|
|
|
PRPackedBool mDidInitJavaProperties : 1;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// These members are only used on outer window objects. Make sure
|
|
|
|
// you never set any of these on an inner object!
|
|
|
|
PRPackedBool mFullScreen : 1;
|
|
|
|
PRPackedBool mIsClosed : 1;
|
|
|
|
PRPackedBool mInClose : 1;
|
|
|
|
// mHavePendingClose means we've got a termination function set to
|
|
|
|
// close us when the JS stops executing or that we have a close
|
|
|
|
// event posted. If this is set, just ignore window.close() calls.
|
|
|
|
PRPackedBool mHavePendingClose : 1;
|
|
|
|
PRPackedBool mHadOriginalOpener : 1;
|
|
|
|
PRPackedBool mIsPopupSpam : 1;
|
|
|
|
|
|
|
|
// Indicates whether scripts are allowed to close this window.
|
|
|
|
PRPackedBool mBlockScriptedClosingFlag : 1;
|
|
|
|
|
|
|
|
// Track what sorts of events we need to fire when thawed
|
|
|
|
PRPackedBool mFireOfflineStatusChangeEventOnThaw : 1;
|
|
|
|
|
|
|
|
// Indicates whether we're in the middle of creating an initializing
|
|
|
|
// a new inner window object.
|
|
|
|
PRPackedBool mCreatingInnerWindow : 1;
|
2007-08-02 16:34:38 -07:00
|
|
|
|
|
|
|
// Fast way to tell if this is a chrome window (without having to QI).
|
|
|
|
PRPackedBool mIsChrome : 1;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIScriptContext> mContext;
|
2008-02-08 13:09:36 -08:00
|
|
|
nsWeakPtr mOpener;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIControllers> mControllers;
|
|
|
|
nsCOMPtr<nsIArray> mArguments;
|
|
|
|
nsCOMPtr<nsIArray> mArgumentsLast;
|
|
|
|
nsRefPtr<nsNavigator> mNavigator;
|
|
|
|
nsRefPtr<nsScreen> mScreen;
|
|
|
|
nsRefPtr<nsHistory> mHistory;
|
|
|
|
nsRefPtr<nsDOMWindowList> mFrames;
|
|
|
|
nsRefPtr<nsBarProp> mMenubar;
|
|
|
|
nsRefPtr<nsBarProp> mToolbar;
|
|
|
|
nsRefPtr<nsBarProp> mLocationbar;
|
|
|
|
nsRefPtr<nsBarProp> mPersonalbar;
|
|
|
|
nsRefPtr<nsBarProp> mStatusbar;
|
|
|
|
nsRefPtr<nsBarProp> mScrollbars;
|
|
|
|
nsCOMPtr<nsIWeakReference> mWindowUtils;
|
|
|
|
nsRefPtr<nsLocation> mLocation;
|
|
|
|
nsString mStatus;
|
|
|
|
nsString mDefaultStatus;
|
|
|
|
// index 0->language_id 1, so index MAX-1 == language_id MAX
|
|
|
|
nsCOMPtr<nsIScriptContext> mScriptContexts[NS_STID_ARRAY_UBOUND];
|
|
|
|
void * mScriptGlobals[NS_STID_ARRAY_UBOUND];
|
|
|
|
nsGlobalWindowObserver* mObserver;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMCrypto> mCrypto;
|
|
|
|
nsCOMPtr<nsIDOMPkcs11> mPkcs11;
|
|
|
|
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMStorageList> gGlobalStorageList;
|
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> mInnerWindowHolders[NS_STID_ARRAY_UBOUND];
|
|
|
|
nsCOMPtr<nsIPrincipal> mOpenerScriptPrincipal; // strong; used to determine
|
|
|
|
// whether to clear scope
|
|
|
|
|
|
|
|
// These member variable are used only on inner windows.
|
|
|
|
nsCOMPtr<nsIEventListenerManager> mListenerManager;
|
|
|
|
PRCList mTimeouts;
|
|
|
|
// If mTimeoutInsertionPoint is non-null, insertions should happen after it.
|
|
|
|
nsTimeout* mTimeoutInsertionPoint;
|
|
|
|
PRUint32 mTimeoutPublicIdCounter;
|
|
|
|
PRUint32 mTimeoutFiringDepth;
|
|
|
|
nsCOMPtr<nsIDOMStorage> mSessionStorage;
|
|
|
|
|
2007-10-09 18:24:28 -07:00
|
|
|
#ifdef OJI
|
|
|
|
nsRefPtr<nsDummyJavaPluginOwner> mDummyJavaPluginOwner;
|
|
|
|
#endif
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// These member variables are used on both inner and the outer windows.
|
|
|
|
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
|
|
|
nsCOMPtr<nsIDocument> mDoc; // For fast access to principals
|
|
|
|
JSObject* mJSObject;
|
|
|
|
|
|
|
|
nsDataHashtable<nsStringHashKey, PRBool> *mPendingStorageEvents;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
PRBool mSetOpenerWindowCalled;
|
2008-02-13 15:41:17 -08:00
|
|
|
PRUint32 mSerial;
|
2008-04-28 14:51:11 -07:00
|
|
|
nsCOMPtr<nsIURI> mLastOpenedURI;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2008-01-16 13:54:33 -08:00
|
|
|
nsCOMPtr<nsIDOMOfflineResourceList> mApplicationCache;
|
|
|
|
|
2008-02-12 20:17:18 -08:00
|
|
|
nsDataHashtable<nsVoidPtrHashKey, void*> mCachedXBLPrototypeHandlers;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
friend class nsDOMScriptableHelper;
|
|
|
|
friend class nsDOMWindowUtils;
|
|
|
|
static nsIFactory *sComputedDOMStyleFactory;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* nsGlobalChromeWindow inherits from nsGlobalWindow. It is the global
|
|
|
|
* object created for a Chrome Window only.
|
|
|
|
*/
|
|
|
|
class nsGlobalChromeWindow : public nsGlobalWindow,
|
|
|
|
public nsIDOMChromeWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMChromeWindow interface
|
|
|
|
NS_DECL_NSIDOMCHROMEWINDOW
|
|
|
|
|
|
|
|
nsGlobalChromeWindow(nsGlobalWindow *aOuterWindow)
|
|
|
|
: nsGlobalWindow(aOuterWindow)
|
|
|
|
{
|
2007-08-02 16:34:38 -07:00
|
|
|
mIsChrome = PR_TRUE;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsGlobalChromeWindow,
|
|
|
|
nsGlobalWindow)
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
|
|
|
};
|
|
|
|
|
2007-07-26 10:52:26 -07:00
|
|
|
/*
|
|
|
|
* nsGlobalModalWindow inherits from nsGlobalWindow. It is the global
|
|
|
|
* object created for a modal content windows only (i.e. not modal
|
|
|
|
* chrome dialogs).
|
|
|
|
*/
|
|
|
|
class nsGlobalModalWindow : public nsGlobalWindow,
|
|
|
|
public nsIDOMModalContentWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsGlobalModalWindow(nsGlobalWindow *aOuterWindow)
|
|
|
|
: nsGlobalWindow(aOuterWindow)
|
|
|
|
{
|
|
|
|
mIsModalContentWindow = PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_NSIDOMMODALCONTENTWINDOW
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalModalWindow, nsGlobalWindow)
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIVariant> mReturnValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//*****************************************************************************
|
|
|
|
// nsNavigator: Script "navigator" object
|
|
|
|
//*****************************************************************************
|
|
|
|
|
|
|
|
class nsNavigator : public nsIDOMNavigator,
|
|
|
|
public nsIDOMJSNavigator,
|
|
|
|
public nsIDOMClientInformation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsNavigator(nsIDocShell *aDocShell);
|
|
|
|
virtual ~nsNavigator();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMNAVIGATOR
|
|
|
|
NS_DECL_NSIDOMJSNAVIGATOR
|
|
|
|
NS_DECL_NSIDOMCLIENTINFORMATION
|
|
|
|
|
|
|
|
void SetDocShell(nsIDocShell *aDocShell);
|
|
|
|
nsIDocShell *GetDocShell()
|
|
|
|
{
|
|
|
|
return mDocShell;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LoadingNewDocument();
|
|
|
|
nsresult RefreshMIMEArray();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsRefPtr<nsMimeTypeArray> mMimeTypes;
|
|
|
|
nsRefPtr<nsPluginArray> mPlugins;
|
|
|
|
nsIDocShell* mDocShell; // weak reference
|
|
|
|
|
|
|
|
static jsval sPrefInternal_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsIURI;
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
// nsLocation: Script "location" object
|
|
|
|
//*****************************************************************************
|
|
|
|
|
|
|
|
class nsLocation : public nsIDOMLocation,
|
|
|
|
public nsIDOMNSLocation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsLocation(nsIDocShell *aDocShell);
|
|
|
|
virtual ~nsLocation();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
void SetDocShell(nsIDocShell *aDocShell);
|
|
|
|
nsIDocShell *GetDocShell();
|
|
|
|
|
|
|
|
// nsIDOMLocation
|
|
|
|
NS_DECL_NSIDOMLOCATION
|
|
|
|
|
|
|
|
// nsIDOMNSLocation
|
|
|
|
NS_DECL_NSIDOMNSLOCATION
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// In the case of jar: uris, we sometimes want the place the jar was
|
|
|
|
// fetched from as the URI instead of the jar: uri itself. Pass in
|
|
|
|
// PR_TRUE for aGetInnermostURI when that's the case.
|
|
|
|
nsresult GetURI(nsIURI** aURL, PRBool aGetInnermostURI = PR_FALSE);
|
|
|
|
nsresult GetWritableURI(nsIURI** aURL);
|
|
|
|
nsresult SetURI(nsIURI* aURL, PRBool aReplace = PR_FALSE);
|
|
|
|
nsresult SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
|
|
|
|
PRBool aReplace);
|
|
|
|
nsresult SetHrefWithContext(JSContext* cx, const nsAString& aHref,
|
|
|
|
PRBool aReplace);
|
|
|
|
|
|
|
|
nsresult GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL);
|
|
|
|
nsresult GetSourceDocument(JSContext* cx, nsIDocument** aDocument);
|
|
|
|
|
|
|
|
nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo);
|
|
|
|
nsresult FindUsableBaseURI(nsIURI * aBaseURI, nsIDocShell * aParent, nsIURI ** aUsableURI);
|
|
|
|
|
|
|
|
nsWeakPtr mDocShell;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* factory function */
|
2007-07-26 10:52:26 -07:00
|
|
|
nsresult
|
|
|
|
NS_NewScriptGlobalObject(PRBool aIsChrome, PRBool aIsModalContentWindow,
|
|
|
|
nsIScriptGlobalObject **aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#endif /* nsGlobalWindow_h___ */
|