How to find out if the URLRequest is the root document?

21 views
Skip to first unread message

Demetrios Tsillas

unread,
May 16, 2018, 4:03:35 PM5/16/18
to Chromium-dev
After some extensive code safari I am still not able to figure out how to do this.

My code is in ChromeNetworkDelegate::OnBeforeURLRequest. I'm trying to figure out if the URLRequest is for the root document of a frame.

I see there is something called GetResourceType() from the request_info, which can tell me we are in the content::RESOURCE_TYPE_MAIN_FRAME. That's part of it.

If I could get to the frame, I would be able to see if there's a committed document (if there isn't, that should tell me the request is for the root doc?).

Any help appreciated!!!

-Jim.

Demetrios Tsillas

unread,
May 17, 2018, 10:25:36 AM5/17/18
to Chromium-dev
After more debugging it looks like content::RESOURCE_TYPE_MAIN_FRAME is what I want. I was getting confused because redirects will also have this.
Reply all
Reply to author
Forward
0 new messages