dom/base/nsLocation.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     7 #ifndef nsLocation_h__
     8 #define nsLocation_h__
    10 #include "nsIDOMLocation.h"
    11 #include "nsString.h"
    12 #include "nsIWeakReferenceUtils.h"
    13 #include "nsWrapperCache.h"
    14 #include "nsCycleCollectionParticipant.h"
    15 #include "js/TypeDecls.h"
    17 class nsIURI;
    18 class nsIDocShell;
    19 class nsIDocShellLoadInfo;
    21 //*****************************************************************************
    22 // nsLocation: Script "location" object
    23 //*****************************************************************************
    25 class nsLocation : public nsIDOMLocation
    26                  , public nsWrapperCache
    27 {
    28 public:
    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();
    38   // nsIDOMLocation
    39   NS_DECL_NSIDOMLOCATION
    41 protected:
    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,
    49                            bool aReplace);
    50   nsresult SetHrefWithContext(JSContext* cx, const nsAString& aHref,
    51                               bool aReplace);
    53   nsresult GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL);
    54   nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo);
    55   bool CallerSubsumes();
    57   nsString mCachedHash;
    58   nsWeakPtr mDocShell;
    59   nsWeakPtr mOuter;
    60 };
    62 #endif // nsLocation_h__

mercurial