Closed Bug 863704 Opened 8 years ago Closed 8 years ago

Implement a way to make global constructors/navigator properties pref controlled

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: reuben, Assigned: reuben)

Details

Attachments

(1 file)

We have APIs that have been created with B2G in mind, but we keep them around in Firefox so we can have the test coverage. On the other hand, we don't want those APIs to be available in release builds, for a bunch of reasons. We found security problems that happen in the single process scenario, and most of them don't work at all in desktop, so there's no reason for them to be available.

For (at least) the Contacts and Settings API, we have the problem that to properly disable API, we need to conditionally make components available as navigator properties or global constructors. In this bug I want to add the ability to disable categories from being added with a specially named pref. I chose dom.(navigator-property|global-constructor).disable.{categoryEntry}, but that can easily be changed.
Attachment #739568 - Flags: review?(jst)
Attachment #739568 - Flags: review?(jst) → review?(mrbkap)
Comment on attachment 739568 [details] [diff] [review]
Make global-constructor and navigator-property categories pref-controlled

r=jst (sorry for the delay, was out on vacation)
Attachment #739568 - Flags: review?(mrbkap) → review+
Comment on attachment 739568 [details] [diff] [review]
Make global-constructor and navigator-property categories pref-controlled

>+    if (Preferences::GetType(prefName.get()) == nsIPrefBranch::PREF_BOOL &&
>+        Preferences::GetBool(prefName.get(), false)) {
Nit: don't need to check the type, GetBool will just return the default value in that case.
https://hg.mozilla.org/mozilla-central/rev/7d40860eed2a
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.