merge mozilla-inbound to mozilla-central. r=merge a=merge
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 25 May 2017 10:32:22 +0200
changeset 360560 0ed0fd886134b6698f593edbf0d362ac9e12fe07
parent 360559 6fae88419de6c9bf1980ef5ad1ad75471e12cc69 (current diff)
parent 360546 829d292738ba7c0f8e772794b4e1d03622354ebc (diff)
child 360561 2e1ae8b575704094ae318e8c82e690a1552227b9
child 360635 8a96b7608763dcf8ef89e4831e8868a49aef7435
child 360654 e8da7192201e5786614ec49d557e64dffd114ff2
child 361251 9c8bcb590b888c5c077e3a05625800ed0d6786a8
push id90691
push userarchaeopteryx@coole-files.de
push dateThu, 25 May 2017 08:38:59 +0000
treeherdermozilla-inbound@2e1ae8b57570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge, merge
milestone55.0a1
first release with
nightly mac
0ed0fd886134 / 55.0a1 / 20170525030225 / files
nightly win32
0ed0fd886134 / 55.0a1 / 20170525030225 / files
nightly win64
0ed0fd886134 / 55.0a1 / 20170525030225 / files
nightly linux32
nightly linux64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly mac
nightly win32
nightly win64
merge mozilla-inbound to mozilla-central. r=merge a=merge MozReview-Commit-ID: 2iKvbnEUJsY
testing/web-platform/meta/XMLHttpRequest/event-readystatechange-loaded.htm.ini
testing/web-platform/meta/XMLHttpRequest/overridemimetype-invalid-mime-type.htm.ini
testing/web-platform/meta/XMLHttpRequest/send-entity-body-document-bogus.htm.ini
testing/web-platform/meta/XMLHttpRequest/send-redirect-post-upload.htm.ini
testing/web-platform/meta/fullscreen/api/__dir__.ini
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -1342,17 +1342,17 @@ public:
     if (this == sContentUnbinder) {
       sContentUnbinder = nullptr;
       if (mNext) {
         RefPtr<ContentUnbinder> next;
         next.swap(mNext);
         sContentUnbinder = next;
         next->mLast = mLast;
         mLast = nullptr;
-        NS_DispatchToMainThread(next);
+        NS_IdleDispatchToCurrentThread(next.forget());
       }
     }
     return NS_OK;
   }
 
   static void UnbindAll()
   {
     RefPtr<ContentUnbinder> ub = sContentUnbinder;
@@ -1363,17 +1363,17 @@ public:
     }
   }
 
   static void Append(nsIContent* aSubtreeRoot)
   {
     if (!sContentUnbinder) {
       sContentUnbinder = new ContentUnbinder();
       nsCOMPtr<nsIRunnable> e = sContentUnbinder;
-      NS_DispatchToMainThread(e);
+      NS_IdleDispatchToCurrentThread(e.forget());
     }
 
     if (sContentUnbinder->mLast->mSubtreeRoots.Length() >=
         SUBTREE_UNBINDINGS_PER_RUNNABLE) {
       sContentUnbinder->mLast->mNext = new ContentUnbinder();
       sContentUnbinder->mLast = sContentUnbinder->mLast->mNext;
     }
     sContentUnbinder->mLast->mSubtreeRoots.AppendElement(aSubtreeRoot);
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -161,17 +161,16 @@ WebGLContext::WebGLContext()
     mViewportX = 0;
     mViewportY = 0;
     mViewportWidth = 0;
     mViewportHeight = 0;
 
     mDitherEnabled = 1;
     mRasterizerDiscardEnabled = 0; // OpenGL ES 3.0 spec p244
     mScissorTestEnabled = 0;
-    mDepthTestEnabled = 0;
     mStencilTestEnabled = 0;
 
     if (NS_IsMainThread()) {
         // XXX mtseng: bug 709490, not thread safe
         WebGLMemoryTracker::AddWebGLContext(this);
     }
 
     mAllowContextRestore = true;
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -448,16 +448,17 @@ WebGLContext::InitAndValidateGL(FailureR
     AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_VALUE_MASK,      mStencilValueMaskFront);
     AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_BACK_VALUE_MASK, mStencilValueMaskBack);
     AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_WRITEMASK,       mStencilWriteMaskFront);
     AssertUintParamCorrect(gl, LOCAL_GL_STENCIL_BACK_WRITEMASK,  mStencilWriteMaskBack);
 
     mDitherEnabled = true;
     mRasterizerDiscardEnabled = false;
     mScissorTestEnabled = false;
+    mDepthTestEnabled = 0;
     mGenerateMipmapHint = LOCAL_GL_DONT_CARE;
 
     // Bindings, etc.
     mActiveTexture = 0;
     mDefaultFB_DrawBuffer0 = LOCAL_GL_BACK;
 
     mEmitContextLostErrorOnce = true;
     mWebGLError = LOCAL_GL_NO_ERROR;
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -326,16 +326,17 @@ EventStateManager::EventStateManager()
   ++sESMInstanceCount;
 
   static bool sAddedPointerEventEnabled = false;
   if (!sAddedPointerEventEnabled) {
     Preferences::AddBoolVarCache(&sPointerEventEnabled,
                                  "dom.w3c_pointer_events.enabled", false);
     sAddedPointerEventEnabled = true;
   }
