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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 19303002: Fix crash due to unexpected Node deletion during MutationObserver registration book-keeping (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/MutationObserver/disconnect-transient-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserverRe gistry(); 2271 Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserverRe gistry();
2272 ASSERT(registry); 2272 ASSERT(registry);
2273 if (!registry) 2273 if (!registry)
2274 return; 2274 return;
2275 2275
2276 size_t index = registry->find(registration); 2276 size_t index = registry->find(registration);
2277 ASSERT(index != notFound); 2277 ASSERT(index != notFound);
2278 if (index == notFound) 2278 if (index == notFound)
2279 return; 2279 return;
2280 2280
2281 // Deleting the registration may cause this node to be derefed, so we must m ake sure the Vector operation completes
2282 // before that, in case |this| is destroyed (see MutationObserverRegistratio n::m_registrationNodeKeepAlive).
2283 // FIXME: Simplify the registration/transient registration logic to make thi s understandable by humans.
2284 RefPtr<Node> protect(this);
2281 registry->remove(index); 2285 registry->remove(index);
2282 } 2286 }
2283 2287
2284 void Node::registerTransientMutationObserver(MutationObserverRegistration* regis tration) 2288 void Node::registerTransientMutationObserver(MutationObserverRegistration* regis tration)
2285 { 2289 {
2286 ensureRareData()->ensureMutationObserverData()->transientRegistry.add(regist ration); 2290 ensureRareData()->ensureMutationObserverData()->transientRegistry.add(regist ration);
2287 } 2291 }
2288 2292
2289 void Node::unregisterTransientMutationObserver(MutationObserverRegistration* reg istration) 2293 void Node::unregisterTransientMutationObserver(MutationObserverRegistration* reg istration)
2290 { 2294 {
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 node->showTreeForThis(); 2726 node->showTreeForThis();
2723 } 2727 }
2724 2728
2725 void showNodePath(const WebCore::Node* node) 2729 void showNodePath(const WebCore::Node* node)
2726 { 2730 {
2727 if (node) 2731 if (node)
2728 node->showNodePathForThis(); 2732 node->showNodePathForThis();
2729 } 2733 }
2730 2734
2731 #endif 2735 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/MutationObserver/disconnect-transient-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698