Backed out changeset c3813936e074 (bug 1589913) for mochitest assertion failures at nsGlobalWindowInner.cpp. CLOSED TREE
authorBrindusan Cristian <cbrindusan@mozilla.com>
Wed, 06 Nov 2019 02:42:43 +0200
changeset 500770 fb5acb145e6a25da801d0fef0ad58361cc5b8ac5
parent 500769 5eaefee2f30d79446a86a325d51095fa6e022399
child 500771 17bd8eb45ebddd62f5aad6e0755ceb92795ce60a
push id114166
push userapavel@mozilla.com
push dateThu, 07 Nov 2019 10:04:01 +0000
treeherdermozilla-inbound@d271c572a9bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1589913
milestone72.0a1
backs outc3813936e0745b02bd1e5e4c6c1ac10e74e2f445
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 c3813936e074 (bug 1589913) for mochitest assertion failures at nsGlobalWindowInner.cpp. CLOSED TREE
browser/fxr/content/fxrui.js
dom/base/Navigator.cpp
dom/base/Navigator.h
dom/base/nsGlobalWindowInner.cpp
dom/ipc/BrowserParent.cpp
dom/ipc/BrowserParent.h
dom/ipc/PBrowser.ipdl
gfx/vr/nsFxrCommandLineHandler.cpp
--- a/browser/fxr/content/fxrui.js
+++ b/browser/fxr/content/fxrui.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
  * 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/. */
 
 /* import-globals-from common.js */
 
 // Configuration vars
-let homeURL = "https://webxr.today/";
+let homeURL = "https://www.mozilla.org/en-US/";
 // Bug 1586294 - Localize the privacy policy URL (Services.urlFormatter?)
 let privacyPolicyURL = "https://www.mozilla.org/en-US/privacy/firefox/";
 let reportIssueURL = "https://mzl.la/fxr";
 let licenseURL =
   "https://mixedreality.mozilla.org/FirefoxRealityPC/license.html";
 
 // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/browser
 let browser = null;
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -1397,18 +1397,17 @@ Promise* Navigator::Share(const ShareDat
     text.Assign(NS_ConvertUTF16toUTF8(aData.mText.Value()));
   } else {
     text.SetIsVoid(true);
   }
 
   // The spec does the "triggered by user activation" after the data checks.
   // Unfortunately, both Chrome and Safari behave this way, so interop wins.
   // https://github.com/w3c/web-share/pull/118
