Bug 740192 - Screen orientation needs a specific security model for installed web apps. r=jlebar

This commit is contained in:
Mounir Lamouri 2012-05-10 17:49:34 -07:00
parent 18041509b8
commit 38e33bedc8

View File

@ -45,6 +45,7 @@
#include "nsIDocShellTreeItem.h"
#include "nsLayoutUtils.h"
#include "nsDOMEvent.h"
#include "nsGlobalWindow.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -381,11 +382,15 @@ nsScreen::MozLockOrientation(const nsAString& aOrientation, bool* aReturn)
return NS_OK;
}
bool fullscreen;
doc->GetMozFullScreen(&fullscreen);
if (!fullscreen) {
*aReturn = false;
return NS_OK;
// Apps and frames contained in apps can lock orientation.
// But non-apps can lock orientation only if they're fullscreen.
if (!static_cast<nsGlobalWindow*>(GetOwner())->IsPartOfApp()) {
bool fullscreen;
doc->GetMozFullScreen(&fullscreen);
if (!fullscreen) {
*aReturn = false;
return NS_OK;
}
}
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetOwner());