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

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

Issue 1953323002: Don't allow scripts to run when a node is being adopted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 7 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } 408 }
409 409
410 void TreeScope::adoptIfNeeded(Node& node) 410 void TreeScope::adoptIfNeeded(Node& node)
411 { 411 {
412 ASSERT(this); 412 ASSERT(this);
413 ASSERT(!node.isDocumentNode()); 413 ASSERT(!node.isDocumentNode());
414 #if !ENABLE(OILPAN) 414 #if !ENABLE(OILPAN)
415 ASSERT_WITH_SECURITY_IMPLICATION(!node.m_deletionHasBegun); 415 ASSERT_WITH_SECURITY_IMPLICATION(!node.m_deletionHasBegun);
416 #endif 416 #endif
417 TreeScopeAdopter adopter(node, *this); 417 TreeScopeAdopter adopter(node, *this);
418 if (adopter.needsScopeChange()) 418 if (adopter.needsScopeChange()) {
419 ScriptForbiddenScope forbidScript;
419 adopter.execute(); 420 adopter.execute();
421 }
420 } 422 }
421 423
422 Element* TreeScope::adjustedFocusedElement() const 424 Element* TreeScope::adjustedFocusedElement() const
423 { 425 {
424 Document& document = rootNode().document(); 426 Document& document = rootNode().document();
425 Element* element = document.focusedElement(); 427 Element* element = document.focusedElement();
426 if (!element && document.page()) 428 if (!element && document.page())
427 element = document.page()->focusController().focusedFrameOwnerElement(*d ocument.frame()); 429 element = document.page()->focusController().focusedFrameOwnerElement(*d ocument.frame());
428 if (!element) 430 if (!element)
429 return 0; 431 return 0;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 visitor->trace(m_parentTreeScope); 576 visitor->trace(m_parentTreeScope);
575 visitor->trace(m_idTargetObserverRegistry); 577 visitor->trace(m_idTargetObserverRegistry);
576 visitor->trace(m_selection); 578 visitor->trace(m_selection);
577 visitor->trace(m_elementsById); 579 visitor->trace(m_elementsById);
578 visitor->trace(m_imageMapsByName); 580 visitor->trace(m_imageMapsByName);
579 visitor->trace(m_labelsByForAttribute); 581 visitor->trace(m_labelsByForAttribute);
580 visitor->trace(m_scopedStyleResolver); 582 visitor->trace(m_scopedStyleResolver);
581 } 583 }
582 584
583 } // namespace blink 585 } // 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