Backed out changeset 419218259bc1 (Bug 1497390) for frequently failing mda's dom/media/tests/mochitest/identity/test_fingerprints.html (bug 1498326). a=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 12 Oct 2018 19:50:42 +0300
changeset 499282 0ab221f0a99689d1cfe3a158ade3818a680ec26d
parent 499281 7a0840d602524d3b4552a867092267bb3fd5e79e
child 499306 7fd59dc00149b33ede6efb0ed848eef227cae540
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1497390, 1498326
milestone64.0a1
backs out419218259bc1a6f5f1cd527225f1f200fbf55126
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
Backed out changeset 419218259bc1 (Bug 1497390) for frequently failing mda's dom/media/tests/mochitest/identity/test_fingerprints.html (bug 1498326). a=backout
dom/locales/en-US/chrome/dom/dom.properties
dom/media/MediaManager.cpp
dom/media/webrtc/MediaTrackConstraints.cpp
dom/media/webrtc/MediaTrackConstraints.h
dom/webidl/MediaStreamTrack.webidl
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -319,16 +319,20 @@ LargeAllocationNonGetRequest=A Large-All
 LargeAllocationNotOnlyToplevelInTabGroup=A Large-Allocation header was ignored due to the presence of windows which have a reference to this browsing context through the frame hierarchy or window.opener.
 # LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name
 LargeAllocationNonE10S=A Large-Allocation header was ignored due to the document not being loaded out of process.
 GeolocationInsecureRequestIsForbidden=A Geolocation request can only be fulfilled in a secure context.
 # LOCALIZATION NOTE: Do not translate "Large-Allocation", as it is a literal header name.
 LargeAllocationNonWin32=This page would be loaded in a new process due to a Large-Allocation header, however Large-Allocation process creation is disabled on non-Win32 platforms.
 # LOCALIZATION NOTE: Do not translate URL.createObjectURL(MediaStream).
 URLCreateObjectURL_MediaStreamWarning=URL.createObjectURL(MediaStream) is deprecated and will be removed soon.
