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

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

Issue 1283263002: parserInsertBefore: Bail out if the parent no longer contains the child. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed the failing test Created 5 years, 4 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
« no previous file with comments | « LayoutTests/fast/parser/scriptexec-during-parserInsertBefore-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, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return; 307 return;
308 308
309 RefPtrWillBeRawPtr<Node> protect(this); 309 RefPtrWillBeRawPtr<Node> protect(this);
310 310
311 // FIXME: parserRemoveChild can run script which could then insert the 311 // FIXME: parserRemoveChild can run script which could then insert the
312 // newChild back into the page. Loop until the child is actually removed. 312 // newChild back into the page. Loop until the child is actually removed.
313 // See: fast/parser/execute-script-during-adoption-agency-removal.html 313 // See: fast/parser/execute-script-during-adoption-agency-removal.html
314 while (RefPtrWillBeRawPtr<ContainerNode> parent = newChild->parentNode()) 314 while (RefPtrWillBeRawPtr<ContainerNode> parent = newChild->parentNode())
315 parent->parserRemoveChild(*newChild); 315 parent->parserRemoveChild(*newChild);
316 316
317 if (nextChild.parentNode() != this)
318 return;
319
317 if (document() != newChild->document()) 320 if (document() != newChild->document())
318 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); 321 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
319 322
320 { 323 {
321 EventDispatchForbiddenScope assertNoEventDispatch; 324 EventDispatchForbiddenScope assertNoEventDispatch;
322 ScriptForbiddenScope forbidScript; 325 ScriptForbiddenScope forbidScript;
323 326
324 treeScope().adoptIfNeeded(*newChild); 327 treeScope().adoptIfNeeded(*newChild);
325 insertBeforeCommon(nextChild, *newChild); 328 insertBeforeCommon(nextChild, *newChild);
326 newChild->updateAncestorConnectedSubframeCountForInsertion(); 329 newChild->updateAncestorConnectedSubframeCountForInsertion();
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 return true; 1517 return true;
1515 1518
1516 if (node->isElementNode() && toElement(node)->shadow()) 1519 if (node->isElementNode() && toElement(node)->shadow())
1517 return true; 1520 return true;
1518 1521
1519 return false; 1522 return false;
1520 } 1523 }
1521 #endif 1524 #endif
1522 1525
1523 } // namespace blink 1526 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/parser/scriptexec-during-parserInsertBefore-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698