2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsDSURIContentListener_h__
|
|
|
|
#define nsDSURIContentListener_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIURIContentListener.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
|
|
|
|
class nsDocShell;
|
|
|
|
class nsIWebNavigationInfo;
|
2013-04-22 16:01:39 -07:00
|
|
|
class nsIHttpChannel;
|
2013-09-03 13:17:26 -07:00
|
|
|
class nsAString;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsDSURIContentListener :
|
|
|
|
public nsIURIContentListener,
|
|
|
|
public nsSupportsWeakReference
|
|
|
|
|
|
|
|
{
|
|
|
|
friend class nsDocShell;
|
|
|
|
public:
|
2013-07-18 19:21:19 -07:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_NSIURICONTENTLISTENER
|
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
|
|
|
|
protected:
|
2014-08-05 06:19:03 -07:00
|
|
|
explicit nsDSURIContentListener(nsDocShell* aDocShell);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual ~nsDSURIContentListener();
|
|
|
|
|
|
|
|
void DropDocShellreference() {
|
2012-07-30 07:20:58 -07:00
|
|
|
mDocShell = nullptr;
|
2014-07-29 15:23:22 -07:00
|
|
|
mExistingJPEGRequest = nullptr;
|
|
|
|
mExistingJPEGStreamListener = nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-10-14 15:26:59 -07:00
|
|
|
// Determine if X-Frame-Options allows content to be framed
|
|
|
|
// as a subdocument
|
|
|
|
bool CheckFrameOptions(nsIRequest* request);
|
2013-04-22 16:01:39 -07:00
|
|
|
bool CheckOneFrameOptionsPolicy(nsIHttpChannel* httpChannel,
|
2012-06-11 09:17:35 -07:00
|
|
|
const nsAString& policy);
|
2010-10-14 15:26:59 -07:00
|
|
|
|
2012-09-20 19:47:18 -07:00
|
|
|
enum XFOHeader {
|
|
|
|
eDENY,
|
|
|
|
eSAMEORIGIN,
|
|
|
|
eALLOWFROM
|
|
|
|
};
|
|
|
|
|
|
|
|
void ReportXFOViolation(nsIDocShellTreeItem* aTopDocShellItem,
|
|
|
|
nsIURI* aThisURI,
|
|
|
|
XFOHeader aHeader);
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
nsDocShell* mDocShell;
|
2014-07-29 15:23:22 -07:00
|
|
|
// Hack to handle multipart images without creating a new viewer
|
|
|
|
nsCOMPtr<nsIStreamListener> mExistingJPEGStreamListener;
|
|
|
|
nsCOMPtr<nsIChannel> mExistingJPEGRequest;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Store the parent listener in either of these depending on
|
|
|
|
// if supports weak references or not. Proper weak refs are
|
|
|
|
// preferred and encouraged!
|
|
|
|
nsWeakPtr mWeakParentContentListener;
|
|
|
|
nsIURIContentListener* mParentContentListener;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIWebNavigationInfo> mNavInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsDSURIContentListener_h__ */
|