Closed Bug 550410 Opened 15 years ago Closed 15 years ago

Provide preference to disable accelerometer.

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking1.9.2 --- -
status1.9.2 --- .4-fixed

People

(Reporter: dougt, Assigned: dougt)

References

Details

Attachments

(1 file)

Introduced in Gecko 1.9.2, we expose device orientation.  We should provide a preference to disable this feature.
Attached patch patch v.1Splinter Review
Attachment #430531 - Flags: review?(dveditz)
Comment on attachment 430531 [details] [diff] [review]
patch v.1

> // Initialize default render-mode.
> pref("mozilla.widget.render-mode", -1);
> 
> // Enable/Disable the geolocation API for content
> pref("geo.enabled", true);
> 
>+// Enable/Disable the orientation API for content
>+pref("accelerometer.enabled", true);

I don't feel strongly about it, but better pref namespacing could prevent future clashes. I'm more worried about the generic "geo." than the one you're actually adding here. It seems like both of those belong under the same root. Dunno if that's some dom. or other platform-like name, or generic mozilla. as in the widget case above.

>+    PRBool bvalue;
>+    rv = prefSrv->GetBoolPref("accelerometer.enabled", &bvalue);
>+    if (NS_SUCCEEDED(rv) && bvalue == PR_FALSE)
>+      mEnabled = PR_FALSE;
>   }

Slightly simpler to do

   rv = prefSrv->GetBoolPref("accelerometer.enabled", &bvalue);
   if (NS_SUCCEEDED(rv))
     mEnabled = bvalue;

or even more middleman removal (at the cost of readability):

    if (NS_SUCCEEDED(prefSrv->GetBoolPref("accelerometer.enabled". &bvalue)))
      mEnabled = bvalue;

I guess you're not in code where you can use nsContentUtils::GetBoolPref()?

    mEnabled = nsContentUtils::GetBoolPref("accelerometer.enabled", PR_TRUE);

All in the nature of nits, change them or not if you wish. r=dveditz
Attachment #430531 - Flags: review?(dveditz) → review+
Attachment #430531 - Flags: approval1.9.2.3?
blocking1.9.2: --- → ?
Not blocking, but I bet we'll take the patch. It can haz tests?
blocking1.9.2: ? → -
no automated tests.  our testing hardware doesn't have accelerometers.  We should add a litmus test though.
Flags: in-litmus?
Comment on attachment 430531 [details] [diff] [review]
patch v.1

Approved for 1.9.2.3, a=dveditz
Attachment #430531 - Flags: approval1.9.2.3? → approval1.9.2.3+
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/45a5b2dfb738
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Depends on: 560274
Assignee: nobody → doug.turner
Flags: in-litmus?
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: