Where I can find GM_xmlhttpRequest xhr console logs - javascript

I have a little userscript running on Tampermonkey in Firefox (chrome has the same behavior)
The xhr logs of these requests doesn't appear in the console or network analysis.
Because it is a cors request from https to a http service, we have to use GM_xmlhttpRequest() and cannot use fetch() or normal XmlHttpRequest
The request report sometimes an error and sometimes not, so the information would be very helpful to solve our issue.
My question is, where I can find these logs, or how can I turn it on?

GM_xmlhttpRequest() is usually run from the background script of the userscript manager.
As mentioned in the following topic, you can open the relative console and check the Network tab.
Can't get Firefox extension logs to show up
Firefox console has been divided into different areas. The result of
console.log() can be viewed in the relative area.
Multiprocess Browser Console Ctrl+Shift+J Mostly logs by Firefox itself
Web Developer Tools Ctrl+Shift+I or F12 Logs by Tab/Webpage and Content scripts of addons
Extension Toolbox about:debugging#/runtime/this-firefox ➜ XYZaddon ➜ Inspect Logs by background scripts of XYZaddon

Related

Find HTTP Request Initiator Line In Internet Explorer Developer Tools

I'm getting some odd behavior when my page is loaded in Internet Explorer 11. When my page loads in IE 11 and I watch the Network Tab of the Developer Tools I see a HTTP Get request to the base URL of the page. By base URL I mean the URL without any parameters. This is causing a 500 Internal Server Error to get fired because the Action on the other side of the Request doesn't accept no Parameters. I use Elmah to send me a mail for any unhandled exceptions so whenever a user is using IE I get a ton of Error notifications. This is only happening in IE. Both Firefox and Chrome work as expected. Also, this doesn't seem to break the page in anyway. I only know about this error because of the Emails I'm getting. No User has reported an issue when using IE 11.
Short of searching through every line of Javascript code both 3rd party and my own is there a way in Internet Explorer Developer Tools or even another 3rd party tool that will tell me the exact line (or even js file) that initiated the Http Get Request similar to Chrome's Development Tools?
Here are some images showing the call I'm talking about. The blacked out portion is my API Key.
The original Url being called in the below examples is http://localhost:44301/Grower/Profile/28
The first image is of the Internet Explorer 11 Development Tools with the offending Http Get Request highlighted.
Next is a Fiddler Screenshot of the same request highlighted.
And finally the Chrome Developer Tools showing no such call happening.
I think there's no such a way in IE dev tools to find the initiator line of HTTP request.
But in my research, I find that we can get the file path of the HTTP request initialed using Fiddler. We can find the file path in Inspectors -> Raw -> Referer:
The file path in Referer in Fiddler is exactly the path in Initiator in Network tab in Chrome. So you could try to check the file path using Fiddler.

Greasemonkey XHR not showing in firefox network devtools

I wrote a script as a user script and ran it on a specific website with Greasemonkey.
It worked perfectly, but I want to see requests that my script has sent
in the Firefox developer tools network tab. Currently it shows the page's requests and not my script's requests.
What should I do?
You need to open Browser Toolbox to see XMLHttpRequest of Greasemonkey.
See how to enable and open Browser Toolbox.
(Check "Enable browser chrome and add-on debugging toolboxes" and "Enable remote debugging" in Developer Tools Settings)
You can find any XMLHttpRequest in the network monitor under Browser Toolbox.

How to consume console logs of Chrome DevTools or Firebug programatically?

I need to save Firebug's or the Google Chrome Console panel's log. I tried console.log() to play with printing logs, but what I need is to programatically save these developer tools logs into files.
Firebug has an extension called ConsoleExport, which does exactly that.
This extension exports the messages logged to Firebug's console in XML format. In the current released version 0.5b5 it only auto-exports to a server URL. Though, in the meantime code landed already (see issue 9) to auto-export to the file system, which will (hopefully) be released soon (see issue 21).

Developer Tools: Follow network requests across popups

We are trying to figure out how something works on the web (for web scraping/automation) and one of the web pages we are working on issues a popup to do some of the work. One of our most commonly used debug tools is the Chrome network tab in Developer Tools, hit "record" do some work, and then examine what was done and then replicate the work done "offline".
However the Developer Tools (in Chrome, Safari and Firefox - all work the same) do not follow requests across a popup, even if you hit "record".
Is there some configuration value I'm missing, or some way to record all network events? We can't use tcpdump/wireshark for this because it's all done over SSL. One option we've considered is a man-in-the-middle https proxy, but I can't find anything pre-written so we'd have to create one ourselves.
I don't know of any way to follow the requests across pop-ups, as each window has its own Web Inspector, however you can use Fiddler to inspect HTTPS requests. It will MITM, and subsequently throw a certificate error, which should allow you to inspect all requests in the order that they happened.
You can use Charles Web Debugging Proxy, which is an app that lets you see all the traffic and even replace some responses with your own. Of course that may break HTTPS so you have to accept the certificate errors, but that's usually a minor problem. It works on Win, Mac and even Linux.
The object inspector cannot inspect what isn't in the current page. Therefore, you will need to open the inspector inside the popup url with same parameters in order to see what it does.
As a tool, you can use a web sniffer to see exactly which url were called during the process.

Programmatically Analyze Network Traffic in a .xpi Firefox Extension

Does anyone know how to get access to the network traffic (requests and responses) caused by a document in a browser window from a xpi Firefox extension, programmatically?
I'd like to use the information you'll see on 'Network' tabs in current browser developer tools (like Firebug or Chrome Dev Tools). Basically, I want to build a Firefox extension that tracks some special web-bugs and do some more analysis on this data.
I've checked the API documentation of the Firefox Addon SDK but I couldn't find the information I was looking for.
Can anyone tell me how this can be accomplished using the Firefox Addon SDK?
Thanks for any hints.

Categories