Bug 1285802 - Always add listener when orientation locked. r=wchen
authorjwu <topwu.tw@gmail.com>
Tue, 27 Dec 2016 11:23:01 +0800
changeset 329532 b706ca522fdd409bbc055512fa52d27e0118a3ac
parent 329531 393ac0555624cf2e335a45fff3812e9badf32d05
child 329533 224be03d946cbc71ae3b667e4b40b43cefb01656
push id31213
push usercbook@mozilla.com
push dateMon, 16 Jan 2017 15:34:36 +0000
treeherdermozilla-central@aeda115ca5c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswchen
bugs1285802
milestone53.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 1285802 - Always add listener when orientation locked. r=wchen When remove fullscreenchange listener, mFullScreenListener doesn't assign to nullptr. But the listener only been added when mFullScreenListener is null. MozReview-Commit-ID: 1qn72ix7z9Q
dom/base/ScreenOrientation.cpp
--- a/dom/base/ScreenOrientation.cpp
+++ b/dom/base/ScreenOrientation.cpp
@@ -363,18 +363,21 @@ ScreenOrientation::LockDeviceOrientation
     return false;
   }
 
   if (NS_WARN_IF(!hal::LockScreenOrientation(aOrientation))) {
     return false;
   }
 
   // We are fullscreen and lock has been accepted.
-  if (aIsFullScreen && !mFullScreenListener) {
-    mFullScreenListener = new FullScreenEventListener();
+  if (aIsFullScreen) {
+    if (!mFullScreenListener) {
+      mFullScreenListener = new FullScreenEventListener();
+    }
+
     aRv = target->AddSystemEventListener(NS_LITERAL_STRING("fullscreenchange"),
                                          mFullScreenListener, /* useCapture = */ true);
     if (NS_WARN_IF(aRv.Failed())) {
       return false;
     }
   }
 
   return true;