[Webkit-unassigned] [Bug 33044] Add Java Applet support to WebKit's Qt port

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 30 01:51:10 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=33044





--- Comment #1 from Kenneth Rohde Christiansen <kenneth at webkit.org>  2009-12-30 01:51:10 PST ---
(From update of attachment 45643)
I will do a very raw review. Please run check-webkit-style on the patch if you
haven't done so already.

Basically this patch should be two, one for the Qt specific part and one for
the Windows/WebCore specific part.

> --- E:/Qt/4.5.3-shared/src/3rdparty/webkit/WebCore/plugins/win/PluginDatabaseWin.cpp.org	Tue Sep 29 06:04:12 2009
> +++ E:/Qt/4.5.3-shared/src/3rdparty/webkit/WebCore/plugins/win/PluginDatabaseWin.cpp	Mon Dec 21 04:01:39 2009

I wonder what Safari and Chrome uses on Windows for supporting Java.

> @@ -33,6 +33,8 @@
>  #include <windows.h>
>  #include <shlwapi.h>
>  
> +#include <QDebug>

This file (PluginDatabaseWin.cpp) is not Qt specific so please try avoiding
using non-WebCore/Windows method calls, thus the include here is wrong

> +
>  #if COMPILER(MINGW)
>  #define _countof(x) (sizeof(x)/sizeof(x[0]))
>  #endif
> @@ -325,6 +327,69 @@
>      directories.append(macromediaDirectoryStr);
>  }
>  
> +static inline void addJavaPluginDirectory(Vector<String>& directories)
> +{
> +    qDebug() << "PluginDatabase::addJavaPluginDirectories";

Same thing here

> +    HKEY key;
> +    HRESULT result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\JavaSoft\\Java Plug-in"), 0, KEY_READ, &key);
> +    if (result != ERROR_SUCCESS)
> +        return;
> +
> +    WCHAR name[128];
> +    FILETIME lastModified;
> +
> +    Vector<int> latestJavaVersion;
> +    String latestJavaVersionString;
> +
> +    qDebug() << "- checking Java Plugin versions";
> +    // Enumerate subkeys
> +    for (int i = 0;; i++) {
> +        DWORD nameLen = sizeof(name) / sizeof(WCHAR);
> +        result = RegEnumKeyExW(key, i, name, &nameLen, 0, 0, 0, &lastModified);
> +
> +        if (result != ERROR_SUCCESS)
> +            break;
> +
> +        Vector<int> javaVersion = parseVersionString(String(name, nameLen));
> +        if (compareVersions(javaVersion, latestJavaVersion)) {
> +            latestJavaVersion = javaVersion;
> +            latestJavaVersionString = String(name, nameLen);
> +            qDebug() << "- setting latest Java Plugin version to " << latestJavaVersionString;
> +        }
> +    }
> +
> +    if (!latestJavaVersionString.isNull()) {
> +        DWORD type;
> +        WCHAR javaInstallPathStr[_MAX_PATH];
> +        DWORD javaInstallPathSize = sizeof(javaInstallPathStr);
> +        DWORD useNewPluginValue;
> +        DWORD useNewPluginSize;
> +
> +        String javaPluginKeyPath = "Software\\JavaSoft\\Java Plug-in\\" + latestJavaVersionString;
> +        result = SHGetValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.charactersWithNullTermination(), TEXT("UseNewJavaPlugin"), &type,(LPVOID)&useNewPluginValue, &useNewPluginSize);
> +        if (result == ERROR_SUCCESS) {
> +            if (useNewPluginValue == 1) {
> +                result = SHGetValue(HKEY_LOCAL_MACHINE, javaPluginKeyPath.charactersWithNullTermination(), TEXT("JavaHome"), &type, (LPBYTE)javaInstallPathStr, &javaInstallPathSize);
> +                if (result == ERROR_SUCCESS) {
> +                    String javaPluginDirectory = String(javaInstallPathStr, javaInstallPathSize / sizeof(WCHAR) - 1) + "\\bin\\new_plugin";
> +                    directories.append(javaPluginDirectory);
> +                    qDebug() << "- adding Java Plugin directory: " << javaPluginDirectory;
> +                } else {
> +                    qDebug() << "Error: failed to read JavaHome value (" << result << ")";
> +                }
> +            } else {
> +                qDebug() << "Error: failed to find a 'new' Java Plugin";
> +            }

Yes the coding style is wrong, so please run the check-webkit-style :-)

> +        } else {
> +            qDebug() << "Error: failed to read 'UseNewJavaPlugin' value (" << result << ")";
> +        }
> +    } else {
> +        qDebug("ERROR: failed to find a java version!!!");
> +    }
> +
> +    RegCloseKey(key);
> +}
> +
>  Vector<String> PluginDatabase::defaultPluginDirectories()
>  {
>      Vector<String> directories;
> @@ -337,7 +402,7 @@
>      addMozillaPluginDirectories(directories);
>      addWindowsMediaPlayerPluginDirectory(directories);
>      addMacromediaPluginDirectories(directories);
> -
> +    addJavaPluginDirectory(directories);
>      return directories;
>  }
>  
> --- E:/Qt/4.5.3-shared/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp.org	Tue Sep 29 06:04:12 2009
> +++ E:/Qt/4.5.3-shared/src/3rdparty/webkit/WebCore/plugins/win/PluginPackageWin.cpp	Mon Dec 21 04:01:39 2009
> @@ -38,6 +38,8 @@
>  #include <wtf/OwnArrayPtr.h>
>  #include <shlwapi.h>
>  
> +#include <QDebug>
> +

