Commit d0841104 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

bindings: Do not get if a dictionary member is missing (3/N)

Bindings is going to update IDL dictionaries to be strict about their
members' existence.  After the update, accessing a getter on a missing
dictionary member will crash.

This CL fixes the potential bug in PerformanceMark's constructor.


Bug: 839389
Change-Id: I1796093b38c00dd876031b44e53d6d983d6d75ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2227930
Auto-Submit: Hitoshi Yoshida <peria@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774657}
parent 2daa3ec5
......@@ -54,7 +54,8 @@ PerformanceMark* PerformanceMark::Create(ScriptState* script_state,
start = performance->now();
}
detail = mark_options->detail();
if (mark_options->hasDetail())
detail = mark_options->detail();
} else {
start = performance->now();
}
......@@ -69,16 +70,13 @@ PerformanceMark* PerformanceMark::Create(ScriptState* script_state,
return nullptr;
}
scoped_refptr<SerializedScriptValue> serialized_detail;
if (detail.IsEmpty()) {
serialized_detail = SerializedScriptValue::NullValue();
} else {
serialized_detail = SerializedScriptValue::Serialize(
script_state->GetIsolate(), detail.V8Value(),
SerializedScriptValue::SerializeOptions(), exception_state);
if (exception_state.HadException())
return nullptr;
}
scoped_refptr<SerializedScriptValue> serialized_detail =
SerializedScriptValue::Serialize(
script_state->GetIsolate(), detail.V8Value(),
SerializedScriptValue::SerializeOptions(), exception_state);
if (exception_state.HadException())
return nullptr;
return MakeGarbageCollected<PerformanceMark>(
mark_name, start, std::move(serialized_detail), exception_state);
}
......
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