mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 09:54:42 +00:00
Bug 1870582 - added mChannelId attribute to nsFileChannel. r=valentin,necko-reviewers,profiler-reviewers,canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D196137
This commit is contained in:
parent
ac412e192f
commit
81fac6ce12
@ -21,6 +21,7 @@
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "../protocol/http/nsHttpHandler.h"
|
||||
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsIURIMutator.h"
|
||||
@ -240,6 +241,9 @@ nsFileChannel::nsFileChannel(nsIURI* uri) : mUploadLength(0), mFileURI(uri) {}
|
||||
nsresult nsFileChannel::Init() {
|
||||
NS_ENSURE_STATE(mLoadInfo);
|
||||
|
||||
RefPtr<nsHttpHandler> handler = nsHttpHandler::GetInstance();
|
||||
MOZ_ALWAYS_SUCCEEDS(handler->NewChannelId(mChannelId));
|
||||
|
||||
// If we have a link file, we should resolve its target right away.
|
||||
// This is to protect against a same origin attack where the same link file
|
||||
// can point to different resources right after the first resource is loaded.
|
||||
@ -471,7 +475,7 @@ nsresult nsFileChannel::FixupContentLength(bool async) {
|
||||
// nsFileChannel::nsISupports
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsFileChannel, nsBaseChannel, nsIUploadChannel,
|
||||
nsIFileChannel)
|
||||
nsIFileChannel, nsIIdentChannel)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsFileChannel::nsIFileChannel
|
||||
@ -511,7 +515,7 @@ nsresult nsFileChannel::MaybeSendFileOpenNotification() {
|
||||
|
||||
if ((browsingContextID != 0 && isTopLevel) ||
|
||||
!loadInfo->TriggeringPrincipal()->IsSystemPrincipal()) {
|
||||
obsService->NotifyObservers(static_cast<nsIChannel*>(this),
|
||||
obsService->NotifyObservers(static_cast<nsIIdentChannel*>(this),
|
||||
"file-channel-opened", nullptr);
|
||||
}
|
||||
return NS_OK;
|
||||
@ -548,3 +552,18 @@ nsFileChannel::GetUploadStream(nsIInputStream** result) {
|
||||
*result = do_AddRef(mUploadStream).take();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsFileChannel::nsIIdentChannel
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::GetChannelId(uint64_t* aChannelId) {
|
||||
*aChannelId = mChannelId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::SetChannelId(uint64_t aChannelId) {
|
||||
mChannelId = aChannelId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -13,11 +13,15 @@
|
||||
|
||||
class nsFileChannel : public nsBaseChannel,
|
||||
public nsIFileChannel,
|
||||
public nsIUploadChannel {
|
||||
public nsIUploadChannel,
|
||||
public nsIIdentChannel {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIFILECHANNEL
|
||||
NS_DECL_NSIUPLOADCHANNEL
|
||||
NS_FORWARD_NSIREQUEST(nsBaseChannel::)
|
||||
NS_FORWARD_NSICHANNEL(nsBaseChannel::)
|
||||
NS_DECL_NSIIDENTCHANNEL
|
||||
|
||||
explicit nsFileChannel(nsIURI* uri);
|
||||
|
||||
@ -49,6 +53,7 @@ class nsFileChannel : public nsBaseChannel,
|
||||
nsCOMPtr<nsIInputStream> mUploadStream;
|
||||
int64_t mUploadLength;
|
||||
nsCOMPtr<nsIURI> mFileURI;
|
||||
uint64_t mChannelId = 0;
|
||||
};
|
||||
|
||||
#endif // !nsFileChannel_h__
|
||||
|
@ -190,7 +190,7 @@ nsFileProtocolHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
return rv;
|
||||
}
|
||||
|
||||
chan.forget(result);
|
||||
*result = chan.forget().downcast<nsBaseChannel>().take();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,7 @@ skip-if = [
|
||||
]
|
||||
|
||||
["test_pause.js"]
|
||||
skip-if = ["tsan && socketprocess_networking"] # Times out on TSan and socket process, bug 1878882
|
||||
|
||||
["test_responsiveness.js"]
|
||||
skip-if = ["tsan"] # Times out on TSan, bug 1612707
|
||||
|
Loading…
Reference in New Issue
Block a user