Commit 45e9fe0c authored by Nicolas Pena's avatar Nicolas Pena Committed by Commit Bot

[PerformanceTimeline] Do not throw error when observing invalid types

This CL uses a console warning instead of error when entryTypes is
invalid, which aligns our implementation with the spec and fixes a
test in Performance Timeline. It also removes a stray .expected file.

Bug: 898791

Change-Id: Ie0a0eb0ab4889a062258aab0f3fd967191f1f430
Reviewed-on: https://chromium-review.googlesource.com/c/1374168Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616087}
parent a3311e20
...@@ -96,9 +96,11 @@ void PerformanceObserver::observe(const PerformanceObserverInit* observer_init, ...@@ -96,9 +96,11 @@ void PerformanceObserver::observe(const PerformanceObserverInit* observer_init,
} }
} }
if (entry_types == PerformanceEntry::kInvalid) { if (entry_types == PerformanceEntry::kInvalid) {
exception_state.ThrowTypeError( String message =
"A Performance Observer MUST have at least one valid entryType in its " "A Performance Observer MUST have at least one valid entryType in its "
"entryTypes attribute."); "entryTypes attribute.";
GetExecutionContext()->AddConsoleMessage(ConsoleMessage::Create(
kJSMessageSource, kWarningMessageLevel, message));
return; return;
} }
filter_options_ = entry_types; filter_options_ = entry_types;
......
This is a testharness.js-based test.
FAIL navigation entry is observable assert_not_equals: Entry matches got disallowed value null
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS no entryTypes throws a TypeError
PASS entryTypes must be a sequence or throw a TypeError
FAIL Empty sequence entryTypes is a no-op Failed to execute 'observe' on 'PerformanceObserver': A Performance Observer MUST have at least one valid entryType in its entryTypes attribute.
FAIL Unknown entryTypes are no-op Failed to execute 'observe' on 'PerformanceObserver': A Performance Observer MUST have at least one valid entryType in its entryTypes attribute.
PASS Filter unsupported entryType entryType names within the entryTypes sequence
PASS Check observer callback parameter and this values
PASS replace observer if already present
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS no entryTypes throws a TypeError
PASS entryTypes must be a sequence or throw a TypeError
FAIL Empty sequence entryTypes is a no-op Failed to execute 'observe' on 'PerformanceObserver': A Performance Observer MUST have at least one valid entryType in its entryTypes attribute.
FAIL Unknown entryTypes are no-op Failed to execute 'observe' on 'PerformanceObserver': A Performance Observer MUST have at least one valid entryType in its entryTypes attribute.
PASS Filter unsupported entryType entryType names within the entryTypes sequence
PASS Check observer callback parameter and this values
PASS replace observer if already present
Harness: the test ran to completion.
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