Commit 4f5be97a authored by Joe Mason's avatar Joe Mason Committed by Chromium LUCI CQ

[PM] Add opaque origin check in FindAggregationStartNode

Do not trigger WebMeasureMemoryStressTester from opaque origins.

WebMeasureMemory hits a DCHECK in FindAggregationStartNode when
triggered from a page with an opaque origin (such as
chrome://discards/graph):

  [24736:30760:0113/113856.302:FATAL:web_memory_aggregator.cc(416)]
  Check failed: requesting_origin.IsSameOriginWith(GetOrigin(
  start_node)).

The cause is that each time an Origin is constructed from the same URL,
a new opaque origin is returned.

R=ulan

Bug: 1085129
Change-Id: Ibbf23b9c9f085ab3f447551d54b0809000e1e863
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627622
Commit-Queue: Joe Mason <joenotcharles@chromium.org>
Reviewed-by: default avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843140}
parent c62c866d
......@@ -397,6 +397,7 @@ const FrameNode* GetSameOriginParentOrOpener(const FrameNode* frame_node,
const FrameNode* FindAggregationStartNode(const FrameNode* requesting_node) {
DCHECK(requesting_node);
auto requesting_origin = GetOrigin(requesting_node);
DCHECK(!requesting_origin.opaque());
// Follow parent and opener links to find the most general same-site node to
// start the aggregation traversal from.
......
......@@ -24,6 +24,7 @@
#include "components/performance_manager/public/mojom/web_memory.mojom.h"
#include "components/performance_manager/public/v8_memory/web_memory.h"
#include "mojo/public/cpp/bindings/message.h"
#include "url/origin.h"
namespace performance_manager {
......@@ -93,6 +94,8 @@ void WebMeasureMemoryStressTester::OnLoadingStateChanged(
const FrameNode* main_frame = page_node->GetMainFrameNode();
if (!main_frame)
return;
if (url::Origin::Create(main_frame->GetURL()).opaque())
return;
if (base::RandDouble() > kStressTestProbabilityParam.Get())
return;
WebMeasureMemory(main_frame, mojom::WebMemoryMeasurement::Mode::kDefault,
......
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