Source code that handles Javascript XHR requests?

276 views
Skip to first unread message

Robert Oschler

unread,
Jul 28, 2017, 9:05:42 AM7/28/17
to Chromium-discuss
I have the Chromium project set up on my PC using Visual Studio 2017.  Everything compiles and runs fine.  I am looking for the source code location that handles XHR requests made by Javascript code running in a page loaded into the browser.  Does anyone know what project or source file contains that code?

PhistucK

unread,
Jul 28, 2017, 9:08:52 AM7/28/17
to roschler, Chromium-discuss
Tip - cs.chromium.org is a great way to browser and search the code.

The C++ implementation of XMLHttpRequest pretty much begins here -


PhistucK

On Thu, Jul 27, 2017 at 10:36 PM, Robert Oschler <robert....@gmail.com> wrote:
I have the Chromium project set up on my PC using Visual Studio 2017.  Everything compiles and runs fine.  I am looking for the source code location that handles XHR requests made by Javascript code running in a page loaded into the browser.  Does anyone know what project or source file contains that code?

--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+unsubscribe@chromium.org.

Robert Oschler

unread,
Jul 28, 2017, 1:10:57 PM7/28/17
to Chromium-discuss, robert....@gmail.com
Thanks. I set breakpoints on the constructor for the xmlhttprequest class for that file, and many of the more important class methods (sendBytesData(), etc.). I then loaded a page that I know does several XHR requests, confirming the execution of those requests with the DevTools debugger Network window (with the XHR filter on). None of the breakpoints were ever hit.  I have set breakpoints in other parts of the code not related to XHR requests and they were hit, so I know breakpoints are working.



PhistucK

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discu...@chromium.org.

PhistucK

unread,
Jul 28, 2017, 1:19:11 PM7/28/17
to roschler, Chromium-discuss
The other breakpoints you set - were they in renderer code (anything under renderer/ or under third_party/WebKit)?
If they were not, then you might not be attaching to the right process, renderers are child processes of the browser process.
If they were, then the JavaScript-to-C++ bindings may call things a bit differently. Try setting a breakpoint on the open method, perhaps.


PhistucK

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+unsubscribe@chromium.org.

Robert Oschler

unread,
Jul 28, 2017, 4:03:42 PM7/28/17
to Chromium-discuss, robert....@gmail.com
I set breakpoints in this exact file:

C:\Users\realsensible\Documents\chromium\src\third_party\WebKit\Source\core\xmlhttprequest\XMLHttpRequest.cpp

"open" was one of the methods I had breakpoints on, all 3 overloads.  None of those were hit either.

Do you know the name(s) of the child process that executes the Javascript/V8 code (where I assume the XHR request would actually be handled)?

Also, I have a vague memory of someone telling me that there's a command line flag or setting that will tell Chrome to run as a single process.  If that is true, would you know what that is?  That would be helpful if this is indeed a process hunting issue.


Am Freitag, 28. Juli 2017 13:19:11 UTC-4 schrieb PhistucK:
The other breakpoints you set - were they in renderer code (anything under renderer/ or under third_party/WebKit)?
If they were not, then you might not be attaching to the right process, renderers are child processes of the browser process.
If they were, then the JavaScript-to-C++ bindings may call things a bit differently. Try setting a breakpoint on the open method, perhaps.
<snip>

PhistucK

unread,
Jul 28, 2017, 4:32:42 PM7/28/17
to roschler, Chromium-discuss
I do not know the names, I never debugged Chrom(ium). :):

The flag is --single-process, however, it is not guaranteed to work. It breaks a lot, as far as I remember.



PhistucK

--
Reply all
Reply to author
Forward
0 new messages