Backed out changeset 83f811be5016 (bug 1207221) for B2G JB emulator bustage due to warning

This commit is contained in:
Nigel Babu 2015-11-13 16:01:26 +05:30
parent c9bfcbb7b1
commit 090ffeb7cf
2 changed files with 6 additions and 16 deletions

View File

@ -774,25 +774,13 @@ NS_IMPL_ISUPPORTS(VibrateWindowListener, nsIDOMEventListener)
StaticRefPtr<VibrateWindowListener> gVibrateWindowListener;
static bool
MayVibrate(nsIDocument* doc) {
#if MOZ_WIDGET_GONK
if (XRE_IsParentProcess()) {
return true; // The system app can always vibrate
}
#endif // MOZ_WIDGET_GONK
// Hidden documents cannot start or stop a vibration.
return (doc && !doc->Hidden());
}
NS_IMETHODIMP
VibrateWindowListener::HandleEvent(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDocument> doc =
do_QueryInterface(aEvent->InternalDOMEvent()->GetTarget());
if (!MayVibrate(doc)) {
if (!doc || doc->Hidden()) {
// It's important that we call CancelVibrate(), not Vibrate() with an
// empty list, because Vibrate() will fail if we're no longer focused, but
// CancelVibrate() will succeed, so long as nobody else has started a new
@ -865,8 +853,12 @@ Navigator::Vibrate(const nsTArray<uint32_t>& aPattern)
}
nsCOMPtr<nsIDocument> doc = mWindow->GetExtantDoc();
if (!doc) {
return false;
}
if (!MayVibrate(doc)) {
if (doc->Hidden()) {
// Hidden documents cannot start or stop a vibration.
return false;
}

View File

@ -124,7 +124,6 @@ Vibrate(const nsTArray<uint32_t>& pattern, const WindowIdentifier &id)
{
AssertMainThread();
#if !defined(MOZ_WIDGET_GONK)
// Only active windows may start vibrations. If |id| hasn't gone
// through the IPC layer -- that is, if our caller is the outside
// world, not hal_proxy -- check whether the window is active. If
@ -135,7 +134,6 @@ Vibrate(const nsTArray<uint32_t>& pattern, const WindowIdentifier &id)
HAL_LOG("Vibrate: Window is inactive, dropping vibrate.");
return;
}
#endif // !defined(MOZ_WIDGET_GONK)
if (!InSandbox()) {
if (!gLastIDToVibrate) {