+  WheelTransaction::InitializeStatics();
 }
 
 nsresult
 EventStateManager::UpdateUserActivityTimer()
 {
   if (!gUserInteractionTimerCallback)
     return NS_OK;
 
--- a/dom/events/WheelHandlingHelper.cpp
+++ b/dom/events/WheelHandlingHelper.cpp
@@ -276,17 +276,17 @@ WheelTransaction::Shutdown()
   NS_IF_RELEASE(sTimer);
 }
 
 /* static */ void
 WheelTransaction::OnFailToScrollTarget()
 {
   NS_PRECONDITION(sTargetFrame, "We don't have mouse scrolling transaction");
 
-  if (Preferences::GetBool("test.mousescroll", false)) {
+  if (Prefs::sTestMouseScroll) {
     // This event is used for automated tests, see bug 442774.
     nsContentUtils::DispatchTrustedEvent(
                       sTargetFrame->GetContent()->OwnerDoc(),
                       sTargetFrame->GetContent(),
                       NS_LITERAL_STRING("MozMouseScrollFailed"),
                       true, true);
   }
   // The target frame might be destroyed in the event handler, at that time,
@@ -305,17 +305,17 @@ WheelTransaction::OnTimeout(nsITimer* aT
     return;
   }
   // Store the sTargetFrame, the variable becomes null in EndTransaction.
   nsIFrame* frame = sTargetFrame;
   // We need to finish current transaction before DOM event firing. Because
   // the next DOM event might create strange situation for us.
   MayEndTransaction();
 
-  if (Preferences::GetBool("test.mousescroll", false)) {
+  if (Prefs::sTestMouseScroll) {
     // This event is used for automated tests, see bug 442774.
     nsContentUtils::DispatchTrustedEvent(
                       frame->GetContent()->OwnerDoc(),
                       frame->GetContent(),
                       NS_LITERAL_STRING("MozMouseScrollTransactionTimeout"),
                       true, true);
   }
 }
@@ -341,28 +341,16 @@ WheelTransaction::SetTimeout()
 /* static */ LayoutDeviceIntPoint
 WheelTransaction::GetScreenPoint(WidgetGUIEvent* aEvent)
 {
   NS_ASSERTION(aEvent, "aEvent is null");
   NS_ASSERTION(aEvent->mWidget, "aEvent-mWidget is null");
   return aEvent->mRefPoint + aEvent->mWidget->WidgetToScreenOffset();
 }
 
-/* static */ uint32_t
-WheelTransaction::GetTimeoutTime()
-{
-  return Preferences::GetUint("mousewheel.transaction.timeout", 1500);
-}
-
-/* static */ uint32_t
-WheelTransaction::GetIgnoreMoveDelayTime()
-{
-  return Preferences::GetUint("mousewheel.transaction.ignoremovedelay", 100);
-}
-
 /* static */ DeltaValues
 WheelTransaction::AccelerateWheelDelta(WidgetWheelEvent* aEvent,
                                        bool aAllowScrollSpeedOverride)
 {
   DeltaValues result(aEvent);
 
   // Don't accelerate the delta values if the event isn't line scrolling.
   if (aEvent->mDeltaMode != nsIDOMWheelEvent::DOM_DELTA_LINE) {
@@ -387,28 +375,16 @@ WheelTransaction::AccelerateWheelDelta(W
 }
 
 /* static */ double
 WheelTransaction::ComputeAcceleratedWheelDelta(double aDelta, int32_t aFactor)
 {
   return mozilla::ComputeAcceleratedWheelDelta(aDelta, sScrollSeriesCounter, aFactor);
 }
 
-/* static */ int32_t
-WheelTransaction::GetAccelerationStart()
-{
-  return Preferences::GetInt("mousewheel.acceleration.start", -1);
-}
-
-/* static */ int32_t
-WheelTransaction::GetAccelerationFactor()
-{
-  return Preferences::GetInt("mousewheel.acceleration.factor", -1);
-}
-
 /* static */ DeltaValues
 WheelTransaction::OverrideSystemScrollSpeed(WidgetWheelEvent* aEvent)
 {
   MOZ_ASSERT(sTargetFrame, "We don't have mouse scrolling transaction");
   MOZ_ASSERT(aEvent->mDeltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE);
 
   // If the event doesn't scroll to both X and Y, we don't need to do anything
   // here.
@@ -545,9 +521,36 @@ ScrollbarsForWheel::DeactivateAllTempora
       if (scrollbarMediator) {
         scrollbarMediator->ScrollbarActivityStopped();
       }
       *scrollTarget = nullptr;
     }
   }
 }
 
+/******************************************************************/
+/* mozilla::WheelTransaction                                      */
+/******************************************************************/
+int32_t WheelTransaction::Prefs::sMouseWheelAccelerationStart = -1;
+int32_t WheelTransaction::Prefs::sMouseWheelAccelerationFactor = -1;
+uint32_t WheelTransaction::Prefs::sMouseWheelTransactionTimeout = 1500;
+uint32_t WheelTransaction::Prefs::sMouseWheelTransactionIgnoreMoveDelay = 100;
+bool WheelTransaction::Prefs::sTestMouseScroll = false;
+
+/* static */ void
+WheelTransaction::Prefs::InitializeStatics()
+{
+  static bool sIsInitialized = false;
+  if (!sIsInitialized) {
+    Preferences::AddIntVarCache(&sMouseWheelAccelerationStart,
+                                "mousewheel.acceleration.start", -1);
+    Preferences::AddIntVarCache(&sMouseWheelAccelerationFactor,
+                                "mousewheel.acceleration.factor", -1);
+    Preferences::AddUintVarCache(&sMouseWheelTransactionTimeout,
+                                 "mousewheel.transaction.timeout", 1500);
+    Preferences::AddUintVarCache(&sMouseWheelTransactionIgnoreMoveDelay,
+                                 "mousewheel.transaction.ignoremovedelay", 100);
+    Preferences::AddBoolVarCache(&sTestMouseScroll, "test.mousescroll", false);
+    sIsInitialized = true;
+  }
+}
+
 } // namespace mozilla
--- a/dom/events/WheelHandlingHelper.h
+++ b/dom/events/WheelHandlingHelper.h
@@ -138,45 +138,72 @@ public:
   static bool WillHandleDefaultAction(WidgetWheelEvent* aWheelEvent,
                                       nsIFrame* aTargetFrame)
   {
     AutoWeakFrame targetWeakFrame(aTargetFrame);
     return WillHandleDefaultAction(aWheelEvent, targetWeakFrame);
   }
   static void OnEvent(WidgetEvent* aEvent);
   static void Shutdown();
-  static uint32_t GetTimeoutTime();
+  static uint32_t GetTimeoutTime()
+  {
+    return Prefs::sMouseWheelTransactionTimeout;
+  }
 
   static void OwnScrollbars(bool aOwn);
 
   static DeltaValues AccelerateWheelDelta(WidgetWheelEvent* aEvent,
                                           bool aAllowScrollSpeedOverride);
+  static void InitializeStatics()
+  {
+    Prefs::InitializeStatics();
+  }
 
 protected:
   static void BeginTransaction(nsIFrame* aTargetFrame,
                                WidgetWheelEvent* aEvent);
   // Be careful, UpdateTransaction may fire a DOM event, therefore, the target
   // frame might be destroyed in the event handler.
   static bool UpdateTransaction(WidgetWheelEvent* aEvent);
   static void MayEndTransaction();
 
   static LayoutDeviceIntPoint GetScreenPoint(WidgetGUIEvent* aEvent);
   static void OnFailToScrollTarget();
   static void OnTimeout(nsITimer* aTimer, void* aClosure);
   static void SetTimeout();
-  static uint32_t GetIgnoreMoveDelayTime();
-  static int32_t GetAccelerationStart();
-  static int32_t GetAccelerationFactor();
+  static uint32_t GetIgnoreMoveDelayTime()
+  {
+    return Prefs::sMouseWheelTransactionIgnoreMoveDelay;
+  }
+  static int32_t GetAccelerationStart()
+  {
+    return Prefs::sMouseWheelAccelerationStart;
+  }
+  static int32_t GetAccelerationFactor()
+  {
+    return Prefs::sMouseWheelAccelerationFactor;
+  }
   static DeltaValues OverrideSystemScrollSpeed(WidgetWheelEvent* aEvent);
   static double ComputeAcceleratedWheelDelta(double aDelta, int32_t aFactor);
   static bool OutOfTime(uint32_t aBaseTime, uint32_t aThreshold);
 
   static AutoWeakFrame sTargetFrame;
   static uint32_t sTime; // in milliseconds
   static uint32_t sMouseMoved; // in milliseconds
   static nsITimer* sTimer;
   static int32_t sScrollSeriesCounter;
   static bool sOwnScrollbars;
+
+  class Prefs
+  {
+  public:
+    static void InitializeStatics();
+    static int32_t sMouseWheelAccelerationStart;
+    static int32_t sMouseWheelAccelerationFactor;
+    static uint32_t sMouseWheelTransactionTimeout;
+    static uint32_t sMouseWheelTransactionIgnoreMoveDelay;
+    static bool sTestMouseScroll;
+  };
 };
 
 } // namespace mozilla
 
 #endif // mozilla_WheelHandlingHelper_h_
