michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsDSURIContentListener_h__ michael@0: #define nsDSURIContentListener_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIURIContentListener.h" michael@0: #include "nsWeakReference.h" michael@0: michael@0: class nsDocShell; michael@0: class nsIWebNavigationInfo; michael@0: class nsIHttpChannel; michael@0: class nsAString; michael@0: michael@0: class nsDSURIContentListener : michael@0: public nsIURIContentListener, michael@0: public nsSupportsWeakReference michael@0: michael@0: { michael@0: friend class nsDocShell; michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIURICONTENTLISTENER michael@0: michael@0: nsresult Init(); michael@0: michael@0: protected: michael@0: nsDSURIContentListener(nsDocShell* aDocShell); michael@0: virtual ~nsDSURIContentListener(); michael@0: michael@0: void DropDocShellreference() { michael@0: mDocShell = nullptr; michael@0: } michael@0: michael@0: // Determine if X-Frame-Options allows content to be framed michael@0: // as a subdocument michael@0: bool CheckFrameOptions(nsIRequest* request); michael@0: bool CheckOneFrameOptionsPolicy(nsIHttpChannel* httpChannel, michael@0: const nsAString& policy); michael@0: michael@0: enum XFOHeader { michael@0: eDENY, michael@0: eSAMEORIGIN, michael@0: eALLOWFROM michael@0: }; michael@0: michael@0: void ReportXFOViolation(nsIDocShellTreeItem* aTopDocShellItem, michael@0: nsIURI* aThisURI, michael@0: XFOHeader aHeader); michael@0: protected: michael@0: nsDocShell* mDocShell; michael@0: michael@0: // Store the parent listener in either of these depending on michael@0: // if supports weak references or not. Proper weak refs are michael@0: // preferred and encouraged! michael@0: nsWeakPtr mWeakParentContentListener; michael@0: nsIURIContentListener* mParentContentListener; michael@0: michael@0: nsCOMPtr mNavInfo; michael@0: }; michael@0: michael@0: #endif /* nsDSURIContentListener_h__ */