Closed Bug 1148740 Opened 10 years ago Closed 9 years ago

navigator.mozPower.powerOff(); doesn't work on real device

Categories

(Firefox OS Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: aitzol76, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0 Build ID: 20150320202338 Steps to reproduce: I'm trying to test an application using "PowerManagement" API, specifically with the "powerOff" method. This API requires "power" permission and "certified" type apps specified in the webapp.manifest file. I also correctly configure my device following this link https://developer.mozilla.org/en-US/docs/Tools/WebIDE Actual results: I want to shutdown my device using this code: - var power = navigator.mozPower; power.powerOff(); - unfortunately only works on WebIDE simulator and B2G Desktop, not in FFOS 2.0 device. Why my device doesn't turn off? What am I doing wrong? My app fails saying: "app just crushed"
Which device did you experience this on?
I'm testing a Geeksphone Peak; At this moment with FFOS 2.0.
I don't think it's device related. I experience the same error. In gaia 2.2 gecko 37 Hi Wesly, Can you help to push a little bit?
Flags: needinfo?(wehuang)
Hi Gabriele: Not sure do you think the information in comment#0 is enough for trouble shooting? Since it works in simulator I assume the way they use API should be correct, or anything need specially take care when go w/ real device?
Flags: needinfo?(wehuang) → needinfo?(gsvelto)
Yes, Just want it work in Real device.
I've investigated this a bit and it turns out that what you're seeing is actually expected behavior. Calling navigator.mozPower.powerOff() from a content app is explicitly blocked in the HAL implementation, see here: http://hg.mozilla.org/mozilla-central/file/cef11c3e86c3/hal/sandbox/SandboxHal.cpp#l255 I wasn't a peer of the HAL module when this decision was made so I don't know the rationale behind it (I assume it's a security measure) but if we have a valid use-case we might re-evaluate it. What is your complete use case? I.e. what are you trying to achieve in your app that requires turning off the phone?
Flags: needinfo?(gsvelto) → needinfo?(aitzol76)
Well understood. Thanks!
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Flags: needinfo?(aitzol76)
You need to log in before you can comment on or make changes to this bug.