--- a/dom/plugins/ipc/PPluginModule.ipdl
+++ b/dom/plugins/ipc/PPluginModule.ipdl
@@ -164,12 +164,14 @@ parent:
     returns (int16_t aState);
 
   intr NPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(bool shouldRegister)
     returns (NPError result);
 
   // Used to broker the GetOpenFileName/GetSaveFileName file pickers on Windows.
   intr GetFileName(GetFileNameFunc aFunc, OpenFileNameIPC aOfnIn)
     returns (OpenFileNameRetIPC aOfnOut, bool aResult);
+
+  intr SetCursorPos(int x, int y) returns (bool aResult);
 };
 
 } // namespace plugins
 } // namespace mozilla
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -102,16 +102,20 @@ static WindowsDllInterceptor sComDlg32In
 // proxy GetSaveFileName/GetOpenFileName on chrome so that we can know which
 // files the user has given permission to access
 // We count on GetOpenFileNameA/GetSaveFileNameA calling
 // GetOpenFileNameW/GetSaveFileNameW so we don't proxy them explicitly.
 typedef BOOL (WINAPI *GetOpenFileNameWPtr)(LPOPENFILENAMEW lpofn);
 static GetOpenFileNameWPtr sGetOpenFileNameWPtrStub = nullptr;
 typedef BOOL (WINAPI *GetSaveFileNameWPtr)(LPOPENFILENAMEW lpofn);
 static GetSaveFileNameWPtr sGetSaveFileNameWPtrStub = nullptr;