+# LOCALIZATION NOTE: Do not translate MozAutoGainControl or autoGainControl.
+MozAutoGainControlWarning=mozAutoGainControl is deprecated. Use autoGainControl instead.
+# LOCALIZATION NOTE: Do not translate mozNoiseSuppression or noiseSuppression.
+MozNoiseSuppressionWarning=mozNoiseSuppression is deprecated. Use noiseSuppression instead.
 # LOCALIZATION NOTE: Do not translate xml:base.
 XMLBaseAttributeWarning=Use of xml:base attribute is deprecated and will be removed soon. Please remove any use of it.
 # LOCALIZATION NOTE: Do not translate "content", "Window", and "window.top"
 WindowContentUntrustedWarning=The ‘content’ attribute of Window objects is deprecated.  Please use ‘window.top’ instead.
 # LOCALIZATION NOTE: The first %S is the tag name of the element that starts the loop, the second %S is the element's ID.
 SVGRefLoopWarning=The SVG <%S> with ID “%S” has a reference loop.
 # LOCALIZATION NOTE: The first %S is the tag name of the element in the chain where the chain was broken, the second %S is the element's ID.
 SVGRefChainLengthExceededWarning=An SVG <%S> reference chain which is too long was abandoned at the element with ID “%S”.
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -2790,16 +2790,24 @@ MediaManager::GetUserMedia(nsPIDOMWindow
   } else if (IsOn(c.mVideo)) {
     videoType = MediaSourceEnum::Camera;
     Telemetry::Accumulate(Telemetry::WEBRTC_GET_USER_MEDIA_TYPE,
                           (uint32_t) videoType);
   }
 
   if (c.mAudio.IsMediaTrackConstraints()) {
     auto& ac = c.mAudio.GetAsMediaTrackConstraints();
+    MediaConstraintsHelper::ConvertOldWithWarning(ac.mMozAutoGainControl,
+                                                  ac.mAutoGainControl,
+                                                  "MozAutoGainControlWarning",
+                                                  aWindow);
+    MediaConstraintsHelper::ConvertOldWithWarning(ac.mMozNoiseSuppression,
+                                                  ac.mNoiseSuppression,
+                                                  "MozNoiseSuppressionWarning",
+                                                  aWindow);
     audioType = StringToEnum(dom::MediaSourceEnumValues::strings,
                              ac.mMediaSource,
                              MediaSourceEnum::Other);
     // Work around WebIDL default since spec uses same dictionary w/audio & video.
     if (audioType == MediaSourceEnum::Camera) {
       audioType = MediaSourceEnum::Microphone;
       ac.mMediaSource.AssignASCII(EnumToASCII(dom::MediaSourceEnumValues::strings,
                                               audioType));
@@ -4758,49 +4766,59 @@ SourceListener::CapturingSource(MediaSou
 
   return CaptureState::Disabled;
 }
 
 RefPtr<SourceListener::ApplyConstraintsPromise>
 SourceListener::ApplyConstraintsToTrack(
     nsPIDOMWindowInner* aWindow,
     TrackID aTrackID,
-    const MediaTrackConstraints& aConstraints,
+    const MediaTrackConstraints& aConstraintsPassedIn,
     dom::CallerType aCallerType)
 {
   MOZ_ASSERT(NS_IsMainThread());
   DeviceState& state = GetDeviceStateFor(aTrackID);
 
   if (mStopped || state.mStopped) {
     LOG(("gUM %s track %d applyConstraints, but source is stopped",
          aTrackID == kAudioTrack ? "audio" : "video", aTrackID));
     return ApplyConstraintsPromise::CreateAndResolve(false, __func__);
   }
 
+  MediaTrackConstraints c(aConstraintsPassedIn); // use a modifiable copy
+  MediaConstraintsHelper::ConvertOldWithWarning(c.mMozAutoGainControl,
+                                                c.mAutoGainControl,
+                                                "MozAutoGainControlWarning",
+                                                aWindow);
+  MediaConstraintsHelper::ConvertOldWithWarning(c.mMozNoiseSuppression,
+                                                c.mNoiseSuppression,
+                                                "MozNoiseSuppressionWarning",
+                                                aWindow);
+
   MediaManager* mgr = MediaManager::GetIfExists();
   if (!mgr) {
     return ApplyConstraintsPromise::CreateAndResolve(false, __func__);
   }
 
   return MediaManager::PostTask<ApplyConstraintsPromise>(__func__,
-      [device = state.mDevice, aConstraints,
+      [device = state.mDevice, c,
        isChrome = aCallerType == dom::CallerType::System]
       (MozPromiseHolder<ApplyConstraintsPromise>& aHolder) mutable {
     MOZ_ASSERT(MediaManager::IsInMediaThread());
     MediaManager* mgr = MediaManager::GetIfExists();
     MOZ_RELEASE_ASSERT(mgr); // Must exist while media thread is alive
     const char* badConstraint = nullptr;
-    nsresult rv = device->Reconfigure(aConstraints, mgr->mPrefs, &badConstraint);
+    nsresult rv = device->Reconfigure(c, mgr->mPrefs, &badConstraint);
     if (rv == NS_ERROR_INVALID_ARG) {
       // Reconfigure failed due to constraints
       if (!badConstraint) {
         nsTArray<RefPtr<MediaDevice>> devices;
         devices.AppendElement(device);
         badConstraint = MediaConstraintsHelper::SelectSettings(
-            NormalizedConstraints(aConstraints), devices, isChrome);
+            NormalizedConstraints(c), devices, isChrome);
       }
 
       aHolder.Reject(Some(NS_ConvertASCIItoUTF16(badConstraint)), __func__);
       return;
     }
 
     if (NS_FAILED(rv)) {
       // Reconfigure failed unexpectedly
--- a/dom/media/webrtc/MediaTrackConstraints.cpp
+++ b/dom/media/webrtc/MediaTrackConstraints.cpp
@@ -619,16 +619,43 @@ MediaConstraintsHelper::FindBadConstrain
 {
   AutoTArray<RefPtr<MediaDevice>, 1> devices;
   devices.AppendElement(MakeRefPtr<MediaDevice>(aMediaEngineSource,
                                                 aMediaEngineSource->GetName(),
                                                 aDeviceId));
   return FindBadConstraint(aConstraints, devices);
 }
 
+/* static */ void
+MediaConstraintsHelper::ConvertOldWithWarning(
+    const dom::OwningBooleanOrConstrainBooleanParameters& old,
+    dom::OwningBooleanOrConstrainBooleanParameters& to,
+    const char* aMessageName,
+    nsPIDOMWindowInner* aWindow) {
+  if ((old.IsBoolean() ||
+       old.GetAsConstrainBooleanParameters().mExact.WasPassed() ||
+       old.GetAsConstrainBooleanParameters().mIdeal.WasPassed()) &&
+      !(to.IsBoolean() ||
+        to.GetAsConstrainBooleanParameters().mExact.WasPassed() ||
+        to.GetAsConstrainBooleanParameters().mIdeal.WasPassed())) {
+    nsCOMPtr<nsIDocument> doc = aWindow->GetDoc();
+    if (doc) {
+      nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
+                                      NS_LITERAL_CSTRING("DOM"), doc,
+                                      nsContentUtils::eDOM_PROPERTIES,
+                                      aMessageName);
+    }
+    if (old.IsBoolean()) {
+      to.SetAsBoolean() = old.GetAsBoolean();
+    } else {
+      to.SetAsConstrainBooleanParameters() = old.GetAsConstrainBooleanParameters();
+    }
+  }
+}
+
 static void
 LogConstraintStringRange(const NormalizedConstraintSet::StringRange& aRange)
 {
   if (aRange.mExact.size() <= 1 && aRange.mIdeal.size() <= 1) {
     LOG("  %s: { exact: [%s], ideal: [%s] }",
         aRange.mName,
         (aRange.mExact.size()? NS_ConvertUTF16toUTF8(*aRange.mExact.begin()).get() : ""),
         (aRange.mIdeal.size()? NS_ConvertUTF16toUTF8(*aRange.mIdeal.begin()).get() : ""));
--- a/dom/media/webrtc/MediaTrackConstraints.h
+++ b/dom/media/webrtc/MediaTrackConstraints.h
@@ -333,14 +333,22 @@ public:
   FindBadConstraint(const NormalizedConstraints& aConstraints,
                     const nsTArray<RefPtr<MediaDevice>>& aDevices);
 
   static const char*
   FindBadConstraint(const NormalizedConstraints& aConstraints,
                     const RefPtr<MediaEngineSource>& aMediaEngineSource,
                     const nsString& aDeviceId);
 
+  // Warn on and convert use of deprecated constraints to new ones
+  static void
+  ConvertOldWithWarning(
+      const dom::OwningBooleanOrConstrainBooleanParameters& old,
+      dom::OwningBooleanOrConstrainBooleanParameters& to,
+      const char* aMessageName,
+      nsPIDOMWindowInner* aWindow);
+
   static void LogConstraints(const NormalizedConstraintSet& aConstraints);
 };
 
 } // namespace mozilla
 
 #endif /* MEDIATRACKCONSTRAINTS_H_ */
--- a/dom/webidl/MediaStreamTrack.webidl
+++ b/dom/webidl/MediaStreamTrack.webidl
@@ -53,16 +53,19 @@ dictionary MediaTrackConstraintSet {
     ConstrainLong viewportOffsetX;
     ConstrainLong viewportOffsetY;
     ConstrainLong viewportWidth;
     ConstrainLong viewportHeight;
     ConstrainBoolean echoCancellation;
     ConstrainBoolean noiseSuppression;
     ConstrainBoolean autoGainControl;
     ConstrainLong channelCount;
+
+    ConstrainBoolean mozNoiseSuppression;
+    ConstrainBoolean mozAutoGainControl;
 };
 
 dictionary MediaTrackConstraints : MediaTrackConstraintSet {
     sequence<MediaTrackConstraintSet> advanced;
 };
 
 enum MediaStreamTrackState {
     "live",