merge mozilla-inbound to mozilla-central. r=merge a=merge
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 18 Sep 2017 11:34:59 +0200
changeset 430948 ffe6cc09ccf38cca6f0e727837bbc6cb722d1e71
parent 430929 4ef69bbd6816d95ade430640785971f587e2d5bc (current diff)
parent 430947 ff9e183ca0fe4d0f4afde67a56777769357477b8 (diff)
child 430949 936cba1c05c9ba0a1db3cfad187cd0f21ac61c03
child 430968 54ee6d437d167105a657ea929a6243496e9d5d2f
child 431028 66d994e5bceba2e1e16397a286f3a3ff515f28e3
push id7775
push userryanvm@gmail.com
push dateTue, 19 Sep 2017 01:22:09 +0000
treeherdermozilla-beta@a0f805dbe65d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge, merge
milestone57.0a1
first release with
nightly linux32
ffe6cc09ccf3 / 57.0a1 / 20170918100059 / files
nightly linux64
ffe6cc09ccf3 / 57.0a1 / 20170918100059 / files
nightly mac
ffe6cc09ccf3 / 57.0a1 / 20170918100059 / files
nightly win32
ffe6cc09ccf3 / 57.0a1 / 20170918100059 / files
nightly win64
ffe6cc09ccf3 / 57.0a1 / 20170918100059 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge mozilla-inbound to mozilla-central. r=merge a=merge MozReview-Commit-ID: DYPstPArJWR
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
@@ -125,37 +125,37 @@ var gTests = [
     await expectNoObserverCalled();
     await checkNotSharing();
   }
 },
 
 {
   desc: "getUserMedia audio+video: reloading a frame updates the sharing UI",
   run: async function checkUpdateWhenReloading() {
-    // We'll share only the mic in the first frame, then share both in the
+    // We'll share only the cam in the first frame, then share both in the
     // second frame, then reload the second frame. After each step, we'll check
     // the UI is in the correct state.
 
     let promise = promisePopupNotificationShown("webRTC-shareDevices");
-    await promiseRequestDevice(true, false, "frame1");
+    await promiseRequestDevice(false, true, "frame1");
     await promise;
     await expectObserverCalled("getUserMedia:request");
-    checkDeviceSelectors(true, false);
+    checkDeviceSelectors(false, true);
 
     let indicator = promiseIndicatorWindow();
     await promiseMessage("ok", () => {
       PopupNotifications.panel.firstChild.button.click();
     });
     await expectObserverCalled("getUserMedia:response:allow");
     await expectObserverCalled("recording-device-events");
-    Assert.deepEqual((await getMediaCaptureState()), {audio: true},
-                     "expected microphone to be shared");
+    Assert.deepEqual((await getMediaCaptureState()), {video: true},
+                     "expected camera to be shared");
 
     await indicator;
-    await checkSharingUI({video: false, audio: true});
+    await checkSharingUI({video: true, audio: false});
     await expectNoObserverCalled();
 
     promise = promisePopupNotificationShown("webRTC-shareDevices");
     await promiseRequestDevice(true, true, "frame2");
     await promise;
     await expectObserverCalled("getUserMedia:request");
     checkDeviceSelectors(true, true);
 
@@ -171,17 +171,17 @@ var gTests = [
     await expectNoObserverCalled();
 
     info("reloading the second frame");
     promise = promiseObserverCalled("recording-device-events");
     await promiseReloadFrame("frame2");
     await promise;
 
     await expectObserverCalled("recording-window-ended");
-    await checkSharingUI({video: false, audio: true});
+    await checkSharingUI({video: true, audio: false});
     await expectNoObserverCalled();
 
     await closeStream(false, "frame1");
     await expectNoObserverCalled();
     await checkNotSharing();
   }
 },
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -159,17 +159,17 @@ TabParent::TabParent(nsIContentParent* a
   , mDocShellIsActive(false)
   , mMarkedDestroying(false)
   , mIsDestroyed(false)
   , mChromeFlags(aChromeFlags)
   , mDragValid(false)
   , mInitedByParent(false)
   , mTabId(aTabId)
   , mCreatingWindow(false)
-  , mCursor(nsCursor(-1))
+  , mCursor(eCursorInvalid)
   , mTabSetsCursor(false)
   , mHasContentOpener(false)
 #ifdef DEBUG
   , mActiveSupressDisplayportCount(0)
 #endif
   , mLayerTreeEpoch(0)
   , mPreserveLayers(false)
   , mHasPresented(false)
@@ -1126,17 +1126,17 @@ TabParent::SendRealMouseEvent(WidgetMous
   if (widget) {
     // When we mouseenter the tab, the tab's cursor should
     // become the current cursor.  When we mouseexit, we stop.
     if (eMouseEnterIntoWidget == aEvent.mMessage) {
       mTabSetsCursor = true;
       if (mCustomCursor) {
         widget->SetCursor(mCustomCursor,
                           mCustomCursorHotspotX, mCustomCursorHotspotY);
-      } else if (mCursor != nsCursor(-1)) {
+      } else if (mCursor != eCursorInvalid) {
         widget->SetCursor(mCursor);
       }
     } else if (eMouseExitFromWidget == aEvent.mMessage) {
       mTabSetsCursor = false;
     }
   }
   if (!mIsReadyToHandleInputEvents) {
     if (eMouseEnterIntoWidget == aEvent.mMessage) {
@@ -1782,17 +1782,17 @@ TabParent::RecvSetCustomCursor(const nsC
                                const uint32_t& aWidth,
                                const uint32_t& aHeight,
                                const uint32_t& aStride,
                                const uint8_t& aFormat,
                                const uint32_t& aHotspotX,
                                const uint32_t& aHotspotY,
                                const bool& aForce)
 {
-  mCursor = nsCursor(-1);
+  mCursor = eCursorInvalid;
 
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (widget) {
     if (aForce) {
       widget->ClearCachedCursor();
     }
 
     if (mTabSetsCursor) {
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1227,18 +1227,23 @@ public:
 
       RefPtr<MediaMgrError> error = nullptr;
       if (self->mAudioDevice) {
         nsresult rv =
           self->mAudioDevice->GetSource()->Start(source, kAudioTrack,
                                                  self->mSourceListener->GetPrincipalHandle());
         if (NS_FAILED(rv)) {
           nsString log;
-          log.AssignASCII("Starting audio failed");
-          error = new MediaMgrError(NS_LITERAL_STRING("InternalError"), log);
+          if (rv == NS_ERROR_NOT_AVAILABLE) {
+            log.AssignASCII("Concurrent mic process limit.");
+            error = new MediaMgrError(NS_LITERAL_STRING("NotReadableError"), log);
+          } else {
+            log.AssignASCII("Starting audio failed");
+            error = new MediaMgrError(NS_LITERAL_STRING("InternalError"), log);
+          }
         }
       }
 
       if (!error && self->mVideoDevice) {
         nsresult rv =
           self->mVideoDevice->GetSource()->Start(source, kVideoTrack,
                                                  self->mSourceListener->GetPrincipalHandle());
         if (NS_FAILED(rv)) {
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -469,16 +469,23 @@ MediaEngineWebRTCMicrophoneSource::Start
                                          TrackID aID,
                                          const PrincipalHandle& aPrincipalHandle)
 {
   AssertIsOnOwningThread();
   if (sChannelsOpen == 0 || !aStream) {
     return NS_ERROR_FAILURE;
   }
 
+  // Until we fix bug 1400488 we need to block a second tab (OuterWindow)
+  // from opening an already-open device.  If it's the same tab, they
+  // will share a Graph(), and we can allow it.
+  if (!mSources.IsEmpty() && aStream->Graph() != mSources[0]->Graph()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
   {
     MonitorAutoLock lock(mMonitor);
     mSources.AppendElement(aStream);
     mPrincipalHandles.AppendElement(aPrincipalHandle);
     MOZ_ASSERT(mSources.Length() == mPrincipalHandles.Length());
   }
 
   AudioSegment* segment = new AudioSegment();
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -880,19 +880,19 @@ InitJSContextForWorker(WorkerPrivate* aW
 
   JS::ContextOptionsRef(aWorkerCx) = settings.contextOptions;
 
   JSSettings::JSGCSettingsArray& gcSettings = settings.gcSettings;
 
   // This is the real place where we set the max memory for the runtime.
   for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) {
     const JSSettings::JSGCSetting& setting = gcSettings[index];
-    if (setting.IsSet()) {
+    if (setting.key.isSome()) {
       NS_ASSERTION(setting.value, "Can't handle 0 values!");
-      JS_SetGCParameter(aWorkerCx, setting.key, setting.value);
+      JS_SetGCParameter(aWorkerCx, *setting.key, setting.value);
     }
   }
 
   JS_SetNativeStackQuota(aWorkerCx, WORKER_CONTEXT_NATIVE_STACK_LIMIT);
 
   // Security policy:
   static const JSSecurityCallbacks securityCallbacks = {
     ContentSecurityPolicyAllows
@@ -1930,17 +1930,17 @@ RuntimeService::Init()
   if (!BackgroundChild::GetForCurrentThread()) {
     RefPtr<BackgroundChildCallback> callback = new BackgroundChildCallback();
     if (!BackgroundChild::GetOrCreateForCurrentThread(callback)) {
       MOZ_CRASH("Unable to connect PBackground actor for the main thread!");
     }
   }
 
   // Initialize JSSettings.
-  if (!sDefaultJSSettings.gcSettings[0].IsSet()) {
+  if (sDefaultJSSettings.gcSettings[0].key.isNothing()) {
     sDefaultJSSettings.contextOptions = JS::ContextOptions();
     sDefaultJSSettings.chrome.maxScriptRuntime = -1;
     sDefaultJSSettings.chrome.compartmentOptions.behaviors().setVersion(JSVERSION_DEFAULT);
     sDefaultJSSettings.content.maxScriptRuntime = MAX_SCRIPT_RUN_TIME_SEC;
 #ifdef JS_GC_ZEAL
     sDefaultJSSettings.gcZealFrequency = JS_DEFAULT_ZEAL_FREQ;
     sDefaultJSSettings.gcZeal = 0;
 #endif
--- a/dom/workers/Workers.h
+++ b/dom/workers/Workers.h
@@ -4,16 +4,17 @@
  * 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/. */
 
 #ifndef mozilla_dom_workers_workers_h__
 #define mozilla_dom_workers_workers_h__
 
 #include "jsapi.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/Maybe.h"
 #include "mozilla/Mutex.h"
 #include <stdint.h>
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsDebug.h"
 #include "nsString.h"
 #include "nsTArray.h"
 
@@ -97,35 +98,22 @@ struct JSSettings
     // JSGC_MODE not supported
 
     // This must be last so that we get an accurate count.
     kGCSettingsArraySize
   };
 
   struct JSGCSetting
   {
-    JSGCParamKey key;
+    mozilla::Maybe<JSGCParamKey> key;
     uint32_t value;
 
     JSGCSetting()
-    : key(static_cast<JSGCParamKey>(-1)), value(0)
+    : key(), value(0)
     { }
-
-    bool
-    IsSet() const
-    {
-      return key != static_cast<JSGCParamKey>(-1);
-    }
-
-    void
-    Unset()
-    {
-      key = static_cast<JSGCParamKey>(-1);
-      value = 0;
-    }
   };
 
   // There are several settings that we know we need so it makes sense to
   // preallocate here.
   typedef JSGCSetting JSGCSettingsArray[kGCSettingsArraySize];
 
   // Settings that change based on chrome/content context.
   struct JSContentChromeSettings
@@ -161,40 +149,40 @@ struct JSSettings
   bool
   ApplyGCSetting(JSGCParamKey aKey, uint32_t aValue)
   {
     JSSettings::JSGCSetting* firstEmptySetting = nullptr;
     JSSettings::JSGCSetting* foundSetting = nullptr;
 
     for (uint32_t index = 0; index < ArrayLength(gcSettings); index++) {
       JSSettings::JSGCSetting& setting = gcSettings[index];
-      if (setting.key == aKey) {
+      if (setting.key.isSome() && *setting.key == aKey) {
         foundSetting = &setting;
         break;
       }
-      if (!firstEmptySetting && !setting.IsSet()) {
+      if (!firstEmptySetting && setting.key.isNothing()) {
         firstEmptySetting = &setting;
       }
     }
 
     if (aValue) {
       if (!foundSetting) {
         foundSetting = firstEmptySetting;
         if (!foundSetting) {
           NS_ERROR("Not enough space for this value!");
           return false;
         }
       }
-      foundSetting->key = aKey;
+      foundSetting->key = mozilla::Some(aKey);
       foundSetting->value = aValue;
       return true;
     }
 
     if (foundSetting) {
-      foundSetting->Unset();
+      foundSetting->key.reset();
       return true;
     }
 
     return false;
   }
 };
 
 enum WorkerPreference
--- a/media/libcubeb/README_MOZILLA
+++ b/media/libcubeb/README_MOZILLA
@@ -1,8 +1,8 @@
 The source from this directory was copied from the cubeb 
 git repository using the update.sh script.  The only changes
 made were those applied by update.sh and the addition of
 Makefile.in build files for the Mozilla build system.
 
 The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
 
-The git commit ID used was 09a90a7817bc3d76723065fdc6b53c542fbed402 (2017-09-13 18:39:50 +0200)
+The git commit ID used was ac532ad4f0defaf7a397db64c2c42d2665cd06e9 (2017-09-17 08:23:45 +1200)
--- a/media/libcubeb/src/cubeb_audiounit.cpp
+++ b/media/libcubeb/src/cubeb_audiounit.cpp
@@ -728,17 +728,22 @@ audiounit_property_listener_callback(Aud
             return noErr;
           }
           // Allow restart to choose the new default. Event register only for input.
           switch_side |= DEV_INPUT;
         }
         break;
       case kAudioDevicePropertyDataSource: {
           LOG("Event[%u] - mSelector == kAudioHardwarePropertyDataSource for id=%d", (unsigned int) i, id);
-          switch_side |= DEV_INPUT;
+          if (stm->input_unit) {
+            switch_side |= DEV_INPUT;
+          }
+          if (stm->output_unit) {
+            switch_side |= DEV_OUTPUT;
+          }
         }
         break;
       default:
         LOG("Event[%u] - mSelector == Unexpected Event id %d, return", (unsigned int) i, addresses[i].mSelector);
         stm->switching_device = false;
         return noErr;
     }
   }
--- a/testing/mozharness/scripts/release/generate-checksums.py
+++ b/testing/mozharness/scripts/release/generate-checksums.py
@@ -67,16 +67,17 @@ class ChecksumsGenerator(BaseScript, Vir
     ] + virtualenv_config_options
 
     def __init__(self):
         BaseScript.__init__(self,
             config_options=self.config_options,
             require_config_file=False,
             config={
                 "virtualenv_modules": [
+                    "pip==1.5.5",
                     "boto",
                 ],
                 "virtualenv_path": "venv",
                 'buildbot_json_path': 'buildprops.json',
             },
             all_actions=[
                 "create-virtualenv",
                 "collect-individual-checksums",
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -1007,17 +1007,17 @@ PuppetWidget::SetCursor(imgIContainer* a
   nsDependentCString cursorData(surfaceData.get(), length);
   mozilla::gfx::IntSize size = dataSurface->GetSize();
   if (!mTabChild->SendSetCustomCursor(cursorData, size.width, size.height, stride,
                                       static_cast<uint8_t>(dataSurface->GetFormat()),
                                       aHotspotX, aHotspotY, mUpdateCursor)) {
     return NS_ERROR_FAILURE;
   }
 
-  mCursor = nsCursor(-1);
+  mCursor = eCursorInvalid;
   mCustomCursor = aCursor;
   mCursorHotspotX = aHotspotX;
   mCursorHotspotY = aHotspotY;
   mUpdateCursor = false;
 
   return NS_OK;
 }
 
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1618,17 +1618,17 @@ nsWindow::SetCursor(imgIContainer* aCurs
     if (!mContainer && mGdkWindow) {
         nsWindow *window = GetContainerWindow();
         if (!window)
             return NS_ERROR_FAILURE;
 
         return window->SetCursor(aCursor, aHotspotX, aHotspotY);
     }
 
-    mCursor = nsCursor(-1);
+    mCursor = eCursorInvalid;
 
     // Get the image's current frame
     GdkPixbuf* pixbuf = nsImageToPixbuf::ImageToPixbuf(aCursor);
     if (!pixbuf)
         return NS_ERROR_NOT_AVAILABLE;
 
     int width = gdk_pixbuf_get_width(pixbuf);
     int height = gdk_pixbuf_get_height(pixbuf);
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -206,18 +206,22 @@ enum nsCursor {   ///(normal cursor,    
                 eCursor_no_drop,
                 eCursor_vertical_text,
                 eCursor_all_scroll,
                 eCursor_nesw_resize,
                 eCursor_nwse_resize,
                 eCursor_ns_resize,
                 eCursor_ew_resize,
                 eCursor_none,
-                // This one better be the last one in this list.
-                eCursorCount
+                // This one is used for array sizing, and so better be the last
+                // one in this list...
+                eCursorCount,
+
+                // ...except for this one.
+                eCursorInvalid = eCursorCount + 1
                 };
 
 enum nsTopLevelWidgetZPlacement { // for PlaceBehind()
   eZPlacementBottom = 0,  // bottom of the window stack
   eZPlacementBelow,       // just below another widget
   eZPlacementTop          // top of the window stack
 };
 
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -3015,17 +3015,17 @@ nsWindow::SetCursor(imgIContainer* aCurs
     return NS_ERROR_NOT_AVAILABLE;
 
   HCURSOR cursor;
   double scale = GetDefaultScale().scale;
   IntSize size = RoundedToInt(Size(width * scale, height * scale));
   rv = nsWindowGfx::CreateIcon(aCursor, true, aHotspotX, aHotspotY, size, &cursor);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  mCursor = nsCursor(-1);
+  mCursor = eCursorInvalid;
   ::SetCursor(cursor);
 
   NS_IF_RELEASE(sCursorImgContainer);
   sCursorImgContainer = aCursor;
   NS_ADDREF(sCursorImgContainer);
 
   if (sHCursor != nullptr)
     ::DestroyIcon(sHCursor);
@@ -7174,17 +7174,17 @@ void nsWindow::OnDestroy()
 
   // Free GDI window class objects
   if (mBrush) {
     VERIFY(::DeleteObject(mBrush));
     mBrush = nullptr;
   }
 
   // Destroy any custom cursor resources.
-  if (mCursor == -1)
+  if (mCursor == eCursorInvalid)
     SetCursor(eCursor_standard);
 
   if (mCompositorWidgetDelegate) {
     mCompositorWidgetDelegate->OnDestroyWindow();
   }
   mBasicLayersSurface = nullptr;
 
   // Finalize panning feedback to possibly restore window displacement