Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
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
23 {
24 friend class nsDocShell;
25 public:
26 NS_DECL_THREADSAFE_ISUPPORTS
27 NS_DECL_NSIURICONTENTLISTENER
29 nsresult Init();
31 protected:
32 nsDSURIContentListener(nsDocShell* aDocShell);
33 virtual ~nsDSURIContentListener();
35 void DropDocShellreference() {
36 mDocShell = nullptr;
37 }
39 // Determine if X-Frame-Options allows content to be framed
40 // as a subdocument
41 bool CheckFrameOptions(nsIRequest* request);
42 bool CheckOneFrameOptionsPolicy(nsIHttpChannel* httpChannel,
43 const nsAString& policy);
45 enum XFOHeader {
46 eDENY,
47 eSAMEORIGIN,
48 eALLOWFROM
49 };
51 void ReportXFOViolation(nsIDocShellTreeItem* aTopDocShellItem,
52 nsIURI* aThisURI,
53 XFOHeader aHeader);
54 protected:
55 nsDocShell* mDocShell;
57 // Store the parent listener in either of these depending on
58 // if supports weak references or not. Proper weak refs are
59 // preferred and encouraged!
60 nsWeakPtr mWeakParentContentListener;
61 nsIURIContentListener* mParentContentListener;
63 nsCOMPtr<nsIWebNavigationInfo> mNavInfo;
64 };
66 #endif /* nsDSURIContentListener_h__ */