Created attachment 283107 [details] Screenshot Please add the ability to logging XMLHttpRequest to the console (as in Chrome, see attachment)
<rdar://problem/27239077>
XHRs are listed in the Network tab and in Timelines tab. Why would you want this dumped to the console?
This is a common thing in other tools: • Chrome - Right click in the Console to see Context Menu • Firefox - Console > Filter output > XHR • Firebug - "Firebug shows you each XMLHttpRequest, in ... and the Console tab" - http://getfirebug.com/network I agree that this isn't the best way to debug network traffic but its something that developers are used to and may speed up debugging of some situations (turn on, perform action, turn off, debug the XHRs in that short time period). If it can easily be turned on / off it would be good for those developers that would rather have this then use the Network tab. I think Nikita had a prototype in the past using just a Safari extension. That said, if we did this I think we'd want to improve our Console filtering in general otherwise it would get out of Control. Firefox has done a really great job here, and I like what they've done with their filtering.
To speed up debugging, yes. It's just handy. By the way, sometimes does not appear an XHR request in the Resources Tab. I recorded this: http://recordit.co/NohOA1ckpw As you can see on the first site everything is OK, but on the another site XHRs are not listed.
(In reply to Joseph Pecoraro from comment #3) > This is a common thing in other tools: > > • Chrome > - Right click in the Console to see Context Menu > > • Firefox > - Console > Filter output > XHR > > • Firebug > - "Firebug shows you each XMLHttpRequest, in ... and the Console tab" > - http://getfirebug.com/network > > I agree that this isn't the best way to debug network traffic but its > something that developers are used to and may speed up debugging of some > situations (turn on, perform action, turn off, debug the XHRs in that short > time period). If it can easily be turned on / off it would be good for those > developers that would rather have this then use the Network tab. > > I think Nikita had a prototype in the past using just a Safari extension. > > That said, if we did this I think we'd want to improve our Console filtering > in general otherwise it would get out of Control. Firefox has done a really > great job here, and I like what they've done with their filtering. Okay, wouldn't it fit in better with our feature set to make XHR breakpoints do the logging via actions? Is it possible for us to evaluate arbitrary JS (conditions, log expressions, etc) when paused at non-script breakpoints? At the least, we could add a "log to console" action.
(In reply to Brian Burg from comment #5) > (In reply to Joseph Pecoraro from comment #3) > > This is a common thing in other tools: > > > > • Chrome > > - Right click in the Console to see Context Menu > > > > • Firefox > > - Console > Filter output > XHR > > > > • Firebug > > - "Firebug shows you each XMLHttpRequest, in ... and the Console tab" > > - http://getfirebug.com/network > > > > I agree that this isn't the best way to debug network traffic but its > > something that developers are used to and may speed up debugging of some > > situations (turn on, perform action, turn off, debug the XHRs in that short > > time period). If it can easily be turned on / off it would be good for those > > developers that would rather have this then use the Network tab. > > > > I think Nikita had a prototype in the past using just a Safari extension. > > > > That said, if we did this I think we'd want to improve our Console filtering > > in general otherwise it would get out of Control. Firefox has done a really > > great job here, and I like what they've done with their filtering. > > Okay, wouldn't it fit in better with our feature set to make XHR breakpoints > do the logging via actions? Is it possible for us to evaluate arbitrary JS > (conditions, log expressions, etc) when paused at non-script breakpoints? At > the least, we could add a "log to console" action. Currently no breakpoint options/actions are available to XHR breakpoints, but we're already looking at adding some: Web Inspector: Add regular expression support to XHR breakpoints https://bugs.webkit.org/show_bug.cgi?id=170099 The script location where the debugger will pause for an XHR breakpoint isn't known ahead of time (the same is true of DOM breakpoints) but this doesn't preclude us from adding Evaluate Script and Log Message actions for both breakpoint types.
Ok, let's retitle this bug to deal with breakpoint actions that provide equivalent functionality.
<rdar://problem/31558086>
I'm not sure I would think to use the Breakpoints sidebar. Currently the XHR Breakpoints pause on XHR.send (and don't work yet with fetch). Yet what is interesting and useful here is to log the result of the async request. I suppose there could be a breakpoint action that follows the XHR and logs its eventual results. Or maybe a way to change the conditions of the breakpoint to happen when the request completes (success/error) instead of or alongside the existing pause point before the load starts.