docshell/base/nsDSURIContentListener.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef nsDSURIContentListener_h__
michael@0 8 #define nsDSURIContentListener_h__
michael@0 9
michael@0 10 #include "nsCOMPtr.h"
michael@0 11 #include "nsIURIContentListener.h"
michael@0 12 #include "nsWeakReference.h"
michael@0 13
michael@0 14 class nsDocShell;
michael@0 15 class nsIWebNavigationInfo;
michael@0 16 class nsIHttpChannel;
michael@0 17 class nsAString;
michael@0 18
michael@0 19 class nsDSURIContentListener :
michael@0 20 public nsIURIContentListener,
michael@0 21 public nsSupportsWeakReference
michael@0 22
michael@0 23 {
michael@0 24 friend class nsDocShell;
michael@0 25 public:
michael@0 26 NS_DECL_THREADSAFE_ISUPPORTS
michael@0 27 NS_DECL_NSIURICONTENTLISTENER
michael@0 28
michael@0 29 nsresult Init();
michael@0 30
michael@0 31 protected:
michael@0 32 nsDSURIContentListener(nsDocShell* aDocShell);
michael@0 33 virtual ~nsDSURIContentListener();
michael@0 34
michael@0 35 void DropDocShellreference() {
michael@0 36 mDocShell = nullptr;
michael@0 37 }
michael@0 38
michael@0 39 // Determine if X-Frame-Options allows content to be framed
michael@0 40 // as a subdocument
michael@0 41 bool CheckFrameOptions(nsIRequest* request);
michael@0 42 bool CheckOneFrameOptionsPolicy(nsIHttpChannel* httpChannel,
michael@0 43 const nsAString& policy);
michael@0 44
michael@0 45 enum XFOHeader {
michael@0 46 eDENY,
michael@0 47 eSAMEORIGIN,
michael@0 48 eALLOWFROM
michael@0 49 };
michael@0 50
michael@0 51 void ReportXFOViolation(nsIDocShellTreeItem* aTopDocShellItem,
michael@0 52 nsIURI* aThisURI,
michael@0 53 XFOHeader aHeader);
michael@0 54 protected:
michael@0 55 nsDocShell* mDocShell;
michael@0 56
michael@0 57 // Store the parent listener in either of these depending on
michael@0 58 // if supports weak references or not. Proper weak refs are
michael@0 59 // preferred and encouraged!
michael@0 60 nsWeakPtr mWeakParentContentListener;
michael@0 61 nsIURIContentListener* mParentContentListener;
michael@0 62
michael@0 63 nsCOMPtr<nsIWebNavigationInfo> mNavInfo;
michael@0 64 };
michael@0 65
michael@0 66 #endif /* nsDSURIContentListener_h__ */

mercurial