Bug 982183 - Put VTTRegion DOM API behind a pref. r=rillian, r=bz
authorRick Eyre <rick.eyre@hotmail.com>
Wed, 12 Mar 2014 13:55:45 -0400
changeset 192148 0b59bee9d3d2f85a1bb02ffcd929a76de6a357e6
parent 192147 c737dc096ba0aaa6408686eb8fe9264fbaf10954
child 192149 ac77c843076f4abe240dbf0cb1d3c58a50392082
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian, bz
bugs982183
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 982183 - Put VTTRegion DOM API behind a pref. r=rillian, r=bz
content/media/TextTrackRegion.h
content/media/test/test_texttrackcue.html
content/media/test/test_texttrackregion.html
dom/tests/mochitest/general/test_interfaces.html
dom/webidl/VTTCue.webidl
dom/webidl/VTTRegion.webidl
modules/libpref/src/init/all.js
--- a/content/media/TextTrackRegion.h
+++ b/content/media/TextTrackRegion.h
@@ -8,31 +8,38 @@
 #define mozilla_dom_TextTrackRegion_h
 
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsString.h"
 #include "nsWrapperCache.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/dom/TextTrack.h"
+#include "mozilla/Preferences.h"
 
 namespace mozilla {
 namespace dom {
 
 class GlobalObject;
 class TextTrack;
 
 class TextTrackRegion MOZ_FINAL : public nsISupports,
                                   public nsWrapperCache
 {
 public:
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TextTrackRegion)
 
+  static bool RegionsEnabled(JSContext* cx, JSObject* obj)
+  {
+    return Preferences::GetBool("media.webvtt.enabled") &&
+           Preferences::GetBool("media.webvtt.regions.enabled");
+  }
+
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   nsISupports* GetParentObject() const
   {
     return mParent;
   }
 
--- a/content/media/test/test_texttrackcue.html
+++ b/content/media/test/test_texttrackcue.html
@@ -12,17 +12,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body>
 <p id="display"></p>
 <div id="content">
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
+SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true],
+                                   ["media.webvtt.regions.enabled", true]]},
   function() {
     var video = document.createElement("video");
     video.src = "seek.webm";
     video.preload = "auto";
     var trackElement = document.createElement("track");
     trackElement.src = "basic.vtt";
     trackElement.kind = "subtitles";
     document.getElementById("content").appendChild(video);
--- a/content/media/test/test_texttrackregion.html
+++ b/content/media/test/test_texttrackregion.html
@@ -12,17 +12,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body>
 <p id="display"></p>
 <div id="content">
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
+SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true],
+                                   ["media.webvtt.regions.enabled", true]]},
   function() {
     var video = document.createElement("video");
     video.src = "seek.webm";
     video.preload = "auto";
     var trackElement = document.createElement("track");
     trackElement.src = "region.vtt";
     trackElement.kind = "subtitles";
     document.getElementById("content").appendChild(video);
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -1113,17 +1113,17 @@ var interfaceNamesInGlobalScope =
     {name: "USSDReceivedEvent", b2g: true, pref: "dom.mobileconnection.enabled"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "ValidityState",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "VideoStreamTrack",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "VTTCue",
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    "VTTRegion",
+    {name: "VTTRegion", pref: "media.webvtt.regions.enabled"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WaveShaperNode",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WebGLActiveInfo",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WebGLBuffer",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WebGLFramebuffer",
--- a/dom/webidl/VTTCue.webidl
+++ b/dom/webidl/VTTCue.webidl
@@ -27,16 +27,17 @@ enum DirectionSetting {
  Pref="media.webvtt.enabled"]
 interface VTTCue : EventTarget {
   readonly attribute TextTrack? track;
 
   attribute DOMString id;
   attribute double startTime;
   attribute double endTime;
   attribute boolean pauseOnExit;
+  [Pref="media.webvtt.regions.enabled"]
   attribute VTTRegion? region;
   attribute DirectionSetting vertical;
   attribute boolean snapToLines;
   attribute (long or AutoKeyword) line;
   [SetterThrows]
   attribute AlignSetting lineAlign;
   [SetterThrows]
   attribute long position;
--- a/dom/webidl/VTTRegion.webidl
+++ b/dom/webidl/VTTRegion.webidl
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * The origin of this IDL file is
  *  http://dev.w3.org/html5/webvtt/#extension-of-the-texttrack-interface-for-region-support
  */
 
-[Constructor, Pref="media.webvtt.enabled"]
+[Constructor, Func="TextTrackRegion::RegionsEnabled"]
 interface VTTRegion {
            [SetterThrows]
            attribute double width;
 
            attribute long lines;
 
            [SetterThrows]
            attribute double regionAnchorX;
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -289,16 +289,17 @@ pref("media.navigator.enabled", true);
 #endif
 
 pref("media.tabstreaming.width", 320);
 pref("media.tabstreaming.height", 240);
 pref("media.tabstreaming.time_per_frame", 40);
 
 // TextTrack support
 pref("media.webvtt.enabled", true);
+pref("media.webvtt.regions.enabled", false);
 
 // Whether to enable MediaSource support
 pref("media.mediasource.enabled", false);
 
 #ifdef MOZ_WEBSPEECH
 pref("media.webspeech.recognition.enable", false);
 #endif
 #ifdef MOZ_WEBM_ENCODER