Bug 596762: Allow specification of differing IPC preferences for each architecture in a universal binary. r=josh a=blocking-b7

This commit is contained in:
Scott Greenlay 2010-09-20 20:21:55 -04:00
Родитель 4406bcbe3b
Коммит 50c5614507
14 изменённых файлов: 95 добавлений и 41 удалений

Просмотреть файл

@ -936,14 +936,12 @@ pref("toolbar.customization.usesheet", false);
// The default for this pref reflects whether the build is capable of IPC. // The default for this pref reflects whether the build is capable of IPC.
// (Turning it on in a no-IPC build will have no effect.) // (Turning it on in a no-IPC build will have no effect.)
#ifdef XP_MACOSX #ifdef XP_MACOSX
// OSX still has only partial support for IPC. Note that the PowerPC // i386 ipc preferences
// and x86 builds must generate identical copies of this file, so we pref("dom.ipc.plugins.enabled.i386", false);
// can't make the prefs indicate that IPC is not available at all in pref("dom.ipc.plugins.enabled.i386.flash player.plugin", true);
// PowerPC builds. pref("dom.ipc.plugins.enabled.i386.javaplugin2_npapi.plugin", true);
pref("dom.ipc.plugins.enabled", false); // x86_64 ipc preferences
// These plug-ins will run OOP by default pref("dom.ipc.plugins.enabled.x86_64", true);
pref("dom.ipc.plugins.enabled.flash player.plugin", true);
pref("dom.ipc.plugins.enabled.javaplugin2_npapi.plugin", true);
#elifdef MOZ_IPC #elifdef MOZ_IPC
pref("dom.ipc.plugins.enabled", true); pref("dom.ipc.plugins.enabled", true);
#else #else

Просмотреть файл

@ -441,6 +441,27 @@ function BuildConditionSandbox(aURL) {
getBoolPref: function(p) { return this._prefs.getBoolPref(p); }, getBoolPref: function(p) { return this._prefs.getBoolPref(p); },
getIntPref: function(p) { return this._prefs.getIntPref(p); } getIntPref: function(p) { return this._prefs.getIntPref(p); }
} }
sandbox.areOOPPenabled = function () {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefservice = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var pref = false;
if (navigator.platform == "Mac") {
if (navigator.platform == "i386") {
pref = prefservice.getBoolPref("dom.ipc.plugins.enabled.i386");
}
else if (navigator.platform == "x86_64") {
pref = prefservice.getBoolPref("dom.ipc.plugins.enabled.x86_64");
}
}
else {
pref = prefservice.getBoolPref("dom.ipc.plugins.enabled")
}
return pref;
};
dump("REFTEST INFO | Dumping JSON representation of sandbox \n"); dump("REFTEST INFO | Dumping JSON representation of sandbox \n");
dump("REFTEST INFO | " + JSON.stringify(sandbox) + " \n"); dump("REFTEST INFO | " + JSON.stringify(sandbox) + " \n");

Просмотреть файл

@ -373,7 +373,17 @@ nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag)
prefFile.Cut(0, slashPos + 1); prefFile.Cut(0, slashPos + 1);
ToLowerCase(prefFile); ToLowerCase(prefFile);
#ifdef XP_MACOSX
#if defined(__i386__)
nsCAutoString prefGroupKey("dom.ipc.plugins.enabled.i386.");
#elif defined(__x86_64__)
nsCAutoString prefGroupKey("dom.ipc.plugins.enabled.x86_64.");
#elif defined(__ppc__)
nsCAutoString prefGroupKey("dom.ipc.plugins.enabled.ppc.");
#endif
#else
nsCAutoString prefGroupKey("dom.ipc.plugins.enabled."); nsCAutoString prefGroupKey("dom.ipc.plugins.enabled.");
#endif
PRUint32 prefCount; PRUint32 prefCount;
char** prefNames; char** prefNames;
@ -413,7 +423,17 @@ nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag)
if (!prefSet) { if (!prefSet) {
oopPluginsEnabled = PR_FALSE; oopPluginsEnabled = PR_FALSE;
#ifdef XP_MACOSX
#if defined(__i386__)
prefs->GetBoolPref("dom.ipc.plugins.enabled.i386", &oopPluginsEnabled);
#elif defined(__x86_64__)
prefs->GetBoolPref("dom.ipc.plugins.enabled.x86_64", &oopPluginsEnabled);
#elif defined(__ppc__)
prefs->GetBoolPref("dom.ipc.plugins.enabled.ppc", &oopPluginsEnabled);
#endif
#else
prefs->GetBoolPref("dom.ipc.plugins.enabled", &oopPluginsEnabled); prefs->GetBoolPref("dom.ipc.plugins.enabled", &oopPluginsEnabled);
#endif
} }
return oopPluginsEnabled; return oopPluginsEnabled;

