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.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef ChangeAttributeTxn_h__
7 #define ChangeAttributeTxn_h__
9 #include "EditTxn.h"
10 #include "nsCOMPtr.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsIDOMElement.h"
13 #include "nsISupportsImpl.h"
14 #include "nsString.h"
15 #include "nscore.h"
17 class nsIEditor;
19 /**
20 * A transaction that changes an attribute of a content node.
21 * This transaction covers add, remove, and change attribute.
22 */
23 class ChangeAttributeTxn : public EditTxn
24 {
25 public:
26 /** Initialize the transaction.
27 * @param aEditor the object providing core editing operations
28 * @param aNode the node whose attribute will be changed
29 * @param aAttribute the name of the attribute to change
30 * @param aValue the new value for aAttribute, if aRemoveAttribute is false
31 * @param aRemoveAttribute if true, remove aAttribute from aNode
32 */
33 NS_IMETHOD Init(nsIEditor *aEditor,
34 nsIDOMElement *aNode,
35 const nsAString& aAttribute,
36 const nsAString& aValue,
37 bool aRemoveAttribute);
39 ChangeAttributeTxn();
41 NS_DECL_ISUPPORTS_INHERITED
42 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ChangeAttributeTxn, EditTxn)
44 NS_DECL_EDITTXN
46 NS_IMETHOD RedoTransaction();
48 protected:
50 /** the editor that created this transaction */
51 nsIEditor* mEditor;
53 /** the element to operate upon */
54 nsCOMPtr<nsIDOMElement> mElement;
56 /** the attribute to change */
57 nsString mAttribute;
59 /** the value to set the attribute to (ignored if mRemoveAttribute==true) */
60 nsString mValue;
62 /** the value to set the attribute to for undo */
63 nsString mUndoValue;
65 /** true if the mAttribute was set on mElement at the time of execution */
66 bool mAttributeWasSet;
68 /** true if the operation is to remove mAttribute from mElement */
69 bool mRemoveAttribute;
70 };
72 #endif