2011-08-03 04:22:40 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 sw=2 et tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-08-03 04:22:40 +00:00
|
|
|
|
|
|
|
#ifndef nsLocation_h__
|
|
|
|
#define nsLocation_h__
|
|
|
|
|
|
|
|
#include "nsIDOMLocation.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsWeakReference.h"
|
2012-11-06 22:29:09 +00:00
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2011-08-03 04:22:40 +00:00
|
|
|
|
|
|
|
class nsIURI;
|
|
|
|
class nsIDocShell;
|
|
|
|
struct JSContext;
|
|
|
|
class nsIDocument;
|
|
|
|
class nsIDocShellLoadInfo;
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
// nsLocation: Script "location" object
|
|
|
|
//*****************************************************************************
|
|
|
|
|
|
|
|
class nsLocation : public nsIDOMLocation
|
2012-11-06 22:29:09 +00:00
|
|
|
, public nsWrapperCache
|
2011-08-03 04:22:40 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsLocation(nsIDocShell *aDocShell);
|
|
|
|
virtual ~nsLocation();
|
|
|
|
|
2012-11-06 22:29:09 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsLocation)
|
2011-08-03 04:22:40 +00:00
|
|
|
|
|
|
|
void SetDocShell(nsIDocShell *aDocShell);
|
|
|
|
nsIDocShell *GetDocShell();
|
|
|
|
|
|
|
|
// nsIDOMLocation
|
|
|
|
NS_DECL_NSIDOMLOCATION
|
|
|
|
|
|
|
|
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
|
2011-10-17 14:59:28 +00:00
|
|
|
// true for aGetInnermostURI when that's the case.
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult GetURI(nsIURI** aURL, bool aGetInnermostURI = false);
|
2011-08-03 04:22:40 +00:00
|
|
|
nsresult GetWritableURI(nsIURI** aURL);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult SetURI(nsIURI* aURL, bool aReplace = false);
|
2011-08-03 04:22:40 +00:00
|
|
|
nsresult SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aReplace);
|
2011-08-03 04:22:40 +00:00
|
|
|
nsresult SetHrefWithContext(JSContext* cx, const nsAString& aHref,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aReplace);
|
2011-08-03 04:22:40 +00:00
|
|
|
|
|
|
|
nsresult GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL);
|
|
|
|
nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo);
|
2012-10-18 23:37:14 +00:00
|
|
|
bool CallerSubsumes();
|
2011-08-03 04:22:40 +00:00
|
|
|
|
|
|
|
nsString mCachedHash;
|
|
|
|
nsWeakPtr mDocShell;
|
2012-10-18 23:37:14 +00:00
|
|
|
nsWeakPtr mOuter;
|
2011-08-03 04:22:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsLocation_h__
|
|
|
|
|