On Tue, Apr 10, 2012 at 4:59 PM, Lucas Adamski <
lada...@mozilla.com> wrote:
> Here's the first API up for discussion. This should be pretty straightforward so I hope to close out this discussion by
> end of day Thursday (PDT).
>
> I'd like to keep this discussion on mozilla.dev.webapps, but I'll take responses on other lists over silence. :)
>
> Name of API: Screen Orientation
> Reference: bug 720794 bug 673922
>
> Brief purpose of API: Get notification when screen orientation changes as well as lock the screen orientation
>
> Inherent threats: minor information leakage (device orientation), minor user inconvenience (lock device orientation)
>
> Threat severity: low per
https://wiki.mozilla.org/Security_Severity_Ratings
>
> == Regular web content (unauthenticated) ==
> Use cases for unauthenticated code: Prevent screen orientation from changing when playing a game utilizing device motion
I'd also add: Switch screen orientation when switching between
different parts of an app. For example when switching from UI to
browse lists of videos, to UI which plays a specific video. Or
switching orientation between people facing one another playing a game
on the device.
> Authorization model for normal content: implicit for detecting orientation, explicit runtime for locking orientation
I'm not sure what "explicit runtime for locking" entails here. I don't
think we want an explicit prompt when the page requests that the
orientation be locked in a particular direction. Basically it seems to
me that prompting the user for something as "trivial" as screen
orientation (which you can basically do by simply rendering your text
sideways anyway) would just lead to "prompt fatigue" with users.
> Authorization model for installed content: implicit for both
Agreed. For an installed application you can always exit the
application by closing it (this should be true on both mobile and
desktop). So the page can't really DoS the user by continuously
switching the screen orientation.
> Potential mitigations: Orientation should remained locked only while focused.
I think we might need more than that, especially since I'd prefer to
not have an explicit ask-for-permission prompt for screen locks, even
for uninstalled apps. What I propose is this:
1. Orientation locks only affect the locked app/page. If the user
switches tab or app, the other pages aren't affected.
2. If the page is installed content, always allow the orientation lock.
3. If the page is in fullscreen mode, always allow the orientation
lock. There is no browser UI being displayed anyway and so the page
could cause the same behavior by simply rendering text sideways. Need
to verify that this will work on mobile.
4. If the page isn't in fullscreen mode, and is contained in an
<iframe> (or <frame>) never allow the lock request.
4. If the call to lock the screen orientation happens in response to a
user action, always allow the orientation lock.
5. If the call to lock the screen orientation doesn't actually require
the screen to be immediately re-orientated, always allow the
orientation lock.
6. If no other calls to change the lock orientation has happened in
the last X (say 5) seconds, allow the orientation lock. This is mostly
to cover the case of the page setting its lock during initial page
setup.
We could potentially skip rule 5 since it doesn't actually solve any
real problems, and might just be confusing to developers. The other
rules should be enough to allow all sanely written code to "just
work".
> == Trusted (authenticated by publisher) ==
> == Certified (vouched for by trusted 3rd party) ==
For the sake of simplicity for page authors, I think I would prefer to
keep these two the same as the unauthenticated. I agree that we could
relax constraints here, but I think that would cause more confusion
than it would add value. And for now these two groups consist of
installed content only, which basically means full rights to the API.
/ Jonas