This reverts commit c33526f6ae.
Record metrics and trace events for navigation start adjustments.
These metrics will indicate how large the adjustments are in practice,
and how consistently they are made.
The previous attempt did not account for negative time adjustments,
which unfortunately can occur in practice. This CL allows us to gather
metrics for negative adjustments as well (diff from PS1).
Bug: 385170155
Change-Id: Id10060ae8ef6e225c09442aa8c72784ef56c2898
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6120967
Reviewed-by: Tarun Bansal <tbansal@chromium.org>
Commit-Queue: Charlie Reis <creis@chromium.org>
Reviewed-by: Sharon Yang <yangsharon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1401543}
NOTREACHED() and NOTREACHED_IN_MIGRATION() are both CHECK-fatal now.
The former is [[noreturn]] so this CL also performs dead-code removal
after the NOTREACHED().
This CL does not attempt to do additional rewrites of any surrounding
code, like:
if (!foo) {
NOTREACHED();
}
to CHECK(foo);
Those transforms take a non-trivial amount of time (and there are
thousands of instances). Cleanup can be left as an exercise for the
reader.
This does clean up kCrashOnDanglingBrowserContext as both paths of the
kill switch are currently fatal. This has been rolled out for a long
time.
Bug: 40580068, 40062641
Change-Id: Ib88e710d003e2e48df3fc502ca54d2341d157a0e
Cq-Include-Trybots: luci.chromium.try:linux-dcheck-off-rel
Low-Coverage-Reason: OTHER Should-be-unreachable code
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5974816
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1376522}
Tests that override SetupCommandLine() already get the CommandLine as a
method argument. There is no need to call
base::CommandLine::ForCurrentProcess(). Consistently use the argument
instead.
Change-Id: I4643babbce672ceb304a14318cc0c3d73761e407
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5691228
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1325737}
ContentBrowserTest::SetUpCommandLine() is actually not defined. Calls to
this method ends up running BrowserTestBase::SetUpCommandLine(), which
is always going to be empty. Since there is no point in calling this
method, delete all the callers from SetUpCommandLine() overrides. When
the override becomes empty, delete the override altogether.
Make a note of this in the comments in content_browser_test.h. Also fix
some lint errors along the way.
Change-Id: I81f263286d72ebdab68dfd9575ad4cf2b6378a3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5691227
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1325736}
The CL fixes BackForwardCacheWithSubframeNavigationBrowserTest timeouts
if a speculative render frame will not be created. The test field trial
is also enabled in the CL since the failing tests are resolved.
Bug: 332435024
Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome
Change-Id: I85131f3479430a5c606ff098a927a086f7a75a96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5624830
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Jiacheng Guo <gjc@google.com>
Cr-Commit-Position: refs/heads/main@{#1317182}
After the DeferSpeculativeRFH feature, the speculative RFH may not be
created when the navigation starts. The CL adds test utilities to
explicitly wait for the creation of the speculative RFH including:
* New functions added to the TestNavigationManager to wait for the
speculative RFH and acquire the created speculative RFH.
* A new utility class SpeculativeRenderFrameHostObserver to wait for the
speculative RFH without throttling the navigation.
All the failing tests have been modified to cater to the new feature.
The CL for the DeferSpeculativeRFH feature can be found at:
crrev.com/c/5400835
The design doc for the test fixes can be found at:
https://docs.google.com/document/d/14-hslQc3whJ3wa0rse3jdg1pzr5OZUM-5qDOuPAj-8o/edit?usp=sharing
Bug: 332435024
Change-Id: Ib1957784580624cd2546d9dd7d93a27178c879a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5401150
Reviewed-by: Jan Keitel <jkeitel@google.com>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Jiacheng Guo <gjc@google.com>
Cr-Commit-Position: refs/heads/main@{#1313739}
This was generated by replacing " NOTREACHED()" with
" NOTREACHED_IN_MIGRATION()" and running git cl format.
This prepares for making NOTREACHED() [[noreturn]] alongside
NotReachedIsFatal migration of existing inventory.
Bug: 40580068
Change-Id: I3b48b89911ac5e9ffcb211622992f917f8f9e8d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5539619
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1301096}
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:
- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)
Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.
#crbug-todo-migration
Bug: b/321899722
Change-Id: Ibc66b8c440e4bcdef414e77fef4d9874d2ea9951
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5493800
Auto-Submit: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1293330}
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:
- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)
Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.
#crbug-todo-migration
Bug: b/321899722
Change-Id: Iee14d10d544e9f0ec046117cc4ec8a55c427adc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5469947
Reviewed-by: Darryl James <dljames@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1290838}
The changes of this CL are made using the following script.
```
target_directory="content/browser"
replace_string_in_files() {
old_string="$1"
new_string="$2"
find "$target_directory" -type f \( -name "*.cc" -o -name "*.h" \) \
-exec sed -i '' "s/$old_string/$new_string/g" {} +
}
delete_include() {
find "$target_directory" \( -name "*.h" -o -name "*.cc" \) -print0 | while IFS= read -r -d '' file; do
grep -v '#include "base/strings/string_piece.h"' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
done
}
add_include() {
find "$target_directory" \( -name "*.h" -o -name "*.cc" \) -print0 | while IFS= read -r -d '' file; do
local include_added=false
local tempfile=$(mktemp)
if grep -qE 'std::(string|u16string)_view' "$file"; then
while IFS= read -r line; do
echo "$line" >> "$tempfile"
if [[ $line =~ ^\s*#include ]]; then
if ! $include_added; then
echo "#include <string_view>" >> "$tempfile"
include_added=true
fi
fi
done < "$file"
mv "$tempfile" "$file"
if $include_added; then
echo "Added #include <string_view> after the first include line in $file"
else
echo "No include line found in $file"
fi
else
echo "std::string_view not found in $file"
fi
done
}
replace_string_in_files "base::StringPiece16" "std::u16string_view"
replace_string_in_files "base::StringPiece" "std::string_view"
delete_include
add_include
```
Replaced base::StringPiece16 with std::u16string_view
Replaced base::StringPiece with std::string_view
Removed header "base/strings/string_piece.h"
Added header "<string_view>" where applicable
Bug: 40506050
Change-Id: I2bc22c79dd9a0c839745afe065123f7a53c4a5ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5401117
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1281746}
This CL cleans up the unused not restored reasons. The only reason that's still reported but removed in this CL is kNoResponseHead. We used
to report this because it mysteriously was reported on its own without
any reason, but now the bug is fixed and it always appears with other
reasons, so it's now safe to remove it.
Change-Id: Ia21affe06037cfb619e7d619fb2471debec6aa8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5371653
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1274057}
These tests expected the RenderFrameHost to stay the same after
navigation, leading to failed expectations or dangling ptrs.
The CL updates the expectations, how we keep track of the ptrs,
or even skips the tests that no longer make sense with RenderDocument
enabled.
Bug: 936696
Change-Id: Ie7897fce62638215074d52d94a2eece372485c86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5358539
Reviewed-by: Christoph Schwering <schwering@google.com>
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1271154}
This CL creates a mojo struct that represents a source location. The goal is to have only two states when we manage source locations: 1. source location exists 2. no source location at all. Having a struct for source location allows us to make a source location itself nullable (avoiding having optional fields inside) and limit the possible cases to only the two.
Here are the specific changes in this CL:
- Created a new mojom file and defined a struct for source location there.
- BFCache-related structs now use the source location struct in common.
Bug: 324201881
Change-Id: I4061ad708010f895416e5881d46c16ba8a3251d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5276765
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Kurumi Muto <mkurumi@google.com>
Cr-Commit-Position: refs/heads/main@{#1263204}
This CL is to change the mojo struct `BackForwardCacheNotRestoredReasons` so it can pass source location information (i.e. url, line number, column number) to the renderer side. In a follow-up, we will send the actual source locations of reasons to the renderer's web local frame, so the NotRestoredReasons API can provide source locations.
Before this CL,
- In the mojo struct `BackForwardCacheNotRestoredReasons`, BFCache blocking reasons were represented as a vector of string without source location.
- The message is sent to the renderer side as mojo `CommitNavigationParams`'s not_restored_reasons: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/navigation/navigation_params.mojom;l=595?q=CommitNavigationParams%20-f:out&ss=chromium%2Fchromium%2Fsrc
In this CL,
- The mojo struct has fields for source location, therefore `CommitNavigationParams`'s not_restored_reasons can now contain source location information.
- But, actual source locations are not sent yet.
In follow-up CLs,
- Actual source locations gathered in back_forward_cache_impl.cc will be sent to a web local frame in the renderer.
- The NotRestoredReasons API will provide source locations.
Change-Id: I0c63b19ea3076ffa5aeb734ad87388a285961a3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5250654
Commit-Queue: Kurumi Muto <mkurumi@google.com>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1257775}
This CL is to make `kUnloadHandler`, a BFCache blocking reason, block BFCache if the feature flag `kDeprecateUnload` is enabled. We expect pages with unload handlers to be still blocked from BFCaching even when unload is deprecated.
Bug: 1513120
Change-Id: Iaa4024c1264c0251e87d5a510ec1f3d5862dbeeb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5252619
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Kurumi Muto <mkurumi@google.com>
Reviewed-by: Mingyu Lei <leimy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1256696}
This CL updates NotRestoredReasons API's implementation to conform to the spec draft[1].
Namely, this CL
(1) removes "preventedBFCache" enum,
(2) adds "masked" to the outermost main frame when cross-origin iframes are blocking, and
(3) creates NotRestoredReasonDetails class on the blink side to make the reason into a struct like {"reason": "error-document"}.
As for (2), when `kAllowCrossOriginSubframes` flag is on, we add "masked" to the randomly selected cross-origin iframe.
Also with (2), `reasons` field is no longer specific to same-origin frames, so I'm moving the field out of `SameOriginDetails`.
We also need to add "masked" when UA internal reasons such as memory pressure block, and that's going to be addressed in a follow-up.
[1]: https://github.com/whatwg/html/pull/9360/files
Bug: 1472637
Change-Id: I89702696a128eea31b2dd2af0ef8c9874e7213ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5086563
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1249965}
This CL adds a new BFCache blocklisted reason "kUnloadHandler". The purpose of this is to use existing functions that capture the source location of blocklisted features for unload handlers. It does not affect the ongoing analysis of unload handler usage because it keeps the original reasons "kUnloadExistsInMain/SubFrame" as they are, and reports the new reason separately.
Bug: 1513120
Change-Id: I0e4b47ad0fb90cf2566640905a80215d86e05ae7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5134730
Reviewed-by: Yuzu Saijo <yuzus@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Mingyu Lei <leimy@chromium.org>
Commit-Queue: Kurumi Muto <mkurumi@google.com>
Cr-Commit-Position: refs/heads/main@{#1244599}
We are experiencing an increase in crashes during the installation of
WebApps when the app redirects or changes its manifest URL after the
loading of web app information has begun. In such cases, we attempt to
abort the installation and destroy the web content object created for
installation, but this triggers a CHECK that ensures web content is not
destroyed while notifying its observers.
To address this issue, we're posting a task to destroy WebContents which will ensure that it happens after observers are notified.
Bug: 1510481
Change-Id: I94d7b2a07451c6c40b31088c69e5502000af71c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5109695
Commit-Queue: Mustapha Jaber <mustjab@microsoft.com>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Dibyajyoti Pal <dibyapal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1243223}
Switch all includes of base/strings/string_piece_forward.h to use
string_piece.h instead, except in string_piece.h. This will make
reduce potential churn when deleting string_piece_forward.h.
Bug: 691162
Change-Id: Icd204f97f574e764b46ebfba32bce7b742a2cacd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5009848
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1221311}
With RenderDocument, cross-document navigations will use new
RenderFrameHosts (and RenderViewHosts, RenderWidgetHosts, etc for
main frame navigations). This CL updates tests and code around BFCache
that didn't expect that, including the related active counts counting.
Bug: 936696
Change-Id: I42942a87ea40125454f1f0fc41fbedc4a8674fec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4810154
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215451}