docshell/base/nsDocShellLoadInfo.cpp

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

michael@0 1 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 // Local Includes
michael@0 8 #include "nsDocShellLoadInfo.h"
michael@0 9 #include "nsISHEntry.h"
michael@0 10 #include "nsIInputStream.h"
michael@0 11 #include "nsIURI.h"
michael@0 12 #include "nsIDocShell.h"
michael@0 13
michael@0 14 //*****************************************************************************
michael@0 15 //*** nsDocShellLoadInfo: Object Management
michael@0 16 //*****************************************************************************
michael@0 17
michael@0 18 nsDocShellLoadInfo::nsDocShellLoadInfo()
michael@0 19 : mInheritOwner(false),
michael@0 20 mOwnerIsExplicit(false),
michael@0 21 mSendReferrer(true),
michael@0 22 mLoadType(nsIDocShellLoadInfo::loadNormal),
michael@0 23 mIsSrcdocLoad(false)
michael@0 24 {
michael@0 25 }
michael@0 26
michael@0 27 nsDocShellLoadInfo::~nsDocShellLoadInfo()
michael@0 28 {
michael@0 29 }
michael@0 30
michael@0 31 //*****************************************************************************
michael@0 32 // nsDocShellLoadInfo::nsISupports
michael@0 33 //*****************************************************************************
michael@0 34
michael@0 35 NS_IMPL_ADDREF(nsDocShellLoadInfo)
michael@0 36 NS_IMPL_RELEASE(nsDocShellLoadInfo)
michael@0 37
michael@0 38 NS_INTERFACE_MAP_BEGIN(nsDocShellLoadInfo)
michael@0 39 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocShellLoadInfo)
michael@0 40 NS_INTERFACE_MAP_ENTRY(nsIDocShellLoadInfo)
michael@0 41 NS_INTERFACE_MAP_END
michael@0 42
michael@0 43 //*****************************************************************************
michael@0 44 // nsDocShellLoadInfo::nsIDocShellLoadInfo
michael@0 45 //*****************************************************************************
michael@0 46
michael@0 47 NS_IMETHODIMP nsDocShellLoadInfo::GetReferrer(nsIURI** aReferrer)
michael@0 48 {
michael@0 49 NS_ENSURE_ARG_POINTER(aReferrer);
michael@0 50
michael@0 51 *aReferrer = mReferrer;
michael@0 52 NS_IF_ADDREF(*aReferrer);
michael@0 53 return NS_OK;
michael@0 54 }
michael@0 55
michael@0 56 NS_IMETHODIMP nsDocShellLoadInfo::SetReferrer(nsIURI* aReferrer)
michael@0 57 {
michael@0 58 mReferrer = aReferrer;
michael@0 59 return NS_OK;
michael@0 60 }
michael@0 61
michael@0 62 NS_IMETHODIMP nsDocShellLoadInfo::GetOwner(nsISupports** aOwner)
michael@0 63 {
michael@0 64 NS_ENSURE_ARG_POINTER(aOwner);
michael@0 65
michael@0 66 *aOwner = mOwner;
michael@0 67 NS_IF_ADDREF(*aOwner);
michael@0 68 return NS_OK;
michael@0 69 }
michael@0 70
michael@0 71 NS_IMETHODIMP nsDocShellLoadInfo::SetOwner(nsISupports* aOwner)
michael@0 72 {
michael@0 73 mOwner = aOwner;
michael@0 74 return NS_OK;
michael@0 75 }
michael@0 76
michael@0 77 NS_IMETHODIMP nsDocShellLoadInfo::GetInheritOwner(bool* aInheritOwner)
michael@0 78 {
michael@0 79 NS_ENSURE_ARG_POINTER(aInheritOwner);
michael@0 80
michael@0 81 *aInheritOwner = mInheritOwner;
michael@0 82 return NS_OK;
michael@0 83 }
michael@0 84
michael@0 85 NS_IMETHODIMP nsDocShellLoadInfo::SetInheritOwner(bool aInheritOwner)
michael@0 86 {
michael@0 87 mInheritOwner = aInheritOwner;
michael@0 88 return NS_OK;
michael@0 89 }
michael@0 90
michael@0 91 NS_IMETHODIMP nsDocShellLoadInfo::GetOwnerIsExplicit(bool* aOwnerIsExplicit)
michael@0 92 {
michael@0 93 *aOwnerIsExplicit = mOwnerIsExplicit;
michael@0 94 return NS_OK;
michael@0 95 }
michael@0 96
michael@0 97 NS_IMETHODIMP nsDocShellLoadInfo::SetOwnerIsExplicit(bool aOwnerIsExplicit)
michael@0 98 {
michael@0 99 mOwnerIsExplicit = aOwnerIsExplicit;
michael@0 100 return NS_OK;
michael@0 101 }
michael@0 102
michael@0 103 NS_IMETHODIMP nsDocShellLoadInfo::GetLoadType(nsDocShellInfoLoadType * aLoadType)
michael@0 104 {
michael@0 105 NS_ENSURE_ARG_POINTER(aLoadType);
michael@0 106
michael@0 107 *aLoadType = mLoadType;
michael@0 108 return NS_OK;
michael@0 109 }
michael@0 110
michael@0 111 NS_IMETHODIMP nsDocShellLoadInfo::SetLoadType(nsDocShellInfoLoadType aLoadType)
michael@0 112 {
michael@0 113 mLoadType = aLoadType;
michael@0 114 return NS_OK;
michael@0 115 }
michael@0 116
michael@0 117 NS_IMETHODIMP nsDocShellLoadInfo::GetSHEntry(nsISHEntry** aSHEntry)
michael@0 118 {
michael@0 119 NS_ENSURE_ARG_POINTER(aSHEntry);
michael@0 120
michael@0 121 *aSHEntry = mSHEntry;
michael@0 122 NS_IF_ADDREF(*aSHEntry);
michael@0 123 return NS_OK;
michael@0 124 }
michael@0 125
michael@0 126 NS_IMETHODIMP nsDocShellLoadInfo::SetSHEntry(nsISHEntry* aSHEntry)
michael@0 127 {
michael@0 128 mSHEntry = aSHEntry;
michael@0 129 return NS_OK;
michael@0 130 }
michael@0 131
michael@0 132 NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(char16_t** aTarget)
michael@0 133 {
michael@0 134 NS_ENSURE_ARG_POINTER(aTarget);
michael@0 135
michael@0 136 *aTarget = ToNewUnicode(mTarget);
michael@0 137
michael@0 138 return NS_OK;
michael@0 139 }
michael@0 140
michael@0 141 NS_IMETHODIMP nsDocShellLoadInfo::SetTarget(const char16_t* aTarget)
michael@0 142 {
michael@0 143 mTarget.Assign(aTarget);
michael@0 144 return NS_OK;
michael@0 145 }
michael@0 146
michael@0 147
michael@0 148 NS_IMETHODIMP
michael@0 149 nsDocShellLoadInfo::GetPostDataStream(nsIInputStream **aResult)
michael@0 150 {
michael@0 151 NS_ENSURE_ARG_POINTER(aResult);
michael@0 152
michael@0 153 *aResult = mPostDataStream;
michael@0 154
michael@0 155 NS_IF_ADDREF(*aResult);
michael@0 156 return NS_OK;
michael@0 157 }
michael@0 158
michael@0 159
michael@0 160 NS_IMETHODIMP
michael@0 161 nsDocShellLoadInfo::SetPostDataStream(nsIInputStream *aStream)
michael@0 162 {
michael@0 163 mPostDataStream = aStream;
michael@0 164 return NS_OK;
michael@0 165 }
michael@0 166
michael@0 167 /* attribute nsIInputStream headersStream; */
michael@0 168 NS_IMETHODIMP nsDocShellLoadInfo::GetHeadersStream(nsIInputStream * *aHeadersStream)
michael@0 169 {
michael@0 170 NS_ENSURE_ARG_POINTER(aHeadersStream);
michael@0 171 *aHeadersStream = mHeadersStream;
michael@0 172 NS_IF_ADDREF(*aHeadersStream);
michael@0 173 return NS_OK;
michael@0 174 }
michael@0 175 NS_IMETHODIMP nsDocShellLoadInfo::SetHeadersStream(nsIInputStream * aHeadersStream)
michael@0 176 {
michael@0 177 mHeadersStream = aHeadersStream;
michael@0 178 return NS_OK;
michael@0 179 }
michael@0 180
michael@0 181 NS_IMETHODIMP nsDocShellLoadInfo::GetSendReferrer(bool* aSendReferrer)
michael@0 182 {
michael@0 183 NS_ENSURE_ARG_POINTER(aSendReferrer);
michael@0 184
michael@0 185 *aSendReferrer = mSendReferrer;
michael@0 186 return NS_OK;
michael@0 187 }
michael@0 188
michael@0 189 NS_IMETHODIMP nsDocShellLoadInfo::SetSendReferrer(bool aSendReferrer)
michael@0 190 {
michael@0 191 mSendReferrer = aSendReferrer;
michael@0 192 return NS_OK;
michael@0 193 }
michael@0 194
michael@0 195 NS_IMETHODIMP nsDocShellLoadInfo::GetIsSrcdocLoad(bool* aIsSrcdocLoad)
michael@0 196 {
michael@0 197 *aIsSrcdocLoad = mIsSrcdocLoad;
michael@0 198 return NS_OK;
michael@0 199 }
michael@0 200
michael@0 201 NS_IMETHODIMP nsDocShellLoadInfo::GetSrcdocData(nsAString &aSrcdocData)
michael@0 202 {
michael@0 203 aSrcdocData = mSrcdocData;
michael@0 204 return NS_OK;
michael@0 205 }
michael@0 206
michael@0 207 NS_IMETHODIMP nsDocShellLoadInfo::SetSrcdocData(const nsAString &aSrcdocData)
michael@0 208 {
michael@0 209 mSrcdocData = aSrcdocData;
michael@0 210 mIsSrcdocLoad = true;
michael@0 211 return NS_OK;
michael@0 212 }
michael@0 213
michael@0 214 NS_IMETHODIMP nsDocShellLoadInfo::GetSourceDocShell(nsIDocShell** aSourceDocShell)
michael@0 215 {
michael@0 216 MOZ_ASSERT(aSourceDocShell);
michael@0 217 nsCOMPtr<nsIDocShell> result = mSourceDocShell;
michael@0 218 result.forget(aSourceDocShell);
michael@0 219 return NS_OK;
michael@0 220 }
michael@0 221
michael@0 222 NS_IMETHODIMP nsDocShellLoadInfo::SetSourceDocShell(nsIDocShell* aSourceDocShell)
michael@0 223 {
michael@0 224 mSourceDocShell = aSourceDocShell;
michael@0 225 return NS_OK;
michael@0 226 }
michael@0 227
michael@0 228 NS_IMETHODIMP nsDocShellLoadInfo::GetBaseURI(nsIURI** aBaseURI)
michael@0 229 {
michael@0 230 NS_ENSURE_ARG_POINTER(aBaseURI);
michael@0 231
michael@0 232 *aBaseURI = mBaseURI;
michael@0 233 NS_IF_ADDREF(*aBaseURI);
michael@0 234 return NS_OK;
michael@0 235 }
michael@0 236
michael@0 237 NS_IMETHODIMP nsDocShellLoadInfo::SetBaseURI(nsIURI* aBaseURI)
michael@0 238 {
michael@0 239 mBaseURI = aBaseURI;
michael@0 240 return NS_OK;
michael@0 241 }
michael@0 242
michael@0 243 //*****************************************************************************
michael@0 244 // nsDocShellLoadInfo: Helpers
michael@0 245 //*****************************************************************************
michael@0 246
michael@0 247 //*****************************************************************************
michael@0 248 // nsDocShellLoadInfo: Accessors
michael@0 249 //*****************************************************************************

mercurial