[webkit-help] onload event is never fired

Y.Sanachan sanachan.y at gmail.com
Sat Jan 25 07:50:20 PST 2014


Hi all,

If the functions with the below ordering were called, I think 'onload'
event is never fired.

1. FrameLoader::checkCompleted()
2. Document::setReadyState(Document::Complete); -- from checkCompleted()
3. HTMLScriptElement::HTMLScriptElement -- from listener of
onreadystatechange
4. ScriptRunner::queueScriptForExecution()
5. Document::incrementLoadEventDelayCount() -- from
queueScriptForExecution()
6. Document::checkCallImplicitClose() -- from checkCompleted()
---> But it will return immediately because of
Document::isDelayingLoadEvent()==true
7. Document::decrementLoadEventDelayCount() is called and timer fired,
FrameLoader::checkCompleted() will be called. However, m_isComplete is
already set to 'true' then
we cannot reach to DOMWindow::dispatchLoadEvent();

As like as the below patch, isn't it necessary to check
isDelayingLoadEvent() after onreadystatechange to be fired ?
Please give me your opinion.

-------------------------------
diff --git a/Source/WebCore/loader/FrameLoader.cpp
b/Source/WebCore/loader/FrameLoader.cpp
index bce07ab..2d3b26e 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -826,6 +826,11 @@ void FrameLoader::checkCompleted()
m_requestedHistoryItem = 0;
m_frame.document()->setReadyState(Document::Complete);

+ if (m_frame.document()->isDelayingLoadEvent()) {
+ m_isComplete = false;
+ return;
+ }
+
#if PLATFORM(IOS)
if (m_frame.document()->url().isEmpty()) {
// We need to update the document URL of a PDF document to be non-empty
so that both back/forward history navigation
-------------------------------

Regards,
Sanachan.



More information about the webkit-help mailing list