+
+typedef BOOL (WINAPI *SetCursorPosPtr)(int x, int y);
+static SetCursorPosPtr sSetCursorPosPtrStub = nullptr;
+
 #endif
 
 /* static */
 bool
 PluginModuleChild::CreateForContentProcess(Endpoint<PPluginModuleChild>&& aEndpoint)
 {
     auto* child = new PluginModuleChild(false);
     return child->InitForContent(Move(aEndpoint));
@@ -2092,94 +2096,112 @@ PMCGetKeyState(int aVirtKey)
         int16_t ret = 0;
         if (chromeInstance->CallGetKeyState(aVirtKey, &ret)) {
           return ret;
         }
     }
     return sGetKeyStatePtrStub(aVirtKey);
 }
 
-BOOL WINAPI PMCGetSaveFileNameW(LPOPENFILENAMEW lpofn);
-BOOL WINAPI PMCGetOpenFileNameW(LPOPENFILENAMEW lpofn);
-
-// Runnable that performs GetOpenFileNameW and GetSaveFileNameW
-// on the main thread so that the call can be
+class PluginThreadTaskData
+{
+public:
+    virtual bool RunTask() = 0;
+};
+
+// Runnable that performs a task on the main thread so that the call can be
 // synchronously run on the PluginModuleParent via IPC.
 // The task alerts the given semaphore when it is finished.
-class GetFileNameTask : public Runnable
+class PluginThreadTask : public Runnable
 {
-    BOOL* mReturnValue;
-    void* mLpOpenFileName;
+    bool mSuccess;
+    PluginThreadTaskData* mTaskData;
     HANDLE mSemaphore;
-    GetFileNameFunc mFunc;
 
 public:
-    explicit GetFileNameTask(GetFileNameFunc func, void* aLpOpenFileName,
-                             HANDLE aSemaphore, BOOL* aReturnValue) :
-        Runnable("GetFileNameTask"), mLpOpenFileName(aLpOpenFileName),
-        mSemaphore(aSemaphore), mReturnValue(aReturnValue),
-        mFunc(func)
+    explicit PluginThreadTask(PluginThreadTaskData* aTaskData,
+                              HANDLE aSemaphore) :
+        Runnable("PluginThreadTask"), mTaskData(aTaskData),
+        mSemaphore(aSemaphore), mSuccess(false)
     {}
 
     NS_IMETHOD Run() override
     {
         PLUGIN_LOG_DEBUG_METHOD;
         AssertPluginThread();
-        switch (mFunc) {
-        case OPEN_FUNC:
-            *mReturnValue =
-                PMCGetOpenFileNameW(static_cast<LPOPENFILENAMEW>(mLpOpenFileName));
-            break;
-        case SAVE_FUNC:
-            *mReturnValue =
-                PMCGetSaveFileNameW(static_cast<LPOPENFILENAMEW>(mLpOpenFileName));
-            break;
-        }
+        mSuccess = mTaskData->RunTask();
         if (!ReleaseSemaphore(mSemaphore, 1, nullptr)) {
             return NS_ERROR_FAILURE;
         }
         return NS_OK;
     }
+
+    bool Success() { return mSuccess; }
 };
 
 // static
 BOOL
-PostToPluginThread(GetFileNameFunc aFunc, void* aLpofn)
+PostToPluginThread(PluginThreadTaskData* aTaskData)
 {
     MOZ_ASSERT(!IsPluginThread());
 
     // Synchronously run GetFileNameTask from the main thread.
     // Start a semaphore at 0.  We release the semaphore (bringing its
     // count to 1) when the synchronous call is done.
     nsAutoHandle semaphore(CreateSemaphore(NULL, 0, 1, NULL));
     if (semaphore == nullptr) {
         MOZ_ASSERT(semaphore != nullptr);
         return FALSE;
     }
 
-    BOOL returnValue = FALSE;
-    RefPtr<GetFileNameTask> task =
-        new GetFileNameTask(aFunc, aLpofn, semaphore, &returnValue);
+    RefPtr<PluginThreadTask> task = new PluginThreadTask(aTaskData, semaphore);
     ProcessChild::message_loop()->PostTask(task.forget());
     DWORD err = WaitForSingleObject(semaphore, INFINITE);
     if (err != WAIT_FAILED) {
-        return returnValue;
+        return task->Success();
     }
     PLUGIN_LOG_DEBUG(("Error while waiting for semaphore: %d",
                       GetLastError()));
     MOZ_ASSERT(err != WAIT_FAILED);
     return FALSE;
 }
 
