Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsXBLContentSink_h__ |
michael@0 | 7 | #define nsXBLContentSink_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/Attributes.h" |
michael@0 | 10 | #include "nsXMLContentSink.h" |
michael@0 | 11 | #include "nsXBLDocumentInfo.h" |
michael@0 | 12 | #include "nsXBLPrototypeHandler.h" |
michael@0 | 13 | #include "nsXBLProtoImpl.h" |
michael@0 | 14 | #include "nsLayoutCID.h" |
michael@0 | 15 | |
michael@0 | 16 | /* |
michael@0 | 17 | * Enum that describes the primary state of the parsing process |
michael@0 | 18 | */ |
michael@0 | 19 | typedef enum { |
michael@0 | 20 | eXBL_InDocument, /* outside any bindings */ |
michael@0 | 21 | eXBL_InBindings, /* Inside a <bindings> element */ |
michael@0 | 22 | eXBL_InBinding, /* Inside a <binding> */ |
michael@0 | 23 | eXBL_InResources, /* Inside a <resources> */ |
michael@0 | 24 | eXBL_InImplementation, /* Inside a <implementation> */ |
michael@0 | 25 | eXBL_InHandlers, /* Inside a <handlers> */ |
michael@0 | 26 | eXBL_Error /* An error has occurred. Suspend binding construction */ |
michael@0 | 27 | } XBLPrimaryState; |
michael@0 | 28 | |
michael@0 | 29 | /* |
michael@0 | 30 | * Enum that describes our substate (typically when parsing something |
michael@0 | 31 | * like <handlers> or <implementation>). |
michael@0 | 32 | */ |
michael@0 | 33 | typedef enum { |
michael@0 | 34 | eXBL_None, |
michael@0 | 35 | eXBL_InHandler, |
michael@0 | 36 | eXBL_InMethod, |
michael@0 | 37 | eXBL_InProperty, |
michael@0 | 38 | eXBL_InField, |
michael@0 | 39 | eXBL_InBody, |
michael@0 | 40 | eXBL_InGetter, |
michael@0 | 41 | eXBL_InSetter, |
michael@0 | 42 | eXBL_InConstructor, |
michael@0 | 43 | eXBL_InDestructor |
michael@0 | 44 | } XBLSecondaryState; |
michael@0 | 45 | |
michael@0 | 46 | class nsXULPrototypeElement; |
michael@0 | 47 | class nsXBLProtoImplMember; |
michael@0 | 48 | class nsXBLProtoImplProperty; |
michael@0 | 49 | class nsXBLProtoImplMethod; |
michael@0 | 50 | class nsXBLProtoImplField; |
michael@0 | 51 | class nsXBLPrototypeBinding; |
michael@0 | 52 | |
michael@0 | 53 | // The XBL content sink overrides the XML content sink to |
michael@0 | 54 | // builds its own lightweight data structures for the <resources>, |
michael@0 | 55 | // <handlers>, <implementation>, and |
michael@0 | 56 | |
michael@0 | 57 | class nsXBLContentSink : public nsXMLContentSink { |
michael@0 | 58 | public: |
michael@0 | 59 | nsXBLContentSink(); |
michael@0 | 60 | ~nsXBLContentSink(); |
michael@0 | 61 | |
michael@0 | 62 | NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW |
michael@0 | 63 | |
michael@0 | 64 | nsresult Init(nsIDocument* aDoc, |
michael@0 | 65 | nsIURI* aURL, |
michael@0 | 66 | nsISupports* aContainer); |
michael@0 | 67 | |
michael@0 | 68 | // nsIContentSink overrides |
michael@0 | 69 | NS_IMETHOD HandleStartElement(const char16_t *aName, |
michael@0 | 70 | const char16_t **aAtts, |
michael@0 | 71 | uint32_t aAttsCount, |
michael@0 | 72 | int32_t aIndex, |
michael@0 | 73 | uint32_t aLineNumber) MOZ_OVERRIDE; |
michael@0 | 74 | |
michael@0 | 75 | NS_IMETHOD HandleEndElement(const char16_t *aName) MOZ_OVERRIDE; |
michael@0 | 76 | |
michael@0 | 77 | NS_IMETHOD HandleCDataSection(const char16_t *aData, |
michael@0 | 78 | uint32_t aLength) MOZ_OVERRIDE; |
michael@0 | 79 | |
michael@0 | 80 | protected: |
michael@0 | 81 | // nsXMLContentSink overrides |
michael@0 | 82 | virtual void MaybeStartLayout(bool aIgnorePendingSheets) MOZ_OVERRIDE; |
michael@0 | 83 | |
michael@0 | 84 | bool OnOpenContainer(const char16_t **aAtts, |
michael@0 | 85 | uint32_t aAttsCount, |
michael@0 | 86 | int32_t aNameSpaceID, |
michael@0 | 87 | nsIAtom* aTagName, |
michael@0 | 88 | uint32_t aLineNumber) MOZ_OVERRIDE; |
michael@0 | 89 | |
michael@0 | 90 | bool NotifyForDocElement() MOZ_OVERRIDE { return false; } |
michael@0 | 91 | |
michael@0 | 92 | nsresult CreateElement(const char16_t** aAtts, uint32_t aAttsCount, |
michael@0 | 93 | nsINodeInfo* aNodeInfo, uint32_t aLineNumber, |
michael@0 | 94 | nsIContent** aResult, bool* aAppendContent, |
michael@0 | 95 | mozilla::dom::FromParser aFromParser) MOZ_OVERRIDE; |
michael@0 | 96 | |
michael@0 | 97 | nsresult AddAttributes(const char16_t** aAtts, |
michael@0 | 98 | nsIContent* aContent) MOZ_OVERRIDE; |
michael@0 | 99 | |
michael@0 | 100 | #ifdef MOZ_XUL |
michael@0 | 101 | nsresult AddAttributesToXULPrototype(const char16_t **aAtts, |
michael@0 | 102 | uint32_t aAttsCount, |
michael@0 | 103 | nsXULPrototypeElement* aElement); |
michael@0 | 104 | #endif |
michael@0 | 105 | |
michael@0 | 106 | // Our own helpers for constructing XBL prototype objects. |
michael@0 | 107 | nsresult ConstructBinding(uint32_t aLineNumber); |
michael@0 | 108 | void ConstructHandler(const char16_t **aAtts, uint32_t aLineNumber); |
michael@0 | 109 | void ConstructResource(const char16_t **aAtts, nsIAtom* aResourceType); |
michael@0 | 110 | void ConstructImplementation(const char16_t **aAtts); |
michael@0 | 111 | void ConstructProperty(const char16_t **aAtts, uint32_t aLineNumber); |
michael@0 | 112 | void ConstructMethod(const char16_t **aAtts); |
michael@0 | 113 | void ConstructParameter(const char16_t **aAtts); |
michael@0 | 114 | void ConstructField(const char16_t **aAtts, uint32_t aLineNumber); |
michael@0 | 115 | |
michael@0 | 116 | |
michael@0 | 117 | // nsXMLContentSink overrides |
michael@0 | 118 | nsresult FlushText(bool aReleaseTextNode = true) MOZ_OVERRIDE; |
michael@0 | 119 | |
michael@0 | 120 | // nsIExpatSink overrides |
michael@0 | 121 | NS_IMETHOD ReportError(const char16_t* aErrorText, |
michael@0 | 122 | const char16_t* aSourceText, |
michael@0 | 123 | nsIScriptError *aError, |
michael@0 | 124 | bool *_retval) MOZ_OVERRIDE; |
michael@0 | 125 | |
michael@0 | 126 | protected: |
michael@0 | 127 | nsresult ReportUnexpectedElement(nsIAtom* aElementName, uint32_t aLineNumber); |
michael@0 | 128 | |
michael@0 | 129 | void AddMember(nsXBLProtoImplMember* aMember); |
michael@0 | 130 | void AddField(nsXBLProtoImplField* aField); |
michael@0 | 131 | |
michael@0 | 132 | XBLPrimaryState mState; |
michael@0 | 133 | XBLSecondaryState mSecondaryState; |
michael@0 | 134 | nsXBLDocumentInfo* mDocInfo; |
michael@0 | 135 | bool mIsChromeOrResource; // For bug #45989 |
michael@0 | 136 | bool mFoundFirstBinding; |
michael@0 | 137 | |
michael@0 | 138 | nsString mCurrentBindingID; |
michael@0 | 139 | |
michael@0 | 140 | nsXBLPrototypeBinding* mBinding; |
michael@0 | 141 | nsXBLPrototypeHandler* mHandler; // current handler, owned by its PrototypeBinding |
michael@0 | 142 | nsXBLProtoImpl* mImplementation; |
michael@0 | 143 | nsXBLProtoImplMember* mImplMember; |
michael@0 | 144 | nsXBLProtoImplField* mImplField; |
michael@0 | 145 | nsXBLProtoImplProperty* mProperty; |
michael@0 | 146 | nsXBLProtoImplMethod* mMethod; |
michael@0 | 147 | nsXBLProtoImplField* mField; |
michael@0 | 148 | }; |
michael@0 | 149 | |
michael@0 | 150 | nsresult |
michael@0 | 151 | NS_NewXBLContentSink(nsIXMLContentSink** aResult, |
michael@0 | 152 | nsIDocument* aDoc, |
michael@0 | 153 | nsIURI* aURL, |
michael@0 | 154 | nsISupports* aContainer); |
michael@0 | 155 | #endif // nsXBLContentSink_h__ |