RESOLVED CONFIGURATION CHANGED 127644
onload event is never fired if script element was added from readystatechange listener
https://bugs.webkit.org/show_bug.cgi?id=127644
Summary onload event is never fired if script element was added from readystatechange...
sanachan.y
Reported 2014-01-25 22:31:21 PST
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(); I think isDelayingLoadEvent() is necessary to be checked after onreadystatechange to be fired. Firefox, Chrome v30 (not WebKit) on PC are OK.
Attachments
Test case for this bug to reproduce (913 bytes, text/html)
2014-01-25 22:42 PST, sanachan.y
no flags
Patch (1.38 KB, patch)
2014-01-25 23:01 PST, sanachan.y
no flags
Benjamin Poulain
Comment 1 2014-01-25 22:35:15 PST
sanachan.y
Comment 2 2014-01-25 22:42:11 PST
Created attachment 222255 [details] Test case for this bug to reproduce
sanachan.y
Comment 3 2014-01-25 23:01:28 PST
Created attachment 222258 [details] Patch I'm not an expert of WebKit. Maybe this is incomplete and will make any side-effects.
Deepak Mittal
Comment 4 2014-01-28 02:44:26 PST
When isDelayingLoadEvent() is pending then m_complete should be fale. Changes appears ok to me, I have verified these changes also, It is working fine..
Ahmad Saleem
Comment 5 2022-07-23 03:25:57 PDT
I am not clear on Expected result of test case but all browsers show following output (in Private / Incognito tab or window): interactive complete Recived onload event Browsers tested - Safari 15.6 on macOS 12.5 , Chrome Canary 105 and Firefox Nightly 104 If it is expected result, I think it can be marked as "RESOLVED CONFIGURATION CHANGED" or else test case can be updated etc. Just wanted to share updated results. Thanks!
Ryosuke Niwa
Comment 6 2022-07-23 14:35:54 PDT
Yeah, this appears to be fixed now.
Note You need to log in before you can comment on or make changes to this bug.