Commit fb8a2de8 authored by Nate Chapin's avatar Nate Chapin Committed by Commit Bot

Ensure all non-keepalive request really are stopped in ResourceFetcher::ClearContext

Cancelling a font load can start a new fallback load inside
ResourceFetcher::StopFetching. This is a problem if StopFetching() is called
due to the ResourceFetcher detaching, and leaves a semi-detached resource load
in progress.

Bug: 763040, 763387
Test: http/tests/webfont/multiple-font-src-detach.html
Change-Id: If366431abc4752b61d760d10687fd4a81d78ebc1
Reviewed-on: https://chromium-review.googlesource.com/663880Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501382}
parent f90e2676
<body>
Regression test for crbug.com/763387. Multiple font-face src urls can lead to a secondary url being
loaded during detach and not getting cancelled. We pass if we don't crash.
<style>
@font-face {
font-family: "Font1";
src: url("slow-ahem-loading.cgi?delay=5000"), url("../resources/Ahem.ttf");
}
body { font-family: "Font1"; }
</style>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
location = "http://127.0.0.1:8000/navigation/resources/pass-and-notify-done.html"
</script>
</body>
......@@ -1199,6 +1199,13 @@ void ResourceFetcher::ClearContext() {
ClearPreloads(ResourceFetcher::kClearAllPreloads);
context_ = Context().Detach();
// Make sure the only requests still going are keepalive requests.
// Callers of ClearContext() should be calling StopFetching() prior
// to this, but it's possible for additional requests to start during
// StopFetching() (e.g., fallback fonts that only trigger when the
// first choice font failed to load).
StopFetching();
if (!loaders_.IsEmpty() || !non_blocking_loaders_.IsEmpty()) {
// There are some keepalive requests.
self_keep_alive_ = this;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment