Bumping manifests a=b2g-bump
[gecko.git] / docshell / base / nsDSURIContentListener.h
blobf8c6a699478164d249113e77320170d51da4d199
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__
10 #include "nsCOMPtr.h"
11 #include "nsIURIContentListener.h"
12 #include "nsWeakReference.h"
14 class nsDocShell;
15 class nsIWebNavigationInfo;
16 class nsIHttpChannel;
17 class nsAString;
19 class nsDSURIContentListener :
20 public nsIURIContentListener,
21 public nsSupportsWeakReference
24 friend class nsDocShell;
25 public:
26 NS_DECL_THREADSAFE_ISUPPORTS
27 NS_DECL_NSIURICONTENTLISTENER
29 nsresult Init();
31 protected:
32 explicit nsDSURIContentListener(nsDocShell* aDocShell);
33 virtual ~nsDSURIContentListener();
35 void DropDocShellreference() {
36 mDocShell = nullptr;
37 mExistingJPEGRequest = nullptr;
38 mExistingJPEGStreamListener = nullptr;
41 // Determine if X-Frame-Options allows content to be framed
42 // as a subdocument
43 bool CheckFrameOptions(nsIRequest* request);
44 bool CheckOneFrameOptionsPolicy(nsIHttpChannel* httpChannel,
45 const nsAString& policy);
47 enum XFOHeader {
48 eDENY,
49 eSAMEORIGIN,
50 eALLOWFROM
53 void ReportXFOViolation(nsIDocShellTreeItem* aTopDocShellItem,
54 nsIURI* aThisURI,
55 XFOHeader aHeader);
56 protected:
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__ */