Closed
Bug 1081626
Opened 10 years ago
Closed 6 years ago
console.logs from pagehide and unload events don't show up anywhere
Categories
(DevTools :: Console, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: support, Unassigned)
References
()
Details
Attachments
(1 file)
407 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36 Steps to reproduce: window.addEventListener('unload', function(event) { console.log('I am the 3rd one.'); }); Actual results: unload event is not fired when refresh the page, tested on 32.0.3 and Nightly (Windows 7) Expected results: unlod event should be fired
also: bug 99820, bug 974383.
Component: Untriaged → Event Handling
Product: Firefox → Core
Comment 2•10 years ago
|
||
If you add a debugger; statement to the unload event, you can see that the events fire just fine - it's the console.log that isn't showing up (just like alert, which is intentionally blocked). This is a bug in the console.log implementation; I'm not sure where that's going wrong, but I'm hoping Brian can help here...
Component: Event Handling → Developer Tools: Console
Flags: needinfo?(bgrinstead)
Product: Core → Firefox
Summary: window.unload event is not fired when refresh the page → console.logs from pagehide and unload events don't show up anywhere
Comment 3•10 years ago
|
||
FWIW, I tried enabling persistent logs - that didn't help. However, if you add the debugger; statement after the last (unload) console.log call, and open the debugger before reloading, you will see all the logs show up. So it basically seems like a race condition where we clear the queue of messages to log when the window object goes away (console.log itself is async, AIUI) and so the messages vanish.
Comment 4•10 years ago
|
||
(In reply to :Gijs Kruitbosch from comment #3) > FWIW, I tried enabling persistent logs - that didn't help. However, if you > add the debugger; statement after the last (unload) console.log call, and > open the debugger before reloading, you will see all the logs show up. So it > basically seems like a race condition where we clear the queue of messages > to log when the window object goes away (console.log itself is async, AIUI) > and so the messages vanish. There is some message queuing on the frontend, but I've checked and actually the onConsoleAPICall function never gets fired, so no consoleAPICall packet ever gets sent to the frontend. As you say, adding a debugger statement after the log in unload does cause the packet to be sent. I haven't tracked it all the way down, but this condition and it's early return seems to get hit without the debugger statement, but doesn't when there is a debugger: http://dxr.mozilla.org/mozilla-central/source/toolkit/devtools/webconsole/utils.js#1257.
Flags: needinfo?(bgrinstead)
Comment 5•10 years ago
|
||
So the log doesn't show up when reloading on this URL: data:text/html,<script type="text/javascript">window.addEventListener('load', () => { console.log('on load'); }); window.addEventListener('unload', () => { console.log('on unload'); }); </script> But it does on this (assuming you've opened the debugger panel): data:text/html,<script type="text/javascript">window.addEventListener('load', () => { console.log('on load'); }); window.addEventListener('unload', () => { console.log('on unload'); debugger; }); </script>
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 7 → All
Hardware: x86_64 → All
Updated•6 years ago
|
Product: Firefox → DevTools
Comment 6•6 years ago
|
||
I do see the unload message when reloading data:text/html,<script type="text/javascript">window.addEventListener('load', () => { console.log('on load'); }); window.addEventListener('unload', () => { console.log('on unload'); }); </script> (without persistent logs enabled)
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•