+BOOL WINAPI PMCGetSaveFileNameW(LPOPENFILENAMEW lpofn);
+BOOL WINAPI PMCGetOpenFileNameW(LPOPENFILENAMEW lpofn);
+
+class GetFileNameTaskData : public PluginThreadTaskData
+{
+public:
+    GetFileNameTaskData(GetFileNameFunc aFunc, void* aLpOpenFileName) :
+        mFunc(aFunc), mLpOpenFileName(aLpOpenFileName)
+    {}
+
+    bool RunTask()
+    {
+        switch (mFunc) {
+        case OPEN_FUNC:
+            return PMCGetOpenFileNameW(static_cast<LPOPENFILENAMEW>(mLpOpenFileName));
+        case SAVE_FUNC:
+            return PMCGetSaveFileNameW(static_cast<LPOPENFILENAMEW>(mLpOpenFileName));
+        }
+        return false;
+    }
+
+private:
+    GetFileNameFunc mFunc;
+    void* mLpOpenFileName;
+};
+
 // static
 BOOL WINAPI
 PMCGetFileNameW(GetFileNameFunc aFunc, LPOPENFILENAMEW aLpofn)
 {
     if (!IsPluginThread()) {
-        return PostToPluginThread(aFunc, aLpofn);
+        GetFileNameTaskData gfnData(aFunc, aLpofn);
+        return PostToPluginThread(&gfnData);
     }
 
     PluginModuleChild* chromeInstance = PluginModuleChild::GetChrome();
     if (chromeInstance) {
         bool ret = FALSE;
         OpenFileNameIPC inputOfn;
         inputOfn.CopyFromOfn(aLpofn);
         OpenFileNameRetIPC outputOfn;
@@ -2210,16 +2232,48 @@ PMCGetSaveFileNameW(LPOPENFILENAMEW aLpo
     return PMCGetFileNameW(SAVE_FUNC, aLpofn);
 }
 // static
 BOOL WINAPI
 PMCGetOpenFileNameW(LPOPENFILENAMEW aLpofn)
 {
     return PMCGetFileNameW(OPEN_FUNC, aLpofn);
 }
+
+BOOL WINAPI PMCSetCursorPos(int x, int y);
+
+class SetCursorPosTaskData : public PluginThreadTaskData
+{
+public:
+    SetCursorPosTaskData(int x, int y) : mX(x), mY(y) {}
+    bool RunTask() { return PMCSetCursorPos(mX, mY); }
+private:
+    int mX, mY;
+};
+
+// static
+BOOL WINAPI
+PMCSetCursorPos(int x, int y)
+{
+    if (!IsPluginThread()) {
+        SetCursorPosTaskData scpData(x, y);
+        return PostToPluginThread(&scpData);
+    }
+
+    PluginModuleChild* chromeInstance = PluginModuleChild::GetChrome();
+    if (chromeInstance) {
+        bool ret = FALSE;
+        chromeInstance->CallSetCursorPos(x, y, &ret);
+        return ret;
+    }
+
+    return sSetCursorPosPtrStub(x, y);
+}
+
+
 #endif
 
 PPluginInstanceChild*
 PluginModuleChild::AllocPPluginInstanceChild(const nsCString& aMimeType,
                                              const InfallibleTArray<nsCString>& aNames,
                                              const InfallibleTArray<nsCString>& aValues)
 {
     PLUGIN_LOG_DEBUG_METHOD;
@@ -2242,16 +2296,21 @@ PluginModuleChild::AllocPPluginInstanceC
     }
 
     if ((mQuirks & QUIRK_FLASH_HOOK_GETKEYSTATE) &&
         !sGetKeyStatePtrStub) {
         sUser32Intercept.AddHook("GetKeyState", reinterpret_cast<intptr_t>(PMCGetKeyState),
                                  (void**) &sGetKeyStatePtrStub);
     }
 
+    if (!sSetCursorPosPtrStub) {
+        sUser32Intercept.AddHook("SetCursorPos", reinterpret_cast<intptr_t>(PMCSetCursorPos),
+                                 (void**) &sSetCursorPosPtrStub);
+    }
+
     sComDlg32Intercept.Init("comdlg32.dll");
     if (!sGetSaveFileNameWPtrStub) {
         sComDlg32Intercept.AddHook("GetSaveFileNameW", reinterpret_cast<intptr_t>(PMCGetSaveFileNameW),
                                  (void**) &sGetSaveFileNameWPtrStub);
     }
 
     if (!sGetOpenFileNameWPtrStub) {
         sComDlg32Intercept.AddHook("GetOpenFileNameW", reinterpret_cast<intptr_t>(PMCGetOpenFileNameW),
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -3353,8 +3353,20 @@ PluginModuleChromeParent::AnswerGetFileN
     aOfnIn.FreeOfnStrings(&ofn);
     return IPC_OK();
 #else
     MOZ_ASSERT_UNREACHABLE("GetFileName IPC message is only available on "
                            "Windows builds with sandbox.");
     return IPC_FAIL_NO_REASON(this);
 #endif
 }
+
+mozilla::ipc::IPCResult
+PluginModuleChromeParent::AnswerSetCursorPos(const int &x, const int &y,
+                                             bool* aResult)
+{
+#if defined(XP_WIN)
+    *aResult = ::SetCursorPos(x, y);
+    return IPC_OK();
+#else
+    return PluginModuleParent::AnswerSetCursorPos(x, y, aResult);
+#endif
+}
--- a/dom/plugins/ipc/PluginModuleParent.h
+++ b/dom/plugins/ipc/PluginModuleParent.h
@@ -220,16 +220,22 @@ protected:
     virtual mozilla::ipc::IPCResult
     AnswerGetFileName(const GetFileNameFunc& aFunc,
                       const OpenFileNameIPC& aOfnIn,
                       OpenFileNameRetIPC* aOfnOut, bool* aResult) override
     {
       return IPC_FAIL_NO_REASON(this);
     }
 
+    virtual mozilla::ipc::IPCResult
+    AnswerSetCursorPos(const int &x, const int &y, bool* aResult) override
+    {
+      return IPC_FAIL_NO_REASON(this);
+    }
+
 protected:
     void SetChildTimeout(const int32_t aChildTimeout);
     static void TimeoutChanged(const char* aPref, void* aModule);
 
     virtual void UpdatePluginTimeout() {}
 
     virtual mozilla::ipc::IPCResult RecvNotifyContentModuleDestroyed() override { return IPC_OK(); }
 
@@ -533,16 +539,20 @@ class PluginModuleChromeParent
     AnswerGetKeyState(const int32_t& aVirtKey, int16_t* aRet) override;
 
     // Proxy GetOpenFileName/GetSaveFileName on Windows.
     virtual mozilla::ipc::IPCResult
     AnswerGetFileName(const GetFileNameFunc& aFunc,
                       const OpenFileNameIPC& aOfnIn,
                       OpenFileNameRetIPC* aOfnOut, bool* aResult) override;
 
+    // Proxy SetCursorPos on Windows.
+    virtual mozilla::ipc::IPCResult
+    AnswerSetCursorPos(const int &x, const int &y, bool* aResult) override;
+
 private:
     virtual void
     EnteredCxxStack() override;
 
     void
     ExitedCxxStack() override;
 
     mozilla::ipc::IProtocol* GetInvokingProtocol();
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -3144,17 +3144,18 @@ XMLHttpRequestMainThread::SetRequestHead
   if (!NS_IsValidHTTPToken(aName) || !NS_IsReasonableHTTPHeaderValue(value)) {
     return NS_ERROR_DOM_INVALID_HEADER_NAME;
   }
 
   // Step 5
   bool isPrivilegedCaller = IsSystemXHR();
   bool isForbiddenHeader = nsContentUtils::IsForbiddenRequestHeader(aName);
   if (!isPrivilegedCaller && isForbiddenHeader) {
-    const char16_t* params[] = { NS_ConvertUTF8toUTF16(aName).get() };
+    NS_ConvertUTF8toUTF16 name(aName);
+    const char16_t* params[] = { name.get() };
     LogMessage("ForbiddenHeaderWarning", GetOwner(), params, ArrayLength(params));
     return NS_OK;
   }
 
   // Step 6.1
   // Skipping for now, as normalizing the case of header names may not be
   // web-compatible. See bug 1285036.
 
--- a/ipc/ipdl/sync-messages.ini
+++ b/ipc/ipdl/sync-messages.ini
@@ -770,16 +770,18 @@ description =
 [PPluginModule::GetKeyState]
 description =
 [PPluginModule::NPN_SetValue_NPPVpluginRequiresAudioDeviceChanges]
 description =
 [PPluginModule::InitCrashReporter]
 description =
 [PPluginModule::GetFileName]
 description =
+[PPluginModule::SetCursorPos]
+description =
 [PPluginScriptableObject::NPN_Evaluate]
 description =
 [PPluginScriptableObject::Invalidate]
 description =
 [PPluginScriptableObject::HasMethod]
 description =
 [PPluginScriptableObject::Invoke]
 description =
deleted file mode 100644
--- a/testing/web-platform/meta/XMLHttpRequest/event-readystatechange-loaded.htm.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[event-readystatechange-loaded.htm]
-  type: testharness
-  [XMLHttpRequest: the LOADING state change should only happen once]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/XMLHttpRequest/overridemimetype-invalid-mime-type.htm.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[overridemimetype-invalid-mime-type.htm]
-  type: testharness
-  [XMLHttpRequest: overrideMimeType() in unsent state, invalid MIME types]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/XMLHttpRequest/send-entity-body-document-bogus.htm.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[send-entity-body-document-bogus.htm]
-  type: testharness
-  [XMLHttpRequest: send() - unserializable Document]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/XMLHttpRequest/send-redirect-post-upload.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[send-redirect-post-upload.htm]
-  type: testharness
-  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1290916
rename from testing/web-platform/meta/fullscreen/api/__dir__.ini
rename to testing/web-platform/meta/fullscreen/__dir__.ini
--- a/toolkit/modules/SelectContentHelper.jsm
+++ b/toolkit/modules/SelectContentHelper.jsm
@@ -38,16 +38,18 @@ this.SelectContentHelper = function(aEle
   this.isOpenedViaTouch = aOptions.isOpenedViaTouch;
   this._selectBackgroundColor = null;
   this._selectColor = null;
   this._uaBackgroundColor = null;
   this._uaColor = null;
   this._uaSelectBackgroundColor = null;
   this._uaSelectColor = null;
   this._closeAfterBlur = true;
+  this._pseudoStylesSetup = false;
+  this._lockedDescendants = null;
   this.init();
   this.showDropDown();
   this._updateTimer = new DeferredTask(this._update.bind(this), 0);
 }
 
 Object.defineProperty(SelectContentHelper, "open", {
   get() {
     return gOpen;
@@ -95,74 +97,107 @@ this.SelectContentHelper.prototype = {
     this.mut.disconnect();
     this._updateTimer.disarm();
     this._updateTimer = null;
     gOpen = false;
   },
 
   showDropDown() {
     this.element.openInParentProcess = true;
+    this._setupPseudoClassStyles();
     let rect = this._getBoundingContentRect();
-    DOMUtils.addPseudoClassLock(this.element, ":focus");
     let computedStyles = getComputedStyles(this.element);
     this._selectBackgroundColor = computedStyles.backgroundColor;
     this._selectColor = computedStyles.color;
     this._selectTextShadow = computedStyles.textShadow;
-    DOMUtils.clearPseudoClassLocks(this.element);
     this.global.sendAsyncMessage("Forms:ShowDropDown", {
       direction: computedStyles.direction,
       isOpenedViaTouch: this.isOpenedViaTouch,
       options: this._buildOptionList(),
       rect,
       selectedIndex: this.element.selectedIndex,
       selectBackgroundColor: this._selectBackgroundColor,
       selectColor: this._selectColor,
       selectTextShadow: this._selectTextShadow,
       uaBackgroundColor: this.uaBackgroundColor,
       uaColor: this.uaColor,
       uaSelectBackgroundColor: this.uaSelectBackgroundColor,
       uaSelectColor: this.uaSelectColor
     });
+    this._clearPseudoClassStyles();
     gOpen = true;
   },
 
+  _setupPseudoClassStyles() {
+    if (this._pseudoStylesSetup) {
+      throw new Error("pseudo styles must not be set up yet");
+    }
+    // Do all of the things that change style at once, before we read
+    // any styles.
+    this._pseudoStylesSetup = true;
+    DOMUtils.addPseudoClassLock(this.element, ":focus");
+    let lockedDescendants = this._lockedDescendants = this.element.querySelectorAll(":checked");
+    for (let child of lockedDescendants) {
+      // Selected options have the :checked pseudo-class, which
+      // we want to disable before calculating the computed
+      // styles since the user agent styles alter the styling
+      // based on :checked.
+      DOMUtils.addPseudoClassLock(child, ":checked", false);
+    }
+  },
+
+  _clearPseudoClassStyles() {
+    if (!this._pseudoStylesSetup) {
+      throw new Error("pseudo styles must be set up already");
+    }
+    // Undo all of the things that change style at once, after we're
+    // done reading styles.
+    DOMUtils.clearPseudoClassLocks(this.element);
+    let lockedDescendants = this._lockedDescendants;
+    for (let child of lockedDescendants) {
+      DOMUtils.clearPseudoClassLocks(child);
+    }
+    this._lockedDescendants = null;
+    this._pseudoStylesSetup = false;
+  },
+
   _getBoundingContentRect() {
     return BrowserUtils.getElementBoundingScreenRect(this.element);
   },
 
   _buildOptionList() {
-    DOMUtils.addPseudoClassLock(this.element, ":focus");
-    let result = buildOptionListForChildren(this.element);
-    DOMUtils.clearPseudoClassLocks(this.element);
-    return result;
+    if (!this._pseudoStylesSetup) {
+      throw new Error("pseudo styles must be set up");
+    }
+    return buildOptionListForChildren(this.element);
   },
 
   _update() {
     // The <select> was updated while the dropdown was open.
     // Let's send up a new list of options.
     // Technically we might not need to set this pseudo-class
     // during _update() since the element should organically
     // have :focus, though it is here for belt-and-suspenders.
-    DOMUtils.addPseudoClassLock(this.element, ":focus");
+    this._setupPseudoClassStyles();
     let computedStyles = getComputedStyles(this.element);
     this._selectBackgroundColor = computedStyles.backgroundColor;
     this._selectColor = computedStyles.color;
     this._selectTextShadow = computedStyles.textShadow;
-    DOMUtils.clearPseudoClassLocks(this.element);
     this.global.sendAsyncMessage("Forms:UpdateDropDown", {
       options: this._buildOptionList(),
       selectedIndex: this.element.selectedIndex,
       selectBackgroundColor: this._selectBackgroundColor,
       selectColor: this._selectColor,
       selectTextShadow: this._selectTextShadow,
       uaBackgroundColor: this.uaBackgroundColor,
       uaColor: this.uaColor,
       uaSelectBackgroundColor: this.uaSelectBackgroundColor,
       uaSelectColor: this.uaSelectColor
     });
+    this._clearPseudoClassStyles();
   },
 
   // Determine user agent background-color and color.
   // This is used to skip applying the custom color if it matches
   // the user agent values.
   _calculateUAColors() {
     let dummyOption = this.element.ownerDocument.createElement("option");
     dummyOption.style.setProperty("color", "-moz-comboboxtext", "important");
@@ -339,21 +374,16 @@ function buildOptionListForChildren(node
 
       let textContent =
         tagName == "OPTGROUP" ? child.getAttribute("label")
                               : child.text;
       if (textContent == null) {
         textContent = "";
       }
 
-      // Selected options have the :checked pseudo-class, which
-      // we want to disable before calculating the computed
-      // styles since the user agent styles alter the styling
-      // based on :checked.
-      DOMUtils.addPseudoClassLock(child, ":checked", false);
       let cs = getComputedStyles(child);
 
       let info = {
         index: child.index,
         tagName,
         textContent,
         disabled: child.disabled,
         display: cs.display,
@@ -365,17 +395,13 @@ function buildOptionListForChildren(node
         color: cs.color,
         children: tagName == "OPTGROUP" ? buildOptionListForChildren(child) : []
       };
 
       if (cs.textShadow != "none") {
         info.textShadow = cs.textShadow;
       }
 
-      // We must wait until all computedStyles have been
-      // read before we clear the locks.
-      DOMUtils.clearPseudoClassLocks(child);
-
       result.push(info);
     }
   }
   return result;
 }
--- a/toolkit/xre/test/win/TestDllInterceptor.cpp
+++ b/toolkit/xre/test/win/TestDllInterceptor.cpp
@@ -392,16 +392,30 @@ bool TestSendMessageTimeoutW(void* aFunc
 bool TestProcessCaretEvents(void* aFunc)
 {
   auto patchedProcessCaretEvents =
     reinterpret_cast<WINEVENTPROC>(aFunc);
   patchedProcessCaretEvents(0, 0, 0, 0, 0, 0, 0);
   return true;
 }
 
+bool TestSetCursorPos(void* aFunc)
+{
+  auto patchedSetCursorPos =
+    reinterpret_cast<decltype(&SetCursorPos)>(aFunc);
+  POINT cursorPos;
+  BOOL ok = GetCursorPos(&cursorPos);
+  if (ok) {
+    ok = patchedSetCursorPos(cursorPos.x, cursorPos.y);
+  } else {
+    ok = patchedSetCursorPos(512, 512);
+  }
+  return ok;
+}
+
 static DWORD sTlsIndex = 0;
 
 bool TestTlsAlloc(void* aFunc)
 {
   auto patchedTlsAlloc =
     reinterpret_cast<decltype(&TlsAlloc)>(aFunc);
   sTlsIndex = patchedTlsAlloc();
   return sTlsIndex != TLS_OUT_OF_INDEXES;
@@ -512,16 +526,17 @@ int main()
       TestHook(TestLdrUnloadDll, "ntdll.dll", "LdrUnloadDll") &&
       MaybeTestHook(IsWin8OrLater(), TestLdrResolveDelayLoadedAPI, "ntdll.dll", "LdrResolveDelayLoadedAPI") &&
       MaybeTestHook(!IsWin8OrLater(), TestRtlInstallFunctionTableCallback, "kernel32.dll", "RtlInstallFunctionTableCallback") &&
 #endif
       MaybeTestHook(ShouldTestTipTsf(), TestProcessCaretEvents, "tiptsf.dll", "ProcessCaretEvents") &&
 #ifdef _M_IX86
       TestHook(TestSendMessageTimeoutW, "user32.dll", "SendMessageTimeoutW") &&
 #endif
+      TestHook(TestSetCursorPos, "user32.dll", "SetCursorPos") &&
       TestHook(TestTlsAlloc, "kernel32.dll", "TlsAlloc") &&
       TestHook(TestTlsFree, "kernel32.dll", "TlsFree") &&
 #ifdef _M_IX86
       TestDetour("kernel32.dll", "BaseThreadInitThunk") &&
 #endif
       TestDetour("ntdll.dll", "LdrLoadDll")) {
     printf("TEST-PASS | WindowsDllInterceptor | all checks passed\n");
     return 0;
--- a/xpcom/build/nsWindowsDllInterceptor.h
+++ b/xpcom/build/nsWindowsDllInterceptor.h
@@ -1003,16 +1003,20 @@ protected:
             nTrampBytes = jump.GenerateJump(tramp);
             nOrigBytes += 6;
             foundJmp = true;
           } else {
             // not support yet!
             MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence");
             return;
           }
+        } else if (origBytes[nOrigBytes] == 0x63 &&
+                   (origBytes[nOrigBytes + 1] & kMaskMod) == kModReg) {
+          // movsxd r64, r32 (move + sign extend)
+          COPY_CODES(2);
         } else {
           // not support yet!
           MOZ_ASSERT_UNREACHABLE("Unrecognized opcode sequence");
           return;
         }
       } else if (origBytes[nOrigBytes] == 0x66) {
         // operand override prefix
         COPY_CODES(1);
@@ -1101,18 +1105,18 @@ protected:
         // pop r11 (doesn't affect the flags from the cmp)
         tramp[nTrampBytes] = 0x49;
         ++nTrampBytes;
         tramp[nTrampBytes] = 0x5b;
         ++nTrampBytes;
       } else if (origBytes[nOrigBytes] == 0x90) {
         // nop
         COPY_CODES(1);
-      } else if (origBytes[nOrigBytes] == 0xb8) {
-        // MOV 0xB8: http://ref.x86asm.net/coder32.html#xB8
+      } else if ((origBytes[nOrigBytes] & 0xf8) == 0xb8) {
+        // MOV r32, imm32
         COPY_CODES(5);
       } else if (origBytes[nOrigBytes] == 0x33) {
         // xor r32, r/m32
         COPY_CODES(2);
       } else if (origBytes[nOrigBytes] == 0xf6) {
         // test r/m8, imm8 (used by ntdll on Windows 10 x64)
         // (no flags are affected by near jmp since there is no task switch,
         // so it is ok for a jmp to be written immediately after a test)