Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2884)

Unified Diff: Source/modules/mediasource/TrackDefault.cpp

Issue 1110223002: Use and add layout tests for BCP 47 language tag syntax validation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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":

Powered by Google App Engine
This is Rietveld 408576698