Changeset 174054 in webkit


Ignore:
Timestamp:
Sep 29, 2014 1:51:51 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

REGRESSION(r172919): WebKitPluginProcess fails to scan GTK+2 plugins after r172919.
https://bugs.webkit.org/show_bug.cgi?id=137191

Reviewed by Philippe Normand.

In r172919 I moved the GTK+ symbols mix check earlier, before the
plugin is loaded and initialized. That made impossible to use the
GTK3 plugin process to scan gtk2 plugins, because we need to load
the plugin to get its metadata. But we don't need to initialize
the plugin to check if it requires GTK2, so we can do that check
in the UI process to decide which plugin process to use.

  • Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:

(WebKit::NetscapePluginModule::getPluginInfoForLoadedPlugin):
Remove the requires GTK2 check.
(WebKit::NetscapePluginModule::scanPlugin): Don't write
requires-gtk2 to stdout.

  • UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:

(WebKit::pluginRequiresGtk2): Helper function to check if the
given plugin path requires GTK2.
(WebKit::PluginProcessProxy::scanPlugin): Check if the plugin path
requires GTK2 and use WebKitPluginProcess2 in such case, or return
early if GTK2 plugins are not enabled. Log error messages when
something fails scanning the plugin to make it easiert to debug
problems in the future.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r174052 r174054  
     12014-09-29  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r172919): WebKitPluginProcess fails to scan GTK+2 plugins after r172919.
     4        https://bugs.webkit.org/show_bug.cgi?id=137191
     5
     6        Reviewed by Philippe Normand.
     7
     8        In r172919 I moved the GTK+ symbols mix check earlier, before the
     9        plugin is loaded and initialized. That made impossible to use the
     10        GTK3 plugin process to scan gtk2 plugins, because we need to load
     11        the plugin to get its metadata. But we don't need to initialize
     12        the plugin to check if it requires GTK2, so we can do that check
     13        in the UI process to decide which plugin process to use.
     14
     15        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
     16        (WebKit::NetscapePluginModule::getPluginInfoForLoadedPlugin):
     17        Remove the requires GTK2 check.
     18        (WebKit::NetscapePluginModule::scanPlugin): Don't write
     19        requires-gtk2 to stdout.
     20        * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
     21        (WebKit::pluginRequiresGtk2): Helper function to check if the
     22        given plugin path requires GTK2.
     23        (WebKit::PluginProcessProxy::scanPlugin): Check if the plugin path
     24        requires GTK2 and use WebKitPluginProcess2 in such case, or return
     25        early if GTK2 plugins are not enabled. Log error messages when
     26        something fails scanning the plugin to make it easiert to debug
     27        problems in the future.
     28
    1292014-09-28  Myles C. Maxfield  <mmaxfield@apple.com>
    230
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp

    r172724 r174054  
    153153    metaData.mimeDescription = mimeDescription;
    154154
    155 #if PLATFORM(GTK)
    156     metaData.requiresGtk2 = module->functionPointer<void (*)()>("gtk_progress_get_type");
    157 #endif
    158 
    159155    return true;
    160156}
     
    245241    writeLine(metaData.description);
    246242    writeLine(metaData.mimeDescription);
    247 #if PLATFORM(GTK)
    248     if (metaData.requiresGtk2)
    249         writeLine("requires-gtk2");
    250 #endif
    251243
    252244    fflush(stdout);
  • trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp

    r167885 r174054  
    11/*
    2  * Copyright (C) 2011 Igalia S.L.
     2 * Copyright (C) 2011, 2014 Igalia S.L.
    33 * Copyright (C) 2011 Apple Inc.
    44 * Copyright (C) 2012 Samsung Electronics
     
    3434#include "ProcessExecutablePath.h"
    3535#include <WebCore/FileSystem.h>
     36#include <sys/wait.h>
    3637#include <wtf/text/CString.h>
    3738#include <wtf/text/WTFString.h>
     39
    3840#if PLATFORM(GTK) || PLATFORM(EFL)
    3941#include <glib.h>
     
    4143#endif
    4244
    43 #include <sys/wait.h>
     45#if PLATFORM(GTK)
     46#include "Module.h"
     47#endif
    4448
    4549using namespace WebCore;
     
    6670}
    6771
     72#if PLATFORM(GTK)
     73static bool pluginRequiresGtk2(const String& pluginPath)
     74{
     75    std::unique_ptr<Module> module = std::make_unique<Module>(pluginPath);
     76    if (!module->load())
     77        return false;
     78    return module->functionPointer<gpointer>("gtk_object_get_type");
     79}
     80#endif
     81
    6882#if PLUGIN_ARCHITECTURE(X11)
    6983bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData& result)
    7084{
    7185#if PLATFORM(GTK) || PLATFORM(EFL)
    72     CString binaryPath = fileSystemRepresentation(executablePathOfPluginProcess());
     86    String pluginProcessPath = executablePathOfPluginProcess();
     87
     88#if PLATFORM(GTK)
     89    bool requiresGtk2 = pluginRequiresGtk2(pluginPath);
     90    if (requiresGtk2)
     91#if ENABLE(PLUGIN_PROCESS_GTK2)
     92        pluginProcessPath.append('2');
     93#else
     94        return false;
     95#endif
     96#endif
     97
     98    CString binaryPath = fileSystemRepresentation(pluginProcessPath);
    7399    CString pluginPathCString = fileSystemRepresentation(pluginPath);
    74100    char* argv[4];
     
    76102    argv[1] = const_cast<char*>("-scanPlugin");
    77103    argv[2] = const_cast<char*>(pluginPathCString.data());
    78     argv[3] = 0;
    79 
    80     int status;
    81     GUniqueOutPtr<char> stdOut;
     104    argv[3] = nullptr;
    82105
    83106    // If the disposition of SIGCLD signal is set to SIG_IGN (default)
     
    95118#endif
    96119
    97     if (!g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, &stdOut.outPtr(), 0, &status, 0))
     120    int status;
     121    GUniqueOutPtr<char> stdOut;
     122    GUniqueOutPtr<GError> error;
     123    if (!g_spawn_sync(nullptr, argv, nullptr, G_SPAWN_STDERR_TO_DEV_NULL, nullptr, nullptr, &stdOut.outPtr(), nullptr, &status, &error.outPtr())) {
     124        WTFLogAlways("Failed to launch %s: %s", argv[0], error->message);
    98125        return false;
     126    }
    99127
    100     if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS || !stdOut)
     128    if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) {
     129        WTFLogAlways("Error scanning plugin %s, %s returned %d exit status", argv[2], argv[0], status);
    101130        return false;
     131    }
    102132
    103     String stdOutString = String::fromUTF8(stdOut.get());
     133    if (!stdOut) {
     134        WTFLogAlways("Error scanning plugin %s, %s didn't write any output to stdout", argv[2], argv[0]);
     135        return false;
     136    }
    104137
    105138    Vector<String> lines;
    106     stdOutString.split(UChar('\n'), true, lines);
     139    String::fromUTF8(stdOut.get()).split(UChar('\n'), true, lines);
    107140
    108     if (lines.size() < 3)
     141    if (lines.size() < 3) {
     142        WTFLogAlways("Error scanning plugin %s, too few lines of output provided", argv[2]);
    109143        return false;
     144    }
    110145
    111146    result.name.swap(lines[0]);
     
    113148    result.mimeDescription.swap(lines[2]);
    114149#if PLATFORM(GTK)
    115     if (lines.size() > 3)
    116         result.requiresGtk2 = lines[3] == "requires-gtk2";
     150    result.requiresGtk2 = requiresGtk2;
    117151#endif
    118152    return !result.mimeDescription.isEmpty();
Note: See TracChangeset for help on using the changeset viewer.