1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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 nsDSURIContentListener_h__
8 #define nsDSURIContentListener_h__
11 #include "nsIURIContentListener.h"
12 #include "nsWeakReference.h"
15 class nsIWebNavigationInfo
;
19 class nsDSURIContentListener
:
20 public nsIURIContentListener
,
21 public nsSupportsWeakReference
24 friend class nsDocShell
;
26 NS_DECL_THREADSAFE_ISUPPORTS
27 NS_DECL_NSIURICONTENTLISTENER
32 explicit nsDSURIContentListener(nsDocShell
* aDocShell
);
33 virtual ~nsDSURIContentListener();
35 void DropDocShellreference() {
37 mExistingJPEGRequest
= nullptr;
38 mExistingJPEGStreamListener
= nullptr;
41 // Determine if X-Frame-Options allows content to be framed
43 bool CheckFrameOptions(nsIRequest
* request
);
44 bool CheckOneFrameOptionsPolicy(nsIHttpChannel
* httpChannel
,
45 const nsAString
& policy
);
53 void ReportXFOViolation(nsIDocShellTreeItem
* aTopDocShellItem
,
57 nsDocShell
* mDocShell
;
58 // Hack to handle multipart images without creating a new viewer
59 nsCOMPtr
<nsIStreamListener
> mExistingJPEGStreamListener
;
60 nsCOMPtr
<nsIChannel
> mExistingJPEGRequest
;
62 // Store the parent listener in either of these depending on
63 // if supports weak references or not. Proper weak refs are
64 // preferred and encouraged!
65 nsWeakPtr mWeakParentContentListener
;
66 nsIURIContentListener
* mParentContentListener
;
68 nsCOMPtr
<nsIWebNavigationInfo
> mNavInfo
;
71 #endif /* nsDSURIContentListener_h__ */