Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: third_party/WebKit/Source/core/dom/MutationObserver.h

Issue 2532003002: MutationObserver: Fix a null-pointer dereference in MutationObserverRegistration::unregister. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef MutationObserver_h 31 #ifndef MutationObserver_h
32 #define MutationObserver_h 32 #define MutationObserver_h
33 33
34 #include "base/gtest_prod_util.h"
34 #include "bindings/core/v8/ScriptWrappable.h" 35 #include "bindings/core/v8/ScriptWrappable.h"
36 #include "core/CoreExport.h"
35 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
36 #include "wtf/HashSet.h" 38 #include "wtf/HashSet.h"
37 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
38 40
39 namespace blink { 41 namespace blink {
40 42
41 class ExceptionState; 43 class ExceptionState;
42 class MutationCallback; 44 class MutationCallback;
43 class MutationObserver; 45 class MutationObserver;
44 class MutationObserverInit; 46 class MutationObserverInit;
45 class MutationObserverRegistration; 47 class MutationObserverRegistration;
46 class MutationRecord; 48 class MutationRecord;
47 class Node; 49 class Node;
48 50
49 typedef unsigned char MutationObserverOptions; 51 typedef unsigned char MutationObserverOptions;
50 typedef unsigned char MutationRecordDeliveryOptions; 52 typedef unsigned char MutationRecordDeliveryOptions;
51 53
52 using MutationObserverSet = HeapHashSet<Member<MutationObserver>>; 54 using MutationObserverSet = HeapHashSet<Member<MutationObserver>>;
53 using MutationObserverRegistrationSet = 55 using MutationObserverRegistrationSet =
54 HeapHashSet<WeakMember<MutationObserverRegistration>>; 56 HeapHashSet<WeakMember<MutationObserverRegistration>>;
55 using MutationObserverVector = HeapVector<Member<MutationObserver>>; 57 using MutationObserverVector = HeapVector<Member<MutationObserver>>;
56 using MutationRecordVector = HeapVector<Member<MutationRecord>>; 58 using MutationRecordVector = HeapVector<Member<MutationRecord>>;
57 59
58 class MutationObserver final 60 class CORE_EXPORT MutationObserver final
59 : public GarbageCollectedFinalized<MutationObserver>, 61 : public GarbageCollectedFinalized<MutationObserver>,
60 public ScriptWrappable { 62 public ScriptWrappable {
61 DEFINE_WRAPPERTYPEINFO(); 63 DEFINE_WRAPPERTYPEINFO();
62 64
63 public: 65 public:
64 enum MutationType { 66 enum MutationType {
65 ChildList = 1 << 0, 67 ChildList = 1 << 0,
66 Attributes = 1 << 1, 68 Attributes = 1 << 1,
67 CharacterData = 1 << 2, 69 CharacterData = 1 << 2,
68 70
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 103
102 explicit MutationObserver(MutationCallback*); 104 explicit MutationObserver(MutationCallback*);
103 void deliver(); 105 void deliver();
104 bool shouldBeSuspended() const; 106 bool shouldBeSuspended() const;
105 void cancelInspectorAsyncTasks(); 107 void cancelInspectorAsyncTasks();
106 108
107 Member<MutationCallback> m_callback; 109 Member<MutationCallback> m_callback;
108 MutationRecordVector m_records; 110 MutationRecordVector m_records;
109 MutationObserverRegistrationSet m_registrations; 111 MutationObserverRegistrationSet m_registrations;
110 unsigned m_priority; 112 unsigned m_priority;
113
114 FRIEND_TEST_ALL_PREFIXES(MutationObserverTest, DisconnectCrash);
111 }; 115 };
112 116
113 } // namespace blink 117 } // namespace blink
114 118
115 #endif // MutationObserver_h 119 #endif // MutationObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698