Index: Source/modules/mediasource/TrackDefault.cpp |
diff --git a/Source/modules/mediasource/TrackDefault.cpp b/Source/modules/mediasource/TrackDefault.cpp |
index 6485d2eabbbd96dddf868356e8aa0cee64935bd9..3d43756322b9b96cdd5c428c439bee89900a71b7 100644 |
--- a/Source/modules/mediasource/TrackDefault.cpp |
+++ b/Source/modules/mediasource/TrackDefault.cpp |
@@ -10,6 +10,7 @@ |
#include "core/html/track/AudioTrack.h" |
#include "core/html/track/TextTrack.h" |
#include "core/html/track/VideoTrack.h" |
+#include "public/platform/Platform.h" |
namespace blink { |
@@ -40,7 +41,10 @@ TrackDefault* TrackDefault::create(const AtomicString& type, const String& langu |
// When this method is invoked, the user agent must run the following steps: |
// 1. if |language| is not an empty string and |language| is not a BCP 47 |
// language tag, then throw an INVALID_ACCESS_ERR and abort these steps. |
- // FIXME: Implement BCP 47 language tag validation. |
+ if (!Platform::current()->isValidLocaleSyntax(language)) { |
+ exceptionState.throwDOMException(InvalidAccessError, "Invalid BCP 47 language tag"); |
+ return nullptr; |
+ } |
if (type == audioKeyword()) { |
// 2.1. If |type| equals "audio": |