Do not use QDebug here

>  namespace WebCore {
>  
>  static String getVersionInfo(const LPVOID versionInfoData, const String& info)
> @@ -223,6 +225,7 @@
>  
>  bool PluginPackage::load()
>  {
> +    qDebug() << "Loading plugin: " << this->m_path;
>      if (m_freeLibraryTimer.isActive()) {
>          ASSERT(m_module);
>          m_freeLibraryTimer.stop();
> --- E:/Qt/4.5.3-shared/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp.org	Tue Sep 29 06:04:14 2009
> +++ E:/Qt/4.5.3-shared/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp	Tue Dec 22 22:22:14 2009
> @@ -58,6 +58,8 @@
>  #include "qwebhistoryinterface.h"
>  #include "qwebpluginfactory.h"
>  
> +#include <QtDebug>

Here it is OK to use.

> +
>  #include <qfileinfo.h>
>  
>  #include <QCoreApplication>
> @@ -199,7 +201,7 @@
>      return true;
>  }
>  
> -void FrameLoaderClientQt::savePlatformDataToCachedPage(CachedPage*) 
> +void FrameLoaderClientQt::savePlatformDataToCachedPage(CachedPage*)
>  {
>      notImplemented();
>  }
> @@ -1076,8 +1078,8 @@
>  Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, Element* element, const KURL& url, const Vector<String>& paramNames,
>                                            const Vector<String>& paramValues, const String& mimeType, bool loadManually)
>  {
> -//     qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType;
> -//     qDebug()<<"------\t url = "<<url.prettyURL();
> +     qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType;
> +     qDebug()<<"------\t url = "<<url.prettyURL();
>  
>      if (!m_webFrame)
>          return 0;
> @@ -1148,6 +1150,7 @@
>      } else { // NPAPI Plugins
>          PluginView* pluginView = PluginView::create(m_frame, pluginSize, element, url,
>              paramNames, paramValues, mimeType, loadManually);
> +        qDebug() << "Create the PluginView: " << pluginView;
>          return pluginView;
>      }
>  
> @@ -1156,16 +1159,19 @@
>  
>  void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget)
>  {
> +	qDebug() << "FrameLoaderClientQt::redirectDataToPlugin";
>      ASSERT(!m_pluginView);
>      m_pluginView = static_cast<PluginView*>(pluginWidget);
>      m_hasSentResponseToPlugin = false;
>  }
>  
> -Widget* FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL,
> +Widget* FrameLoaderClientQt::createJavaAppletWidget(const IntSize& pluginSize, Element* element, const KURL& baseURL,
>                                                      const Vector<String>& paramNames, const Vector<String>& paramValues)
>  {
> -    notImplemented();
> -    return 0;
> +    qDebug() << "createJavaAppletWidget";
> +    //notImplemented();
> +    //return 0;
> +    return createPlugin(pluginSize, element, baseURL, paramNames, paramValues, "application/x-java-applet", true);
>  }
>  
>  String FrameLoaderClientQt::overrideMediaType() const

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list