Bug 880317 - Don't use nsIDOMDocument in nsScreen; r=mounir
authorMs2ger <ms2ger@gmail.com>
Wed, 12 Jun 2013 08:48:15 +0200
changeset 146192 7041298aa8d9c07525481aec49fd4009abff4b4c
parent 146191 cc35f8929768bf4bf2d9e2f824c8553ae3863d67
child 146193 03c9edd7ea174b28afbfb9fb26b5767e056b62c0
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir
bugs880317
milestone24.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 880317 - Don't use nsIDOMDocument in nsScreen; r=mounir
dom/base/nsScreen.cpp
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -219,34 +219,29 @@ nsScreen::GetLockOrientationPermission()
     return LOCK_DENIED;
   }
 
   // Chrome can always lock the screen orientation.
   if (IsChromeType(owner->GetDocShell())) {
     return LOCK_ALLOWED;
   }
 
-  nsCOMPtr<nsIDOMDocument> domDoc;
-  owner->GetDocument(getter_AddRefs(domDoc));
-  nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
+  nsCOMPtr<nsIDocument> doc = owner->GetDoc();
   if (!doc || doc->Hidden()) {
     return LOCK_DENIED;
   }
 
   // Apps can always lock the screen orientation.
   if (doc->NodePrincipal()->GetAppStatus() >=
         nsIPrincipal::APP_STATUS_INSTALLED) {
     return LOCK_ALLOWED;
   }
 
   // Other content must be full-screen in order to lock orientation.
-  bool fullscreen;
-  domDoc->GetMozFullScreen(&fullscreen);
-
-  return fullscreen ? FULLSCREEN_LOCK_ALLOWED : LOCK_DENIED;
+  return doc->MozFullScreen() ? FULLSCREEN_LOCK_ALLOWED : LOCK_DENIED;
 }
 
 NS_IMETHODIMP
 nsScreen::MozLockOrientation(const JS::Value& aOrientation, JSContext* aCx,
                              bool* aReturn)
 {
   if (aOrientation.isObject()) {
     JS::Rooted<JSObject*> seq(aCx, &aOrientation.toObject());
@@ -408,25 +403,25 @@ nsScreen::FullScreenEventListener::Handl
 #ifdef DEBUG
   nsAutoString eventType;
   aEvent->GetType(eventType);
 
   MOZ_ASSERT(eventType.EqualsLiteral("mozfullscreenchange"));
 #endif
 
   nsCOMPtr<EventTarget> target = aEvent->InternalDOMEvent()->GetCurrentTarget();
-  nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(target);
-  MOZ_ASSERT(target && doc);
+  MOZ_ASSERT(target);
+
+  nsCOMPtr<nsIDocument> doc = do_QueryInterface(target);
+  MOZ_ASSERT(doc);
 
   // We have to make sure that the event we got is the event sent when
   // fullscreen is disabled because we could get one when fullscreen
   // got enabled if the lock call is done at the same moment.
-  bool fullscreen;
-  doc->GetMozFullScreen(&fullscreen);
-  if (fullscreen) {
+  if (doc->MozFullScreen()) {
     return NS_OK;
   }
 
   target->RemoveSystemEventListener(NS_LITERAL_STRING("mozfullscreenchange"),
                                     this, true);
 
   hal::UnlockScreenOrientation();