bug 1331320 test that a crashreport is generated on X11 protocol error in plugin r=glandium
☠☠ backed out by ec799efea60c ☠ ☠
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 16 Jan 2017 14:48:33 +1300
changeset 374660 fd57bcd5daf2e1dd79021f4fa7ec659ad4b40d21
parent 374659 b272ced2faa9ebf8ab06017040af92be54d3ff96
child 374661 7df5aa0e7cfe722a62b1ee01af86984cf36101b7
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1331320
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1331320 test that a crashreport is generated on X11 protocol error in plugin r=glandium MozReview-Commit-ID: HSKgzjqRZh6
dom/plugins/test/mochitest/mochitest.ini
dom/plugins/test/mochitest/test_x11_error_crash.html
dom/plugins/test/testplugin/nptest.cpp
dom/plugins/test/testplugin/nptest_gtk2.cpp
dom/plugins/test/testplugin/nptest_platform.h
--- a/dom/plugins/test/mochitest/mochitest.ini
+++ b/dom/plugins/test/mochitest/mochitest.ini
@@ -157,9 +157,11 @@ skip-if = (toolkit != "cocoa") || (os !=
 [test_visibility.html]
 skip-if = toolkit == "cocoa"
 [test_windowed_invalidate.html]
 skip-if = os != "win"
 [test_windowless_flash.html]
 skip-if = !(os == "win" && processor == "x86_64")
 [test_windowless_ime.html]
 skip-if = os != "win"
+[test_x11_error_crash.html]
+skip-if = !crashreporter || e10s || ((toolkit != "gtk2") && (toolkit != "gtk3"))
 [test_zero_opacity.html]
copy from dom/plugins/test/mochitest/test_CrashService_crash.html
copy to dom/plugins/test/mochitest/test_x11_error_crash.html
--- a/dom/plugins/test/mochitest/test_CrashService_crash.html
+++ b/dom/plugins/test/mochitest/test_x11_error_crash.html
@@ -1,25 +1,24 @@
 <head>
-  <title>nsICrashService plugin crash</title>
+  <title>Plugin terminating on X11 error</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="plugin-utils.js"></script>
 
 <body>
   <script class="testbody" type="application/javascript">
   SimpleTest.waitForExplicitFinish();
   SimpleTest.requestFlakyTimeout(
     "crashAndGetCrashServiceRecord() polls for async crash recording");
-  SimpleTest.requestCompleteLog();
   setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
 
   window.frameLoaded = function frameLoaded_toCrash() {
     SimpleTest.expectChildProcessCrash();
 
-    crashAndGetCrashServiceRecord("crash", function (cm, crash) {
+    crashAndGetCrashServiceRecord("triggerXError", function (cm, crash) {
       var isPluginCrash = crash.isOfType(cm.PROCESS_TYPE_PLUGIN, cm.CRASH_TYPE_CRASH);
       ok(isPluginCrash, "Record should be a plugin crash");
       if (!isPluginCrash) {
         dump("Crash type: " + crash.type + "\n");
       }
       SimpleTest.finish();
     });
 
--- a/dom/plugins/test/testplugin/nptest.cpp
+++ b/dom/plugins/test/testplugin/nptest.cpp
@@ -146,16 +146,17 @@ static bool getAuthInfo(NPObject* npobj,
 static bool asyncCallbackTest(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 stallPlugin(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 callOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool reinitWidget(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 triggerXError(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool destroySharedGfxStuff(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool propertyAndMethod(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool getTopLevelWindowActivationState(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool getTopLevelWindowActivationEventCount(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool getFocusState(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool getFocusEventCount(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool getEventModel(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool getReflector(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
@@ -221,16 +222,17 @@ static const NPUTF8* sPluginMethodIdenti
   "asyncCallbackTest",
   "checkGCRace",
   "hang",
   "stall",
   "getClipboardText",
   "callOnDestroy",
   "reinitWidget",
   "crashInNestedLoop",
+  "triggerXError",
   "destroySharedGfxStuff",
   "propertyAndMethod",
   "getTopLevelWindowActivationState",
   "getTopLevelWindowActivationEventCount",
   "getFocusState",
   "getFocusEventCount",
   "getEventModel",
   "getReflector",
@@ -297,16 +299,17 @@ static const ScriptableFunction sPluginM
   asyncCallbackTest,
   checkGCRace,
   hangPlugin,
   stallPlugin,
   getClipboardText,
   callOnDestroy,
   reinitWidget,
   crashPluginInNestedLoop,
+  triggerXError,
   destroySharedGfxStuff,
   propertyAndMethod,
   getTopLevelWindowActivationState,
   getTopLevelWindowActivationEventCount,
   getFocusState,
   getFocusEventCount,
   getEventModel,
   getReflector,
@@ -3442,16 +3445,25 @@ crashPluginInNestedLoop(NPObject* npobj,
                         uint32_t argCount, NPVariant* result)
 {
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
   InstanceData* id = static_cast<InstanceData*>(npp->pdata);
   return pluginCrashInNestedLoop(id);
 }
 
 bool
+triggerXError(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 pluginTriggerXError(id);
+}
+
+bool
 destroySharedGfxStuff(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 pluginDestroySharedGfxStuff(id);
 }
 
@@ -3468,16 +3480,24 @@ bool
 crashPluginInNestedLoop(NPObject* npobj, const NPVariant* args,
                         uint32_t argCount, NPVariant* result)
 {
   // XXX Not implemented!
   return false;
 }
 
 bool
+triggerXError(NPObject* npobj, const NPVariant* args,
+              uint32_t argCount, NPVariant* result)
+{
+  // XXX Not implemented!
+  return false;
+}
+
+bool
 destroySharedGfxStuff(NPObject* npobj, const NPVariant* args,
                         uint32_t argCount, NPVariant* result)
 {
   // XXX Not implemented!
   return false;
 }
 #endif
 
--- a/dom/plugins/test/testplugin/nptest_gtk2.cpp
+++ b/dom/plugins/test/testplugin/nptest_gtk2.cpp
@@ -732,16 +732,29 @@ pluginCrashInNestedLoop(InstanceData* in
   } else {
     g_warning("ProcessBrowserEvents did not fire");
   }
 
   // if we get here without crashing, then we'll trigger a test failure
   return true;
 }
 
+bool
+pluginTriggerXError(InstanceData* instanceData)
+{
+  mozilla::NoteIntentionalCrash("plugin");
+  int num_prop_return;
+  // Window parameter is None to generate a fatal error, and this function
+  // should not return.
+  XListProperties(GDK_DISPLAY(), X11None, &num_prop_return);
+
+  // if we get here without crashing, then we'll trigger a test failure
+  return true;
+}
+
 static int
 SleepThenDie(Display* display)
 {
   mozilla::NoteIntentionalCrash("plugin");
   fprintf(stderr, "[testplugin:%d] SleepThenDie: sleeping\n", getpid());
   sleep(1);
 
   fprintf(stderr, "[testplugin:%d] SleepThenDie: dying\n", getpid());
--- a/dom/plugins/test/testplugin/nptest_platform.h
+++ b/dom/plugins/test/testplugin/nptest_platform.h
@@ -130,16 +130,21 @@ std::string pluginGetClipboardText(Insta
  * Crash while in a nested event loop.  The goal is to catch the
  * browser processing the XPCOM event generated from the plugin's
  * crash while other plugin code is still on the stack. 
  * See https://bugzilla.mozilla.org/show_bug.cgi?id=550026.
  */
 bool pluginCrashInNestedLoop(InstanceData* instanceData);
 
 /**
+ * Generate an X11 protocol error to terminate the plugin process.
+ */
+bool pluginTriggerXError(InstanceData* instanceData);
+
+/**
  * Destroy gfx things that might be shared with the parent process
  * when we're run out-of-process.  It's not expected that this
  * function will be called when the test plugin is loaded in-process,
  * and bad things will happen if it is called.
  *
  * This call leaves the plugin subprocess in an undefined state.  It
  * must not be used after this call or weird things will happen.
  */