Backout test for bug 550026 because it was too unreliable

This commit is contained in:
Chris Jones 2010-03-12 17:42:11 -06:00
commit 1021c8753c
4 changed files with 7 additions and 77 deletions

View File

@ -116,7 +116,6 @@ endif
ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT)) ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
_MOCHITEST_FILES += \ _MOCHITEST_FILES += \
test_copyText.html \ test_copyText.html \
test_crash_nested_loop.html \
$(NULL) $(NULL)
endif endif

View File

@ -1,40 +0,0 @@
<head>
<title>Plugin crashing in nested loop</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<body>
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
var iframe = document.getElementById('iframe1');
window.frameLoaded = function frameLoaded_toCrash() {
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')) {
ok(true, "Skipping this test when IPC plugins are not enabled.");
SimpleTest.finish();
return;
}
var p = iframe.contentDocument.getElementById('plugin1');
try {
p.crashInNestedLoop();
ok(false, "p.crashInNestedLoop() should throw an exception");
}
catch (e) {
ok(true, "p.crashInNestedLoop() should throw an exception");
}
// this test is for bug 550026, which is inherently
// nondeterministic. if we hit that bug, the browser process
// would have crashed by now. if not, we'll pass "spuriously"
SimpleTest.finish();
}
</script>

View File

@ -69,7 +69,7 @@
int gCrashCount = 0; int gCrashCount = 0;
void static void
NoteIntentionalCrash() NoteIntentionalCrash()
{ {
char* bloatLog = getenv("XPCOM_MEM_BLOAT_LOG"); char* bloatLog = getenv("XPCOM_MEM_BLOAT_LOG");
@ -89,9 +89,11 @@ NoteIntentionalCrash()
} }
} }
void static void
IntentionalCrash() IntentionalCrash()
{ {
NoteIntentionalCrash();
int *pi = NULL; int *pi = NULL;
*pi = 55; // Crash dereferencing null pointer *pi = 55; // Crash dereferencing null pointer
++gCrashCount; ++gCrashCount;
@ -155,7 +157,6 @@ static bool asyncCallbackTest(NPObject* npobj, const NPVariant* args, uint32_t a
static bool checkGCRace(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); static bool checkGCRace(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool hangPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); static bool hangPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool getClipboardText(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); static bool getClipboardText(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool crashPluginInNestedLoop(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool callOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); static bool callOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static const NPUTF8* sPluginMethodIdentifierNames[] = { static const NPUTF8* sPluginMethodIdentifierNames[] = {
@ -197,11 +198,10 @@ static const NPUTF8* sPluginMethodIdentifierNames[] = {
"checkGCRace", "checkGCRace",
"hang", "hang",
"getClipboardText", "getClipboardText",
"crashInNestedLoop",
"callOnDestroy", "callOnDestroy",
}; };
static NPIdentifier sPluginMethodIdentifiers[ARRAY_LENGTH(sPluginMethodIdentifierNames)]; static NPIdentifier sPluginMethodIdentifiers[ARRAY_LENGTH(sPluginMethodIdentifierNames)];
static const ScriptableFunction sPluginMethodFunctions[] = { static const ScriptableFunction sPluginMethodFunctions[ARRAY_LENGTH(sPluginMethodIdentifierNames)] = {
npnEvaluateTest, npnEvaluateTest,
npnInvokeTest, npnInvokeTest,
npnInvokeDefaultTest, npnInvokeDefaultTest,
@ -240,13 +240,9 @@ static const ScriptableFunction sPluginMethodFunctions[] = {
checkGCRace, checkGCRace,
hangPlugin, hangPlugin,
getClipboardText, getClipboardText,
crashPluginInNestedLoop,
callOnDestroy, callOnDestroy,
}; };
STATIC_ASSERT(ARRAY_LENGTH(sPluginMethodIdentifierNames) ==
ARRAY_LENGTH(sPluginMethodFunctions));
struct URLNotifyData struct URLNotifyData
{ {
const char* cookie; const char* cookie;
@ -711,7 +707,6 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
instanceData->npnNewStream = true; instanceData->npnNewStream = true;
} }
if (strcmp(argn[i], "newcrash") == 0) { if (strcmp(argn[i], "newcrash") == 0) {
NoteIntentionalCrash();
IntentionalCrash(); IntentionalCrash();
} }
} }
@ -794,10 +789,8 @@ NPP_Destroy(NPP instance, NPSavedData** save)
printf("NPP_Destroy\n"); printf("NPP_Destroy\n");
InstanceData* instanceData = (InstanceData*)(instance->pdata); InstanceData* instanceData = (InstanceData*)(instance->pdata);
if (instanceData->crashOnDestroy) { if (instanceData->crashOnDestroy)
NoteIntentionalCrash();
IntentionalCrash(); IntentionalCrash();
}
if (instanceData->callOnDestroy) { if (instanceData->callOnDestroy) {
NPVariant result; NPVariant result;
@ -2154,7 +2147,6 @@ streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant*
static bool static bool
crashPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) crashPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{ {
NoteIntentionalCrash();
IntentionalCrash(); IntentionalCrash();
VOID_TO_NPVARIANT(*result); VOID_TO_NPVARIANT(*result);
return true; return true;
@ -2641,33 +2633,15 @@ getClipboardText(NPObject* npobj, const NPVariant* args, uint32_t argCount,
return true; return true;
} }
bool
crashPluginInNestedLoop(NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant* result)
{
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
return pluginCrashInNestedLoop(id);
}
#else #else
bool bool
getClipboardText(NPObject* npobj, const NPVariant* args, uint32_t argCount, getClipboardText(NPObject* npobj, const NPVariant* args, uint32_t argCount,
NPVariant* result) NPVariant* result)
{ {
// XXX Not implemented! /// XXX Not implemented!
return false;
}
bool
crashPluginInNestedLoop(NPObject* npobj, const NPVariant* args,
uint32_t argCount, NPVariant* result)
{
// XXX Not implemented!
return false; return false;
} }
#endif #endif
bool bool
callOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) callOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{ {

View File

@ -127,7 +127,4 @@ typedef struct InstanceData {
void notifyDidPaint(InstanceData* instanceData); void notifyDidPaint(InstanceData* instanceData);
void NoteIntentionalCrash();
void IntentionalCrash();
#endif // nptest_h_ #endif // nptest_h_