Просмотреть файл

@ -16,10 +16,7 @@
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
function start() { function start() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (!SimpleTest.areOOPPenabled()) {
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) {
ok(true, "Skipping this test when IPC plugins are not enabled."); ok(true, "Skipping this test when IPC plugins are not enabled.");
SimpleTest.finish(); SimpleTest.finish();
return; return;

Просмотреть файл

@ -12,10 +12,7 @@
var iframe = document.getElementById('iframe1'); var iframe = document.getElementById('iframe1');
window.frameLoaded = function frameLoaded_toCrash() { window.frameLoaded = function frameLoaded_toCrash() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (!SimpleTest.areOOPPenabled()) {
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) {
ok(true, "Skipping this test when IPC plugins are not enabled."); ok(true, "Skipping this test when IPC plugins are not enabled.");
SimpleTest.finish(); SimpleTest.finish();
return; return;

Просмотреть файл

@ -92,10 +92,7 @@ function onPluginCrashed(aEvent) {
} }
function runTests() { function runTests() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (!SimpleTest.areOOPPenabled()) {
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) {
ok(true, "Skipping this test when IPC plugins are not enabled."); ok(true, "Skipping this test when IPC plugins are not enabled.");
SimpleTest.finish(); SimpleTest.finish();
return; return;

Просмотреть файл

@ -94,10 +94,7 @@ function onPluginCrashed(aEvent) {
} }
function runTests() { function runTests() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (!SimpleTest.areOOPPenabled()) {
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) {
ok(true, "Skipping this test when IPC plugins are not enabled."); ok(true, "Skipping this test when IPC plugins are not enabled.");
SimpleTest.finish(); SimpleTest.finish();
return; return;

Просмотреть файл

@ -93,9 +93,7 @@ function onPluginCrashed(aEvent) {
} }
function runTests() { function runTests() {
var prefs = Components.classes['@mozilla.org/preferences-service;1'] if (!SimpleTest.areOOPPenabled()) {
.getService(Components.interfaces.nsIPrefBranch);
if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) {
ok(true, "Skipping this test when IPC plugins are not enabled."); ok(true, "Skipping this test when IPC plugins are not enabled.");
SimpleTest.finish(); SimpleTest.finish();
return; return;

Просмотреть файл

@ -12,10 +12,7 @@
var iframe = document.getElementById('iframe1'); var iframe = document.getElementById('iframe1');
window.frameLoaded = function frameLoaded_toCrash() { window.frameLoaded = function frameLoaded_toCrash() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (!SimpleTest.areOOPPenabled()) {
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) {
ok(true, "Skipping this test when IPC plugins are not enabled."); ok(true, "Skipping this test when IPC plugins are not enabled.");
SimpleTest.finish(); SimpleTest.finish();
return; return;

Просмотреть файл

@ -12,10 +12,7 @@
var iframe = document.getElementById('iframe1'); var iframe = document.getElementById('iframe1');
function mainLoaded() { function mainLoaded() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (!SimpleTest.areOOPPenabled()) {
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) {
ok(true, "Skipping this test when IPC plugins are not enabled."); ok(true, "Skipping this test when IPC plugins are not enabled.");
SimpleTest.finish(); SimpleTest.finish();
return; return;

Просмотреть файл

@ -12,15 +12,16 @@
var iframe = document.getElementById('iframe1'); var iframe = document.getElementById('iframe1');
window.frameLoaded = function frameLoaded_toCrash() { window.frameLoaded = function frameLoaded_toCrash() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (!SimpleTest.areOOPPenabled()) {
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) {
ok(true, "Skipping this test when IPC plugins are not enabled."); ok(true, "Skipping this test when IPC plugins are not enabled.");
SimpleTest.finish(); SimpleTest.finish();
return; return;
} }
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
// the default timeout is annoying high for mochitest runs // the default timeout is annoying high for mochitest runs
var timeoutPref = "dom.ipc.plugins.timeoutSecs"; var timeoutPref = "dom.ipc.plugins.timeoutSecs";
prefs.setIntPref(timeoutPref, 5); prefs.setIntPref(timeoutPref, 5);

Просмотреть файл

@ -6,7 +6,7 @@ fails-if(!haveTestPlugin) == plugin-alpha-opacity.html div-alpha-opacity.html
fails-if(!haveTestPlugin) == windowless-clipping-1.html windowless-clipping-1-ref.html fails-if(!haveTestPlugin) == windowless-clipping-1.html windowless-clipping-1-ref.html
fails-if(!haveTestPlugin) == border-padding-1.html border-padding-1-ref.html fails-if(!haveTestPlugin) == border-padding-1.html border-padding-1-ref.html
fails-if(!haveTestPlugin) == border-padding-2.html border-padding-2-ref.html fails-if(!haveTestPlugin) == border-padding-2.html border-padding-2-ref.html
asserts-if(http.oscpu.match(/Linux/),0-1) random-if(d2d) fails-if(!haveTestPlugin) skip-if(!prefs.getBoolPref("dom.ipc.plugins.enabled")) == pluginproblemui-direction-1.html pluginproblemui-direction-1-ref.html # assertion is bug 585394 asserts-if(http.oscpu.match(/Linux/),0-1) random-if(d2d) fails-if(!haveTestPlugin) skip-if(!areOOPPenabled()) == pluginproblemui-direction-1.html pluginproblemui-direction-1-ref.html # assertion is bug 585394
asserts-if(http.oscpu.match(/Linux/),0-1) fails-if(!haveTestPlugin) skip-if(!prefs.getBoolPref("dom.ipc.plugins.enabled")) == pluginproblemui-direction-2.html pluginproblemui-direction-2-ref.html # assertion is bug 585394 asserts-if(http.oscpu.match(/Linux/),0-1) fails-if(!haveTestPlugin) skip-if(!areOOPPenabled()) == pluginproblemui-direction-2.html pluginproblemui-direction-2-ref.html # assertion is bug 585394
# Disabled for now to investigate Windows/Linux test failures # Disabled for now to investigate Windows/Linux test failures
# fails-if(!haveTestPlugin) == border-padding-3.html border-padding-3-ref.html # fails-if(!haveTestPlugin) == border-padding-3.html border-padding-3-ref.html

Просмотреть файл

@ -32,6 +32,30 @@ if (parentRunner) {
ipcMode = parentRunner.ipcMode; ipcMode = parentRunner.ipcMode;
} }
/**
* Check for OOPP preferences
**/
SimpleTest.areOOPPenabled = function () {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefservice = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var pref = false;
if (navigator.platform == "Mac") {
if (navigator.platform == "i386") {
pref = prefservice.getBoolPref("dom.ipc.plugins.enabled.i386");
}
else if (navigator.platform == "x86_64") {
pref = prefservice.getBoolPref("dom.ipc.plugins.enabled.x86_64");
}
}
else {
pref = prefservice.getBoolPref("dom.ipc.plugins.enabled")
}
return pref;
};
// Check to see if the TestRunner is present and has logging // Check to see if the TestRunner is present and has logging
if (parentRunner) { if (parentRunner) {
SimpleTest._logEnabled = parentRunner.logEnabled; SimpleTest._logEnabled = parentRunner.logEnabled;

Просмотреть файл

@ -83,7 +83,17 @@ mochitest-a11y:
$(CHECK_TEST_ERROR) $(CHECK_TEST_ERROR)
mochitest-ipcplugins: mochitest-ipcplugins:
#ifdef XP_MACOSX
#if defined(__i386__)
$(RUN_MOCHITEST) --setpref=dom.ipc.plugins.enabled.i386=true --test-path=modules/plugin/test
#elif defined(__x86_64__)
$(RUN_MOCHITEST) --setpref=dom.ipc.plugins.enabled.x86_64=true --test-path=modules/plugin/test
#elif defined(__ppc__)
$(RUN_MOCHITEST) --setpref=dom.ipc.plugins.enabled.ppc=true --test-path=modules/plugin/test
#endif
#else
$(RUN_MOCHITEST) --setpref=dom.ipc.plugins.enabled=true --test-path=modules/plugin/test $(RUN_MOCHITEST) --setpref=dom.ipc.plugins.enabled=true --test-path=modules/plugin/test
#endif
$(CHECK_TEST_ERROR) $(CHECK_TEST_ERROR)
# Usage: |make [EXTRA_TEST_ARGS=...] *test|. # Usage: |make [EXTRA_TEST_ARGS=...] *test|.