1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 sw=2 et tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
10 #include "nsIDOMLocation.h"
12 #include "nsIWeakReferenceUtils.h"
13 #include "nsWrapperCache.h"
14 #include "nsCycleCollectionParticipant.h"
15 #include "js/TypeDecls.h"
19 class nsIDocShellLoadInfo
;
21 //*****************************************************************************
22 // nsLocation: Script "location" object
23 //*****************************************************************************
25 class nsLocation
: public nsIDOMLocation
26 , public nsWrapperCache
29 nsLocation(nsIDocShell
*aDocShell
);
30 virtual ~nsLocation();
32 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
33 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsLocation
)
35 void SetDocShell(nsIDocShell
*aDocShell
);
36 nsIDocShell
*GetDocShell();
39 NS_DECL_NSIDOMLOCATION
42 // In the case of jar: uris, we sometimes want the place the jar was
43 // fetched from as the URI instead of the jar: uri itself. Pass in
44 // true for aGetInnermostURI when that's the case.
45 nsresult
GetURI(nsIURI
** aURL
, bool aGetInnermostURI
= false);
46 nsresult
GetWritableURI(nsIURI
** aURL
);
47 nsresult
SetURI(nsIURI
* aURL
, bool aReplace
= false);
48 nsresult
SetHrefWithBase(const nsAString
& aHref
, nsIURI
* aBase
,
50 nsresult
SetHrefWithContext(JSContext
* cx
, const nsAString
& aHref
,
53 nsresult
GetSourceBaseURL(JSContext
* cx
, nsIURI
** sourceURL
);
54 nsresult
CheckURL(nsIURI
*url
, nsIDocShellLoadInfo
** aLoadInfo
);
55 bool CallerSubsumes();
62 #endif // nsLocation_h__