Bug 862353 - Only enable mozContacts in B2G and mochitests. r=gwagner

--HG--
extra : rebase_source : 914bd36790ae01f83c3f84817b2021f0f7dbcf22
This commit is contained in:
Reuben Morais 2013-05-13 18:32:03 -07:00
parent 553eb397ff
commit 7ddc7e000e
8 changed files with 28 additions and 97 deletions

View File

@ -385,6 +385,8 @@ pref("dom.sms.requestStatusReport", true); // Enabled by default.
// Temporary permission hack for WebContacts
pref("dom.mozContacts.enabled", true);
pref("dom.navigator-property.disable.mozContacts", false);
pref("dom.global-constructor.disable.mozContact", false);
// WebAlarms
pref("dom.mozAlarms.enabled", true);

View File

@ -18,8 +18,8 @@ contract @mozilla.org/contactFindOptions;1 {28ce07d0-45d9-4b7a-8843-521df4edd8bc
component {72a5ee28-81d8-4af8-90b3-ae935396cc66} ContactManager.js
contract @mozilla.org/contact;1 {72a5ee28-81d8-4af8-90b3-ae935396cc66}
category JavaScript-global-constructor-maybe dom.mozContacts.enabled mozContact,@mozilla.org/contact;1
category JavaScript-global-constructor mozContact @mozilla.org/contact;1
component {7bfb6481-f946-4254-afc5-d7fe9f5c45a3} ContactManager.js
contract @mozilla.org/contactManager;1 {7bfb6481-f946-4254-afc5-d7fe9f5c45a3}
category JavaScript-navigator-property-maybe dom.mozContacts.enabled mozContacts,@mozilla.org/contactManager;1
category JavaScript-navigator-property mozContacts @mozilla.org/contactManager;1

View File

@ -21,14 +21,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=674720
"use strict";
// this shouldn't be necessary when bug 792594 is fixed
if (!SpecialPowers.getBoolPref("dom.mozContacts.enabled")) {
ok(!("mozContacts" in navigator), "navigator.mozContacts is not exposed");
ok(!("mozContact" in window), "mozContact is not exposed");
var comp = SpecialPowers.wrap(SpecialPowers.Components);
comp.utils.import("resource://gre/modules/ContactService.jsm");
comp.utils.import("resource://gre/modules/PermissionPromptHelper.jsm");
SpecialPowers.setBoolPref("dom.mozContacts.enabled", true);
if (SpecialPowers.isMainProcess()) {
SpecialPowers.Cu.import("resource://gre/modules/ContactService.jsm");
SpecialPowers.Cu.import("resource://gre/modules/PermissionPromptHelper.jsm");
}
SpecialPowers.addPermission("contacts-write", true, document);
@ -241,8 +236,6 @@ function checkContacts(contact1, contact2) {
}
}
function tests() {
var req;
var index = 0;
@ -1437,21 +1430,8 @@ function next() {
index += 1;
}
function permissionTest() {
if (gContactsEnabled) {
next();
} else {
is(mozContacts, null, "mozContacts is null when not enabled.");
SimpleTest.finish();
}
}
permissionTest();
};
var gContactsEnabled = SpecialPowers.getBoolPref("dom.mozContacts.enabled");
addLoadEvent(tests);
SimpleTest.waitForExplicitFinish();
addLoadEvent(next);
</script>
</pre>
</body>

View File

@ -21,12 +21,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=674720
"use strict";
// this shouldn't be necessary when bug 792594 is fixed
if (!SpecialPowers.getBoolPref("dom.mozContacts.enabled")) {
var comp = SpecialPowers.wrap(SpecialPowers.Components);
comp.utils.import("resource://gre/modules/ContactService.jsm");
comp.utils.import("resource://gre/modules/PermissionPromptHelper.jsm");
SpecialPowers.setBoolPref("dom.mozContacts.enabled", true);
if (SpecialPowers.isMainProcess()) {
SpecialPowers.Cu.import("resource://gre/modules/ContactService.jsm");
SpecialPowers.Cu.import("resource://gre/modules/PermissionPromptHelper.jsm");
}
SpecialPowers.addPermission("contacts-write", true, document);
@ -35,8 +32,6 @@ SpecialPowers.addPermission("contacts-create", true, document);
var utils = SpecialPowers.getDOMWindowUtils(window);
function tests() {
function getView(size)
{
var buffer = new ArrayBuffer(size);
@ -306,23 +301,8 @@ function next() {
index += 1;
}
function permissionTest() {
if (gContactsEnabled) {
next();
} else {
is(mozContacts, null, "mozContacts is null when not enabled.");
SimpleTest.finish();
}
}
permissionTest();
}
var gContactsEnabled = SpecialPowers.getBoolPref("dom.mozContacts.enabled");
addLoadEvent(tests);
SimpleTest.waitForExplicitFinish();
ok(true, "test passed");
addLoadEvent(next);
</script>
</pre>
</body>

View File

@ -17,16 +17,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=836519
</div>
<pre id="test">
<script class="testbody" type="text/javascript;version=1.8">
<script class="testbody" type="text/javascript;version=1.7">
"use strict";
// this shouldn't be necessary when bug 792594 is fixed
if (!SpecialPowers.getBoolPref("dom.mozContacts.enabled")) {
let comp = SpecialPowers.wrap(SpecialPowers.Components);
comp.utils.import("resource://gre/modules/ContactService.jsm");
comp.utils.import("resource://gre/modules/PermissionPromptHelper.jsm");
SpecialPowers.setBoolPref("dom.mozContacts.enabled", true);
if (SpecialPowers.isMainProcess()) {
SpecialPowers.Cu.import("resource://gre/modules/ContactService.jsm");
SpecialPowers.Cu.import("resource://gre/modules/PermissionPromptHelper.jsm");
}
SpecialPowers.addPermission("contacts-write", true, document);
@ -52,8 +49,6 @@ let properties1 = {
email: [{type: ["work"], value: "x@y.com"}]
};
function tests() {
function onFailure() {
ok(false, "in on Failure!");
}
@ -434,21 +429,8 @@ function next() {
}
}
function permissionTest() {
if (gContactsEnabled) {
next();
} else {
is(mozContacts, null, "mozContacts is null when not enabled.");
SimpleTest.finish();
}
}
permissionTest();
}
let gContactsEnabled = SpecialPowers.getBoolPref("dom.mozContacts.enabled");
addLoadEvent(tests);
SimpleTest.waitForExplicitFinish();
addLoadEvent(next);
</script>
</pre>
</body>

View File

@ -21,12 +21,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=815833
"use strict";
// this shouldn't be necessary when bug 792594 is fixed
if (!SpecialPowers.getBoolPref("dom.mozContacts.enabled")) {
var comp = SpecialPowers.wrap(SpecialPowers.Components);
comp.utils.import("resource://gre/modules/ContactService.jsm");
comp.utils.import("resource://gre/modules/PermissionPromptHelper.jsm");
SpecialPowers.setBoolPref("dom.mozContacts.enabled", true);
if (SpecialPowers.isMainProcess()) {
SpecialPowers.Cu.import("resource://gre/modules/ContactService.jsm");
SpecialPowers.Cu.import("resource://gre/modules/PermissionPromptHelper.jsm");
}
SpecialPowers.addPermission("contacts-write", true, document);
@ -58,8 +55,6 @@ var properties2 = {
tel: [{type: ["work"], value: shortNumber, carrier: "testCarrier"}]
};
function tests() {
var req;
var index = 0;
var createResult1;
@ -243,23 +238,8 @@ function next() {
index += 1;
}
function permissionTest() {
if (gContactsEnabled) {
next();
} else {
is(mozContacts, null, "mozContacts is null when not enabled.");
SimpleTest.finish();
}
}
permissionTest();
}
var gContactsEnabled = SpecialPowers.getBoolPref("dom.mozContacts.enabled");
addLoadEvent(tests);
SimpleTest.waitForExplicitFinish();
ok(true, "test passed");
addLoadEvent(next);
</script>
</pre>
</body>

View File

@ -4079,6 +4079,8 @@ pref("dom.sms.requestStatusReport", true);
// WebContacts
pref("dom.mozContacts.enabled", false);
pref("dom.navigator-property.disable.mozContacts", true);
pref("dom.global-constructor.disable.mozContact", true);
// WebAlarms
pref("dom.mozAlarms.enabled", false);

View File

@ -113,3 +113,8 @@ user_pref("datareporting.healthreport.documentServerURI", "http://%(server)s/hea
// Make sure CSS error reporting is enabled for tests
user_pref("layout.css.report_errors", true);
// Enable mozContacts
user_pref("dom.mozContacts.enabled", true);
user_pref("dom.navigator-property.disable.mozContacts", false);
user_pref("dom.global-constructor.disable.mozContact", false);