Commit b4f3feae authored by Nicolás Peña Moreno's avatar Nicolás Peña Moreno Committed by Commit Bot

[Longtasks] Fix frozen value in toJSON() method

Currently, idlharness fails because attribution is not frozen in the
toJSON output. This CL fixes that by calling FreezeV8Object on the
object. In addition to this, we remove the loop and produce interface
objects instead of JSON objects per the algorithm in
https://heycam.github.io/webidl/#es-default-tojson.

Change-Id: Idc4e2adb1c8bfedc296817d1ca259b2ab90fdb21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986015
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728222}
parent 7a9b1b43
...@@ -43,12 +43,9 @@ TaskAttributionVector PerformanceLongTaskTiming::attribution() const { ...@@ -43,12 +43,9 @@ TaskAttributionVector PerformanceLongTaskTiming::attribution() const {
void PerformanceLongTaskTiming::BuildJSONValue(V8ObjectBuilder& builder) const { void PerformanceLongTaskTiming::BuildJSONValue(V8ObjectBuilder& builder) const {
PerformanceEntry::BuildJSONValue(builder); PerformanceEntry::BuildJSONValue(builder);
HeapVector<ScriptValue> attribution; ScriptState* script_state = builder.GetScriptState();
for (unsigned i = 0; i < attribution_.size(); i++) { builder.Add("attribution", FreezeV8Object(ToV8(attribution_, script_state),
attribution.push_back( script_state->GetIsolate()));
attribution_[i]->toJSONForBinding(builder.GetScriptState()));
}
builder.Add("attribution", attribution);
} }
void PerformanceLongTaskTiming::Trace(blink::Visitor* visitor) { void PerformanceLongTaskTiming::Trace(blink::Visitor* visitor) {
......
This is a testharness.js-based test.
PASS idl_test setup
PASS idl_test validation
PASS PerformanceLongTaskTiming interface: existence and properties of interface object
PASS PerformanceLongTaskTiming interface object length
PASS PerformanceLongTaskTiming interface object name
PASS PerformanceLongTaskTiming interface: existence and properties of interface prototype object
PASS PerformanceLongTaskTiming interface: existence and properties of interface prototype object's "constructor" property
PASS PerformanceLongTaskTiming interface: existence and properties of interface prototype object's @@unscopables property
PASS PerformanceLongTaskTiming interface: attribute attribution
PASS PerformanceLongTaskTiming interface: operation toJSON()
PASS PerformanceLongTaskTiming must be primary interface of [object PerformanceLongTaskTiming]
PASS Stringification of [object PerformanceLongTaskTiming]
PASS PerformanceLongTaskTiming interface: [object PerformanceLongTaskTiming] must inherit property "attribution" with the proper type
PASS PerformanceLongTaskTiming interface: [object PerformanceLongTaskTiming] must inherit property "toJSON()" with the proper type
FAIL PerformanceLongTaskTiming interface: default toJSON operation on [object PerformanceLongTaskTiming] assert_true: Value should be frozen expected true got false
PASS TaskAttributionTiming interface: existence and properties of interface object
PASS TaskAttributionTiming interface object length
PASS TaskAttributionTiming interface object name
PASS TaskAttributionTiming interface: existence and properties of interface prototype object
PASS TaskAttributionTiming interface: existence and properties of interface prototype object's "constructor" property
PASS TaskAttributionTiming interface: existence and properties of interface prototype object's @@unscopables property
PASS TaskAttributionTiming interface: attribute containerType
PASS TaskAttributionTiming interface: attribute containerSrc
PASS TaskAttributionTiming interface: attribute containerId
PASS TaskAttributionTiming interface: attribute containerName
PASS TaskAttributionTiming interface: operation toJSON()
PASS TaskAttributionTiming must be primary interface of [object TaskAttributionTiming]
PASS Stringification of [object TaskAttributionTiming]
PASS TaskAttributionTiming interface: [object TaskAttributionTiming] must inherit property "containerType" with the proper type
PASS TaskAttributionTiming interface: [object TaskAttributionTiming] must inherit property "containerSrc" with the proper type
PASS TaskAttributionTiming interface: [object TaskAttributionTiming] must inherit property "containerId" with the proper type
PASS TaskAttributionTiming interface: [object TaskAttributionTiming] must inherit property "containerName" with the proper type
PASS TaskAttributionTiming interface: [object TaskAttributionTiming] must inherit property "toJSON()" with the proper type
PASS TaskAttributionTiming interface: default toJSON operation on [object TaskAttributionTiming]
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