Comment 0 for bug 1415662

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

I'm looking at bug 1415620 - the onBeforeRedirect test cancels the request in one case, but then never verifies that the request is actually cancelled. Having tried it, it turns out that this just doesn't work at all.

The issue is that the callback hangs off NetworkDelegate::OnBeforeRedirect(), which is called from net::URLRequest::Redirect(). If the application wants to prevent the redirect, Oxide calls net::URLRequet::Cancel(), but it's too late to do this and as soon as we return from NetworkDelegate::OnBeforeRedirect, Chromium restarts the request with the new URL.

To do this, we need to implement a ResourceThrottle, and call in to the application on ResourceThrottle::WillRedirectRequest. This is called much earlier than the NetworkDelegate callback, and gives us an opportunity to actually cancel the request properly.