Bug 96084
Summary: | There is no need to call "Document::removeFocusedNodeOfSubtree()" after calling "Document::prepareForDestruction() | ||
---|---|---|---|
Product: | WebKit | Reporter: | luowenping <261000975> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | UNCONFIRMED | ||
Severity: | Normal | CC: | abarth, ahmad.saleem792, ap, bfulgham, cdumez, elfylin, eric, rniwa |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All | ||
URL: | http%3A%2F%2F |
luowenping
i'm fused by function" FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, bool clearFrameView)", in this method
we have code like this:
if (!m_frame->document()->inPageCache()) {
m_frame->document()->cancelParsing();
m_frame->document()->stopActiveDOMObjects();
if (m_frame->document()->attached()) {
m_frame->document()->prepareForDestruction();
m_frame->document()->removeFocusedNodeOfSubtree(m_frame->document());
}
}
step 1:"Document::prepareForDestruction()" will call "Document::detach()", in detach() method, we will make m_focusedNode = 0;
void Document::prepareForDestruction()
{
disconnectDescendantFrames();
if (DOMWindow* window = this->domWindow())
window->willDetachDocumentFromFrame();
detach();
}
step2:"Document::removeFocusedNodeOfSubtree(Node* node, bool amongChildrenOnly)" will return first when m_focusedNode = 0;
void Document::removeFocusedNodeOfSubtree(Node* node, bool amongChildrenOnly)
{
if (!m_focusedNode || this->inPageCache()) // If the document is in the page cache, then we don't need to clear out the focused node.
return;
bool nodeInSubtree = false;
if (amongChildrenOnly)
nodeInSubtree = m_focusedNode->isDescendantOf(node);
else
nodeInSubtree = (m_focusedNode == node) || m_focusedNode->isDescendantOf(node);
if (nodeInSubtree)
document()->focusedNodeRemoved();
}
step3: this means we has no deed to call "Document::removeFocusedNodeOfSubtree()" after call "Document::prepareForDestruction()"
may be , m_focusedNode will be set value in Document::detach().but This is real we want ?
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
linyufei
I am also confused with this issue:
void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, bool clearFrameView)
{
m_frame->editor()->clear();
if (!m_needsClear)
return;
m_needsClear = false;
if (!m_frame->document()->inPageCache()) {
m_frame->document()->cancelParsing();
m_frame->document()->stopActiveDOMObjects();
if (m_frame->document()->attached()) {
m_frame->document()->willRemove();
m_frame->document()->detach();
m_frame->document()->removeFocusedNodeOfSubtree(m_frame->document());
}
}
since"m_frame->document()->detach()" will set the document's focusenode null
and "removeFocusedNodeOfSubtree" will return if the document's focusnode is null.
So the code in removeFocusedNodeOfSubtree will never be called.
And I wonder why will there be such a statement.
Anyone knows? Thank you!
Ahmad Saleem
rniwa@webkit.org - Is this something still required? Thanks!
Alexey Proskuryakov
This was never a bug report, and webkit-dev mailing list would have been more appropriate for this question.
FrameLoader::clear has changed so much that it would take too much effort to see if this is still applicable in some way.