-  if (StaticPrefs::dom_webshare_requireinteraction() &&
-      !UserActivation::IsHandlingUserInput()) {
+  if (StaticPrefs::dom_webshare_requireinteraction() && !UserActivation::IsHandlingUserInput()) {
     NS_WARNING("Attempt to share not triggered by user activation");
     aRv.Throw(NS_ERROR_DOM_NOT_ALLOWED_ERR);
     return nullptr;
   }
 
   // Let mSharePromise be a new promise.
   mSharePromise = Promise::Create(mWindow->AsGlobal(), aRv);
   if (aRv.Failed()) {
@@ -1484,73 +1483,27 @@ already_AddRefed<Promise> Navigator::Get
   nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
   win->NotifyVREventListenerAdded();
 
   RefPtr<Promise> p = Promise::Create(mWindow->AsGlobal(), aRv);
   if (aRv.Failed()) {
     return nullptr;
   }
 
-  RefPtr<BrowserChild> browser(BrowserChild::GetFrom(mWindow));
-  if (!browser) {
-    MOZ_ASSERT(XRE_IsParentProcess());
-    FinishGetVRDisplays(true, p);
-  } else {
-    RefPtr<Navigator> self(this);
-    int browserID = browser->ChromeOuterWindowID();
-
-    browser->SendIsWindowSupportingWebVR(browserID)->Then(
-        GetCurrentThreadSerialEventTarget(), __func__,
-        [self, p](bool isSupported) {
-          self->FinishGetVRDisplays(isSupported, p);
-        },
-        [](const mozilla::ipc::ResponseRejectReason) {
-          MOZ_CRASH("Failed to make IPC call to IsWindowSupportingWebVR");
-        });
+  // We pass mWindow's id to RefreshVRDisplays, so NotifyVRDisplaysUpdated will
+  // be called asynchronously, resolving the promises in mVRGetDisplaysPromises.
+  if (!VRDisplay::RefreshVRDisplays(win->WindowID())) {
+    p->MaybeReject(NS_ERROR_FAILURE);
+    return p.forget();
   }
 
+  mVRGetDisplaysPromises.AppendElement(p);
   return p.forget();
 }
 
-void Navigator::FinishGetVRDisplays(bool isWebVRSupportedInwindow, Promise* p) {
-  if (isWebVRSupportedInwindow) {
-    nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow);
-
-    // Since FinishGetVRDisplays can be called asynchronously after an IPC
-    // response, it's possible that the Window can be torn down before this
-    // call. In that case, the Window's cyclic references to VR objects are
-    // also torn down and should not be recreated via
-    // NotifyVREventListenerAdded.
-    if (!win->IsDying()) {
-      win->NotifyVREventListenerAdded();
-      // We pass mWindow's id to RefreshVRDisplays, so
-      // NotifyVRDisplaysUpdated will be called asynchronously, resolving
-      // the promises in mVRGetDisplaysPromises.
-      if (!VRDisplay::RefreshVRDisplays(win->WindowID())) {
-        // Failed to refresh, reject the promise now
-        p->MaybeRejectWithTypeError(u"Failed to find attached VR displays.");
-      } else {
-        // Succeeded, so cache the promise to resolve later
-        mVRGetDisplaysPromises.AppendElement(p);
-      }
-    } else {
-      // The Window has been torn down, so there is no further work that can
-      // be done.
-      p->MaybeRejectWithTypeError(
-          u"Unable to return VRDisplays for a closed window.");
-    }
-  } else {
-    // WebVR in this window is not supported, so resolve the promise
-    // with no displays available
-    nsTArray<RefPtr<VRDisplay>> vrDisplaysEmpty;
-    p->MaybeResolve(vrDisplaysEmpty);
-  }
-  mVRGetDisplaysPromises.AppendElement(p);
-}
-
 void Navigator::GetActiveVRDisplays(
     nsTArray<RefPtr<VRDisplay>>& aDisplays) const {
   /**
    * Get only the active VR displays.
    * GetActiveVRDisplays should only enumerate displays that
    * are already active without causing any other hardware to be
    * activated.
    * We must not call nsGlobalWindow::NotifyVREventListenerAdded here,
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -174,17 +174,16 @@ class Navigator final : public nsISuppor
 
   already_AddRefed<LegacyMozTCPSocket> MozTCPSocket();
   network::Connection* GetConnection(ErrorResult& aRv);
   MediaDevices* GetMediaDevices(ErrorResult& aRv);
 
   void GetGamepads(nsTArray<RefPtr<Gamepad>>& aGamepads, ErrorResult& aRv);
   GamepadServiceTest* RequestGamepadServiceTest();
   already_AddRefed<Promise> GetVRDisplays(ErrorResult& aRv);
-  void FinishGetVRDisplays(bool isWebVRSupportedInwindow, Promise* p);
   void GetActiveVRDisplays(nsTArray<RefPtr<VRDisplay>>& aDisplays) const;
   VRServiceTest* RequestVRServiceTest();
   bool IsWebVRContentDetected() const;
   bool IsWebVRContentPresenting() const;
   void RequestVRPresentation(VRDisplay& aDisplay);
   already_AddRefed<Promise> RequestMIDIAccess(const MIDIOptions& aOptions,
                                               ErrorResult& aRv);
 
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -4087,17 +4087,16 @@ void nsGlobalWindowInner::DisableGamepad
     RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
     if (gamepadManager) {
       gamepadManager->RemoveListener(this);
     }
   }
 }
 
 void nsGlobalWindowInner::EnableVRUpdates() {
-  MOZ_ASSERT(!IsDying());
   if (mHasVREvents && !mVREventObserver) {
     mVREventObserver = new VREventObserver(this);
     nsPIDOMWindowOuter* outer = GetOuterWindow();
     if (outer && !outer->IsBackground()) {
       mVREventObserver->StartActivity();
     }
   }
 }
--- a/dom/ipc/BrowserParent.cpp
+++ b/dom/ipc/BrowserParent.cpp
@@ -3991,24 +3991,10 @@ mozilla::ipc::IPCResult BrowserParent::R
   aResolve(!isFxrWindow);
 #else
   MOZ_CRASH("Should only be called on Windows");
 #endif
 
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult BrowserParent::RecvIsWindowSupportingWebVR(
-    const uint64_t& aOuterWindowID,
-    IsWindowSupportingWebVRResolver&& aResolve) {
-#ifdef XP_WIN
-  bool isFxrWindow =
-      FxRWindowManager::GetInstance()->IsFxRWindow(aOuterWindowID);
-  aResolve(!isFxrWindow);
-#else
-  aResolve(true);
-#endif
-
-  return IPC_OK();
-}
-
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/ipc/BrowserParent.h
+++ b/dom/ipc/BrowserParent.h
@@ -502,20 +502,16 @@ class BrowserParent final : public PBrow
       PBrowserBridgeParent* aActor, const nsString& aPresentationURL,
       const nsString& aRemoteType, BrowsingContext* aBrowsingContext,
       const uint32_t& aChromeFlags, const TabId& aTabId) override;
 
   mozilla::ipc::IPCResult RecvIsWindowSupportingProtectedMedia(
       const uint64_t& aOuterWindowID,
       IsWindowSupportingProtectedMediaResolver&& aResolve);
 
-  mozilla::ipc::IPCResult RecvIsWindowSupportingWebVR(
-      const uint64_t& aOuterWindowID,
-      IsWindowSupportingWebVRResolver&& aResolve);
-
   void LoadURL(nsIURI* aURI);
 
   void ResumeLoad(uint64_t aPendingSwitchID);
 
   void InitRendering();
   bool AttachLayerManager();
   void MaybeShowFrame();
 
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -1030,21 +1030,16 @@ child:
     async SkipBrowsingContextDetach() returns (bool success);
 
 parent:
     /**
      * Fetches whether this window supports protected media, which is sent back in response.
      */
     async IsWindowSupportingProtectedMedia(uint64_t aOuterWindowID) returns(bool isSupported);
 
-    /**
-    * Fetches whether this window supports WebVR, which is sent back in response.
-    */
-    async IsWindowSupportingWebVR(uint64_t aOuterWindowID) returns(bool isSupported);
-
     /** Records a history visit. */
     async VisitURI(URIParams aURI, URIParams? aLastVisitedURI,
                    uint32_t aFlags);
 
     /** Fetches the visited status for an array of URIs (Android-only). */
     async QueryVisitedState(URIParams[] aURIs);
 
     /**
--- a/gfx/vr/nsFxrCommandLineHandler.cpp
+++ b/gfx/vr/nsFxrCommandLineHandler.cpp
@@ -60,20 +60,16 @@ NS_IMPL_ISUPPORTS(nsFxrCommandLineHandle
 //      ...                       ...                     ...
 
 NS_IMETHODIMP
 nsFxrCommandLineHandler::Handle(nsICommandLine* aCmdLine) {
   bool handleFlagRetVal = false;
   nsresult result =
       aCmdLine->HandleFlag(NS_LITERAL_STRING("fxr"), false, &handleFlagRetVal);
   if (result == NS_OK && handleFlagRetVal) {
-    if (XRE_IsParentProcess() && !XRE_IsE10sParentProcess()) {
-      MOZ_CRASH("--fxr not supported without e10s");
-    }
-
     aCmdLine->SetPreventDefault(true);
 
     nsCOMPtr<nsIWindowWatcher> wwatch =
         do_GetService(NS_WINDOWWATCHER_CONTRACTID);
     NS_ENSURE_TRUE(wwatch, NS_ERROR_FAILURE);
 
     nsCOMPtr<mozIDOMWindowProxy> newWindow;
     result = wwatch->OpenWindow(nullptr,                            // aParent