> First off, why put the requestWakeLock and wakeLockIsHeld functions on separate objects?
The idea is: requestWakeLock is called by relatively unprivileged content (apps), but wakeLockIsHeld is called only by super-privileged content (gaia). The super-privileged API encompasses wakeLockIsHeld, reboot(), shutDown(), turning the screen on/off, modifying the screen's brightness... Putting the super-privileged API on one object makes the security model clearer.
> First off, why put the requestWakeLock and wakeLockIsHeld functions on separate objects?
The idea is: requestWakeLock is called by relatively unprivileged content (apps), but wakeLockIsHeld is called only by super-privileged content (gaia). The super-privileged API encompasses wakeLockIsHeld, reboot(), shutDown(), turning the screen on/off, modifying the screen's brightness... Putting the super-privileged API on one object makes the security model clearer.