Commit 8f046128 authored by Andrey Kosyakov's avatar Andrey Kosyakov Committed by Commit Bot

Fix virtual time when fetch bails out due to exceeded keepalive post size

Bug: 1022937
Change-Id: Iacbda3b8a13f41760c74c252fb71bccc0ac66e1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1906939Reviewed-by: default avatarPeter Kvitek <kvitekp@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714518}
parent 56513a6b
Tests that virtual time does not hang when a fetch is cancelled due to exceeded size of pending keepalive data.
Request to https://test.com/index.html, type: Document
\ No newline at end of file
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function(testRunner) {
const {page, session, dp} = await testRunner.startBlank(
'Tests that virtual time does not hang when a fetch is cancelled ' +
'due to exceeded size of pending keepalive data.');
const FetchHelper = await testRunner.loadScriptAbsolute(
'../fetch/resources/fetch-test.js');
const helper = new FetchHelper(testRunner, dp);
await helper.enable();
helper.onceRequest('https://test.com/index.html').fulfill(
FetchHelper.makeContentResponse(`<html></html>`));
await dp.Emulation.setVirtualTimePolicy({policy: 'pause'});
await dp.Emulation.setVirtualTimePolicy({
policy: 'pauseIfNetworkFetchesPending', budget: 5000,
waitForNavigation: true});
await dp.Page.navigate({url: 'https://test.com/index.html'});
helper.onceRequest('https://test.com/post').matched().then(() =>
testRunner.log('FAIL: this request should not come through!'));
await session.evaluateAsync(`
fetch('/post', {method: 'POST', body: '*'.repeat(64 * 1024 + 1),
keepalive: true})
`);
await dp.Emulation.onceVirtualTimeBudgetExpired();
testRunner.completeTest();
})
......@@ -248,6 +248,8 @@ HEADLESS_PROTOCOL_TEST(VirtualTimeHistoryNavigation,
"emulation/virtual-time-history-navigation.js")
HEADLESS_PROTOCOL_TEST(VirtualTimeHistoryNavigationSameDoc,
"emulation/virtual-time-history-navigation-same-doc.js")
HEADLESS_PROTOCOL_TEST(VirtualTimeFetchKeepalive,
"emulation/virtual-time-fetch-keepalive.js")
// http://crbug.com/633321
#if defined(OS_ANDROID)
......
......@@ -1908,7 +1908,6 @@ bool ResourceFetcher::StartLoad(Resource* resource) {
const auto& request = resource->GetResourceRequest();
ResourceResponse response;
resource->VirtualTimePauser().PauseVirtualTime();
if (resource_load_observer_) {
DCHECK(!IsDetached());
resource_load_observer_->WillSendRequest(
......@@ -1943,6 +1942,7 @@ bool ResourceFetcher::StartLoad(Resource* resource) {
} else {
non_blocking_loaders_.insert(loader);
}
resource->VirtualTimePauser().PauseVirtualTime();
StorePerformanceTimingInitiatorInformation(resource);
}
......
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