Skip to content

Instantly share code, notes, and snippets.

@jjgod
Created December 18, 2014 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjgod/a8b140c01217ae692658 to your computer and use it in GitHub Desktop.
Save jjgod/a8b140c01217ae692658 to your computer and use it in GitHub Desktop.
Document focused element was set to nullptr on detach, but client
wasn't informed so it still believes that the current focused url
to be the one that no longer exists. It's a bit of a mystery how
this code every worked though.
BUG=425584
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 4427c73..d4a4bac 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -2208,6 +2208,10 @@ void Document::detach(const AttachContext& context)
m_activeHoverElement = nullptr;
m_autofocusElement = nullptr;
+ // Notify client that focused node has changed to empty so that it can clear the current one.
+ if (frameHost())
+ frameHost()->chrome().focusedNodeChanged(nullptr);
+
m_renderView = 0;
ContainerNode::detach(context);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment