[iOS] Track failures in Reading Mode web state usage of LoadData. [chromium/src : main]

0 views
Skip to first unread message

Olivier Robin (Gerrit)

unread,
9:19 AM (4 hours ago) 9:19 AM
to Nohemi Fernandez, Chromium LUCI CQ, Chromium Metrics Reviews, AyeAye, chromium...@chromium.org, asvitkine...@chromium.org, ios-rev...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
Attention needed from Nohemi Fernandez

Olivier Robin added 8 comments

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Olivier Robin . unresolved

I am not sure what is the purpose of the CL.
Do you expect to still see the same freeze, and so want to collect data if that happens?

File ios/chrome/browser/reader_mode/model/constants.h
Line 169, Patchset 7 (Latest):inline constexpr base::TimeDelta kReaderModePageLoadTimeout = base::Seconds(10);
Olivier Robin . unresolved

this is extremely long for a local page load. Should this be 1 second?

File ios/chrome/browser/reader_mode/model/reader_mode_content_tab_helper.mm
Line 74, Patchset 7 (Latest): web_state()->LoadData(content_data, @"text/html", std::move(content_url));
Olivier Robin . unresolved

I think the problem is in content_url.
The WKWebView [1] document this as "A URL that you use to resolve relative URLs within the document."
It probably does not expect the URL to have a fragment, and it is probably what causes the issue (as we don't see the problem for URLs without fragment).
Also, the content we load is the whole page, not the part related to the fragment.

Should we just remove the fragment here? 
```
if (!navigation_manager->GetLastCommittedItem()) {
// `LoadData` requires an already committed navigation item.
std::vector<std::unique_ptr<web::NavigationItem>> navigation_items;
navigation_items.push_back(web::NavigationItem::Create());
navigation_manager->Restore(0, std::move(navigation_items));
}
GURL url = content_url;
GURL::Replacements replacements;
replacements.ClearRef();
url = url.ReplaceComponents(replacements);
web_state()->LoadData(content_data, @"text/html", std::move(url));
```

[1]: https://developer.apple.com/documentation/webkit/wkwebview/load(_:mimetype:characterencodingname:baseurl:)?language=objc

Line 150, Patchset 7 (Latest): web::PageLoadCompletionStatus load_completion_status) {
Olivier Robin . unresolved

should we check load_completion_status in the method?

Also, if timer timed out, should we avoid calling the delegate?

Line 153, Patchset 7 (Latest): // `ReaderModeBrowserAgent` will bypass the call to `LoadContent`.
Olivier Robin . unresolved

I understand why we need to call stop, but I don't understand this comment.

File ios/chrome/browser/reader_mode/model/reader_mode_content_tab_helper_unittest.mm
Line 137, Patchset 7 (Latest): base::CommandLine::ForCurrentProcess()->AppendSwitch(
Olivier Robin . unresolved

ScopedCommandLine

File ios/chrome/browser/reader_mode/model/reader_mode_metrics_helper.mm
Line 167, Patchset 7 (Latest): data_load_timer_ = std::make_unique<base::ElapsedTimer>();
Olivier Robin . unresolved

so you have 2 timer testing for the same thing? Can you have only one?

Line 173, Patchset 7 (Latest): base::UmaHistogramLongTimes100(kReaderModeDataLoadLatencyHistogram,
Olivier Robin . unresolved

is it not supposed to be less than 10 seconds? Should you use UmaHistogramTimes ?

Open in Gerrit

Related details

Attention is currently required from:
  • Nohemi Fernandez
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: If59b9086273ca06fec7a485cae514fd6d95f4d0a
Gerrit-Change-Number: 7485895
Gerrit-PatchSet: 7
Gerrit-Owner: Nohemi Fernandez <fern...@google.com>
Gerrit-Reviewer: Nohemi Fernandez <fern...@google.com>
Gerrit-Reviewer: Olivier Robin <olivie...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Nohemi Fernandez <fern...@google.com>
Gerrit-Comment-Date: Wed, 21 Jan 2026 14:19:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages