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

Side by Side Diff: third_party/WebKit/Source/core/dom/TreeScope.cpp

Issue 1910403003: Don't allow scripts to run when a node is being adopted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | 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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 } 367 }
368 return nullptr; 368 return nullptr;
369 } 369 }
370 370
371 void TreeScope::adoptIfNeeded(Node& node) 371 void TreeScope::adoptIfNeeded(Node& node)
372 { 372 {
373 DCHECK(this); 373 DCHECK(this);
374 DCHECK(!node.isDocumentNode()); 374 DCHECK(!node.isDocumentNode());
375 TreeScopeAdopter adopter(node, *this); 375 TreeScopeAdopter adopter(node, *this);
376 if (adopter.needsScopeChange()) 376 if (adopter.needsScopeChange()) {
377 ScriptForbiddenScope forbidScript;
esprehn 2016/04/25 20:55:22 This should be at the top of the function. ScriptF
377 adopter.execute(); 378 adopter.execute();
379 }
378 } 380 }
379 381
380 Element* TreeScope::retarget(const Element& target) const 382 Element* TreeScope::retarget(const Element& target) const
381 { 383 {
382 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado wHost()) { 384 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado wHost()) {
383 if (this == ancestor->treeScope()) 385 if (this == ancestor->treeScope())
384 return const_cast<Element*>(ancestor); 386 return const_cast<Element*>(ancestor);
385 } 387 }
386 return nullptr; 388 return nullptr;
387 } 389 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 visitor->trace(m_idTargetObserverRegistry); 532 visitor->trace(m_idTargetObserverRegistry);
531 visitor->trace(m_selection); 533 visitor->trace(m_selection);
532 visitor->trace(m_elementsById); 534 visitor->trace(m_elementsById);
533 visitor->trace(m_imageMapsByName); 535 visitor->trace(m_imageMapsByName);
534 visitor->trace(m_labelsByForAttribute); 536 visitor->trace(m_labelsByForAttribute);
535 visitor->trace(m_scopedStyleResolver); 537 visitor->trace(m_scopedStyleResolver);
536 visitor->trace(m_radioButtonGroupScope); 538 visitor->trace(m_radioButtonGroupScope);
537 } 539 }
538 540
539 } // namespace blink 541 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698