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

Unified Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2585353002: Detach Event Listener Properties before moving Node. (Closed)
Patch Set: Revert to doing update inside moveNodeToNewocument(). Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index caf5618827c3424f3f6e8939958d3761287ee1f4..5a58300fb8881e1d3f52588d04f0b564c9939951 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -1808,6 +1808,16 @@ ExecutionContext* Node::getExecutionContext() const {
return document().contextDocument();
}
+void Node::willMoveToNewDocument(Document& oldDocument, Document& newDocument) {
+ if (oldDocument == newDocument)
+ return;
+
+ if (oldDocument.frameHost()) {
+ oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHost(
+ *this);
+ }
+}
+
void Node::didMoveToNewDocument(Document& oldDocument) {
TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(oldDocument);
@@ -1820,14 +1830,10 @@ void Node::didMoveToNewDocument(Document& oldDocument) {
}
oldDocument.markers().removeMarkers(this);
- if (oldDocument.frameHost() && !document().frameHost())
- oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHost(
- *this);
- else if (document().frameHost() && !oldDocument.frameHost())
+ if (document().frameHost()) {
+ DCHECK_NE(document().frameHost(), oldDocument.frameHost());
bokan 2017/01/13 18:35:10 Can we assume this in general? What if you move be
wjmaclean 2017/01/13 20:04:24 Ha ha ... apparently not according to the bots! B
document().frameHost()->eventHandlerRegistry().didMoveIntoFrameHost(*this);
- else if (oldDocument.frameHost() != document().frameHost())
- EventHandlerRegistry::didMoveBetweenFrameHosts(
- *this, oldDocument.frameHost(), document().frameHost());
+ }
if (const HeapVector<TraceWrapperMember<MutationObserverRegistration>>*
registry = mutationObserverRegistry()) {
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698