From 7d558bcd13591e262ecabd1c8399cfa296ab5187 Mon Sep 17 00:00:00 2001 From: Steven Lee Date: Thu, 8 Nov 2012 14:35:03 -0500 Subject: [PATCH] Bug 808983 - Don't call hal_sandbox::Vibrate when ipc is broken. r=jlebar, a=bajaj --- hal/Hal.cpp | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/hal/Hal.cpp b/hal/Hal.cpp index 1e1ba5274f6c..d317df8b2c77 100644 --- a/hal/Hal.cpp +++ b/hal/Hal.cpp @@ -123,20 +123,17 @@ Vibrate(const nsTArray& pattern, const WindowIdentifier &id) return; } - if (InSandbox()) { - hal_sandbox::Vibrate(pattern, id); - } - else { - if (!gLastIDToVibrate) + if (!InSandbox()) { + if (!gLastIDToVibrate) { InitLastIDToVibrate(); + } *gLastIDToVibrate = id.AsArray(); - - HAL_LOG(("Vibrate: Forwarding to hal_impl.")); - - // hal_impl doesn't need |id|. Send it an empty id, which will - // assert if it's used. - hal_impl::Vibrate(pattern, WindowIdentifier()); } + + // Don't forward our ID if we are not in the sandbox, because hal_impl + // doesn't need it, and we don't want it to be tempted to read it. The + // empty identifier will assert if it's used. + PROXY_IF_SANDBOXED(Vibrate(pattern, InSandbox() ? id : WindowIdentifier())); } void @@ -167,15 +164,11 @@ CancelVibrate(const WindowIdentifier &id) // to start a vibration, and only accepts cancellation requests from // the same window. All other cancellation requests are ignored. - if (InSandbox()) { - hal_sandbox::CancelVibrate(id); - } - else if (gLastIDToVibrate && *gLastIDToVibrate == id.AsArray()) { - // Don't forward our ID to hal_impl. It doesn't need it, and we - // don't want it to be tempted to read it. The empty identifier - // will assert if it's used. - HAL_LOG(("CancelVibrate: Forwarding to hal_impl.")); - hal_impl::CancelVibrate(WindowIdentifier()); + if (InSandbox() || (gLastIDToVibrate && *gLastIDToVibrate == id.AsArray())) { + // Don't forward our ID if we are not in the sandbox, because hal_impl + // doesn't need it, and we don't want it to be tempted to read it. The + // empty identifier will assert if it's used. + PROXY_IF_SANDBOXED(CancelVibrate(InSandbox() ? id : WindowIdentifier())); } }