|
13 | 13 | #include "nsArrayUtils.h"
|
14 | 14 | #include "nsClipboard.h"
|
15 | 15 | #include "nsReadableUtils.h"
|
| 16 | +#include "nsICookieJarSettings.h" |
16 | 17 | #include "nsITransferable.h"
|
17 | 18 | #include "nsISupportsPrimitives.h"
|
18 | 19 | #include "IEnumFE.h"
|
@@ -70,16 +71,16 @@ nsDataObj::CStream::~CStream() {}
|
70 | 71 | // helper - initializes the stream
|
71 | 72 | nsresult nsDataObj::CStream::Init(nsIURI* pSourceURI,
|
72 | 73 | nsContentPolicyType aContentPolicyType,
|
73 |
| - nsIPrincipal* aRequestingPrincipal) { |
| 74 | + nsIPrincipal* aRequestingPrincipal, |
| 75 | + nsICookieJarSettings* aCookieJarSettings) { |
74 | 76 | // we can not create a channel without a requestingPrincipal
|
75 | 77 | if (!aRequestingPrincipal) {
|
76 | 78 | return NS_ERROR_FAILURE;
|
77 | 79 | }
|
78 | 80 | nsresult rv;
|
79 | 81 | rv = NS_NewChannel(getter_AddRefs(mChannel), pSourceURI, aRequestingPrincipal,
|
80 | 82 | nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_INHERITS_SEC_CONTEXT,
|
81 |
| - aContentPolicyType, |
82 |
| - nullptr, // nsICookieJarSettings |
| 83 | + aContentPolicyType, aCookieJarSettings, |
83 | 84 | nullptr, // PerformanceStorage
|
84 | 85 | nullptr, // loadGroup
|
85 | 86 | nullptr, // aCallbacks
|
@@ -313,8 +314,14 @@ HRESULT nsDataObj::CreateStream(IStream** outStream) {
|
313 | 314 | mTransferable->GetRequestingPrincipal();
|
314 | 315 | MOZ_ASSERT(requestingPrincipal, "can not create channel without a principal");
|
315 | 316 |
|
| 317 | + // Note that the cookieJarSettings could be null if the data object is for the |
| 318 | + // image copy. We will fix this in Bug 1690532. |
| 319 | + nsCOMPtr<nsICookieJarSettings> cookieJarSettings = |
| 320 | + mTransferable->GetCookieJarSettings(); |
| 321 | + |
316 | 322 | nsContentPolicyType contentPolicyType = mTransferable->GetContentPolicyType();
|
317 |
| - rv = pStream->Init(sourceURI, contentPolicyType, requestingPrincipal); |
| 323 | + rv = pStream->Init(sourceURI, contentPolicyType, requestingPrincipal, |
| 324 | + cookieJarSettings); |
318 | 325 | if (NS_FAILED(rv)) {
|
319 | 326 | pStream->Release();
|
320 | 327 | return E_FAIL;
|
|
0 commit comments