| Index: third_party/WebKit/Source/core/html/media/MediaError.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/media/MediaError.cpp b/third_party/WebKit/Source/core/html/media/MediaError.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6a20659cdee4fc200050afd2c7e6b2426f395e17
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/html/media/MediaError.cpp
|
| @@ -0,0 +1,32 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "core/html/media/MediaError.h"
|
| +
|
| +#include "platform/json/JSONValues.h"
|
| +
|
| +namespace blink {
|
| +
|
| +MediaError::MediaError(ErrorCode code, const JSONObject* messages)
|
| + : code_(code) {
|
| + if (!messages->size()) {
|
| + // A message containing an empty serialized JSON object ("{}") is invalid
|
| + // and just an empty string should be used in this case per spec:
|
| + // https://html.spec.whatwg.org/multipage/embedded-content.html#mediaerror
|
| + // "...whose message is a string containing any details the user agent is
|
| + // able to supply about the cause of the error condition, or the empty
|
| + // string if the user agent is unable to supply such details..."
|
| + message_ = "";
|
| + return;
|
| + }
|
| +
|
| + // https://html.spec.whatwg.org/multipage/embedded-content.html#mediaerror
|
| + // "The message and message format are not generally uniform across
|
| + // different user agents."
|
| + // We use a readily-parsable serialized JSON object to represent these error
|
| + // messages, if we have anything additional to report beyond just the code.
|
| + message_ = messages->ToJSONString();
|
| +}
|
| +
|
| +} // namespace blink
|
|
|