From 367b8ceccba882bfc9dbfed81f2df9102a917c78 Mon Sep 17 00:00:00 2001 From: Scott Greenlay Date: Fri, 24 Sep 2010 10:32:02 -0400 Subject: [PATCH] Bug 596762: Allow specification of differing IPC preferences for each architecture in a universal binary. r=josh a=blocking-b7 --- browser/app/profile/firefox.js | 14 +++++----- layout/tools/reftest/reftest.js | 24 +++++++++++++++++ modules/plugin/base/src/nsNPAPIPlugin.cpp | 20 ++++++++++++++ modules/plugin/test/mochitest/Makefile.in | 10 +++++-- .../plugin/test/mochitest/test_GCrace.html | 5 +--- .../plugin/test/mochitest/test_bug479979.xul | 4 +-- .../mochitest/test_crash_nested_loop.html | 5 +--- .../test/mochitest/test_crash_notify.xul | 5 +--- .../mochitest/test_crash_notify_no_report.xul | 5 +--- .../test/mochitest/test_crash_submit.xul | 4 +-- .../plugin/test/mochitest/test_crashing.html | 5 +--- .../plugin/test/mochitest/test_crashing2.html | 5 +--- .../plugin/test/mochitest/test_hanging.html | 9 ++++--- modules/plugin/test/reftest/reftest.list | 4 +-- .../mochitest/tests/SimpleTest/SimpleTest.js | 27 +++++++++++++++++++ testing/testsuite-targets.mk | 10 +++++++ 16 files changed, 111 insertions(+), 45 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index f1c0abf946e..585b31f13d4 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -938,14 +938,12 @@ pref("toolbar.customization.usesheet", false); // 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.) #ifdef XP_MACOSX -// OSX still has only partial support for IPC. Note that the PowerPC -// and x86 builds must generate identical copies of this file, so we -// can't make the prefs indicate that IPC is not available at all in -// PowerPC builds. -pref("dom.ipc.plugins.enabled", false); -// These plug-ins will run OOP by default -pref("dom.ipc.plugins.enabled.flash player.plugin", true); -pref("dom.ipc.plugins.enabled.javaplugin2_npapi.plugin", true); +// i386 ipc preferences +pref("dom.ipc.plugins.enabled.i386", false); +pref("dom.ipc.plugins.enabled.i386.flash player.plugin", true); +pref("dom.ipc.plugins.enabled.i386.javaplugin2_npapi.plugin", true); +// x86_64 ipc preferences +pref("dom.ipc.plugins.enabled.x86_64", true); #elifdef MOZ_IPC pref("dom.ipc.plugins.enabled", true); #else diff --git a/layout/tools/reftest/reftest.js b/layout/tools/reftest/reftest.js index b6dfcab784d..c39c05dcdc8 100644 --- a/layout/tools/reftest/reftest.js +++ b/layout/tools/reftest/reftest.js @@ -441,6 +441,30 @@ function BuildConditionSandbox(aURL) { getBoolPref: function(p) { return this._prefs.getBoolPref(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(CI.nsIPrefBranch); + + var pref = false; + + if (navigator.platform.indexOf("Mac") == 0) { + var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"] + .getService(CI.nsIXULAppInfo) + .QueryInterface(CI.nsIXULRuntime); + if (xulRuntime.XPCOMABI.match(/x86-/)) { + pref = prefservice.getBoolPref("dom.ipc.plugins.enabled.i386"); + } + else if (xulRuntime.XPCOMABI.match(/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 | " + JSON.stringify(sandbox) + " \n"); diff --git a/modules/plugin/base/src/nsNPAPIPlugin.cpp b/modules/plugin/base/src/nsNPAPIPlugin.cpp index b907fe981c7..e181db3f89a 100644 --- a/modules/plugin/base/src/nsNPAPIPlugin.cpp +++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp @@ -373,7 +373,17 @@ nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag) prefFile.Cut(0, slashPos + 1); 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."); +#endif PRUint32 prefCount; char** prefNames; @@ -413,7 +423,17 @@ nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag) if (!prefSet) { 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); +#endif } return oopPluginsEnabled; diff --git a/modules/plugin/test/mochitest/Makefile.in b/modules/plugin/test/mochitest/Makefile.in index 223f5bd7ac2..faa6becfe5b 100644 --- a/modules/plugin/test/mochitest/Makefile.in +++ b/modules/plugin/test/mochitest/Makefile.in @@ -103,7 +103,6 @@ _MOCHITEST_FILES += \ endif _MOCHICHROME_FILES = \ - test_bug479979.xul \ test_npruntime.xul \ test_privatemode.xul \ test_wmode.xul \ @@ -111,6 +110,8 @@ _MOCHICHROME_FILES = \ # Temporarily disable the tests on Linux, see bug 573290 and bug 583591. ifneq ($(OS_ARCH),Linux) +# Temporarily disable the tests on Mac OS X, see bug 599087. +ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT)) ifdef MOZ_CRASHREPORTER _MOCHICHROME_FILES += \ test_crash_notify.xul \ @@ -119,12 +120,17 @@ _MOCHICHROME_FILES += \ $(NULL) endif endif +endif -# Temporarily disable this test on Mac OS X. +# Temporarily disable these tests on Mac OS X, see bug 599076 and bug 599267. ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT)) _MOCHITEST_FILES += \ test_crashing.html \ $(NULL) + +_MOCHICHROME_FILES += \ + test_bug479979.xul \ + $(NULL) endif ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) diff --git a/modules/plugin/test/mochitest/test_GCrace.html b/modules/plugin/test/mochitest/test_GCrace.html index dd16bcb7faa..2907877c92b 100644 --- a/modules/plugin/test/mochitest/test_GCrace.html +++ b/modules/plugin/test/mochitest/test_GCrace.html @@ -16,10 +16,7 @@ SimpleTest.waitForExplicitFinish(); function start() { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - var prefs = Components.classes['@mozilla.org/preferences-service;1'] - .getService(Components.interfaces.nsIPrefBranch); - if (!prefs.getBoolPref('dom.ipc.plugins.enabled')) { + if (!SimpleTest.areOOPPenabled()) { ok(true, "Skipping this test when IPC plugins are not enabled."); SimpleTest.finish(); return; diff --git a/modules/plugin/test/mochitest/test_bug479979.xul b/modules/plugin/test/mochitest/test_bug479979.xul index 38a41ca5714..55a3a63daa0 100644 --- a/modules/plugin/test/mochitest/test_bug479979.xul +++ b/modules/plugin/test/mochitest/test_bug479979.xul @@ -2,10 +2,10 @@ - - NPAPI Private Mode Tests + NPAPI Set Undefined Value Test