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

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

Issue 2585353002: Detach Event Listener Properties before moving Node. (Closed)
Patch Set: Use oldDocument instead of node's document() when deregistering event handlers. 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
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 54d7625aef662cc8155465ebfbcaacf9ae8a9e59..47e935a60aef5740bc24c29df23bd60e4d851cae 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -1808,6 +1808,13 @@ ExecutionContext* Node::getExecutionContext() const {
return document().contextDocument();
}
+void Node::willMoveToNewDocument(Document& oldDocument) {
+ if (oldDocument.frameHost()) {
+ oldDocument.frameHost()->eventHandlerRegistry().didMoveOutOfFrameHost(
+ *this);
+ }
+}
+
void Node::didMoveToNewDocument(Document& oldDocument) {
TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(oldDocument);
@@ -1820,14 +1827,8 @@ 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())
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()) {

Powered by Google App Engine
This is Rietveld 408576698