Changeset 91062 in webkit


Ignore:
Timestamp:
Jul 15, 2011 3:40:36 AM (13 years ago)
Author:
Carlos Garcia Campos
Message:

Reviewed by Martin Robinson.

[GTK] Install a custom X error handler in plugin process
https://bugs.webkit.org/show_bug.cgi?id=63248

Some plugins, specially flash, can cause X errors that when
handled by the default X error handler (or the GDK one) abort the
process. Since we don't want to crash due to buggy plugins, we
install a custom error handler to show a warning when a X error
happens without aborting.

  • PluginProcess/gtk/PluginProcessMainGtk.cpp:

(WebKit::webkitgtkXError):
(WebKit::PluginProcessMainGtk):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r91016 r91062  
     12011-07-15  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Install a custom X error handler in plugin process
     6        https://bugs.webkit.org/show_bug.cgi?id=63248
     7
     8        Some plugins, specially flash, can cause X errors that when
     9        handled by the default X error handler (or the GDK one) abort the
     10        process. Since we don't want to crash due to buggy plugins, we
     11        install a custom error handler to show a warning when a X error
     12        happens without aborting.
     13
     14        * PluginProcess/gtk/PluginProcessMainGtk.cpp:
     15        (WebKit::webkitgtkXError):
     16        (WebKit::PluginProcessMainGtk):
     17
    1182011-07-14  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/Source/WebKit2/PluginProcess/gtk/PluginProcessMainGtk.cpp

    r91015 r91062  
    2929#include "PluginProcess.h"
    3030#include <WebKit2/RunLoop.h>
     31#include <gdk/gdkx.h>
    3132#include <gtk/gtk.h>
    3233#include <runtime/InitializeThreading.h>
     
    3435
    3536namespace WebKit {
     37
     38static int webkitgtkXError(Display* xdisplay, XErrorEvent* error)
     39{
     40    gchar errorMessage[64];
     41    XGetErrorText(xdisplay, error->error_code, errorMessage, 63);
     42    g_warning("The program '%s' received an X Window System error.\n"
     43              "This probably reflects a bug in a browser plugin.\n"
     44              "The error was '%s'.\n"
     45              "  (Details: serial %ld error_code %d request_code %d minor_code %d)\n",
     46              g_get_prgname(), errorMessage,
     47              error->serial, error->error_code,
     48              error->request_code, error->minor_code);
     49    return 0;
     50}
    3651
    3752WK_EXPORT int PluginProcessMainGtk(int argc, char* argv[])
     
    4560    RunLoop::initializeMainRunLoop();
    4661
     62    // Plugins can produce X errors that are handled by the GDK X error handler, which
     63    // exits the process. Since we don't want to crash due to plugin bugs, we install a
     64    // custom error handler to show a warning when a X error happens without aborting.
     65    XSetErrorHandler(webkitgtkXError);
     66
    4767    int socket = atoi(argv[1]);
    4868    WebKit::PluginProcess::shared().initialize(socket, RunLoop::main());
Note: See TracChangeset for help on using the changeset viewer.