[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

mrowe at apple.com mrowe at apple.com
Thu Apr 8 02:07:01 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 6d2117778df0ee68e6a9e7abc0158ea6c337f6c8
Author: mrowe at apple.com <mrowe at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 2 23:13:51 2010 +0000

    Bug 30348: Implement private mode for plug-ins on Windows
    <http://webkit.org/b/30348> / <rdar://problem/7562261>
    
    Reviewed by Oliver Hunt.
    
    WebCore:
    
    Rework PluginView::getValue and PluginView::getValueStatic to remove the amount of code that
    was duplicated across platforms.  getValue and getValueStatic now call in to platform-specific
    variants that indicate whether they handled the query.  If the query is not handled by the
    platform-specific variants then the cross-platform handler has a chance to handle it.
    
    * plugins/PluginView.cpp:
    (WebCore::PluginView::getValueStatic): Give the platform-specific variant a chance to handle the
    variable lookup.  If it does not handle it, return an error.
    (WebCore::PluginView::getValue): Give the platform-specific variant and platform-specific static
    variant a chance to handle the variable lookup.  If they do not handle it, apply the cross-platform
    handler.  At the moment the cross-platform code handles NPNVWindowNPObject, NPNVPluginElementNPObject,
    and NPNVprivateModeBool as they have an identical implementation across ports.
    * plugins/PluginView.h:
    * plugins/PluginViewNone.cpp:
    (WebCore::PluginView::platformGetValue): PluginViewNone does not handle any lookups.
    (WebCore::PluginView::platformGetValueStatic): Ditto.
    * plugins/gtk/PluginViewGtk.cpp:
    (WebCore::PluginView::platformGetValueStatic):
    (WebCore::PluginView::platformGetValue):
    platform-independent implementation.
    * plugins/mac/PluginViewMac.cpp:
    (WebCore::PluginView::platformGetValueStatic):
    (WebCore::PluginView::platformGetValue):
    * plugins/qt/PluginViewQt.cpp:
    (WebCore::PluginView::platformGetValueStatic):
    (WebCore::PluginView::platformGetValue): Fix a bug noticed while updating this code.
    The Qt implementation of the handler for NPNVToolkit was relying on case fall-through
    to have some values handled by the static handler.  When NPNVprivateModeBool was added
    it was placed before the default case, interferring with this fall-through.  It now
    explicitly indicates in this situation that it was not handled.
    * plugins/symbian/PluginViewSymbian.cpp:
    (WebCore::PluginView::platformGetValueStatic):
    (WebCore::PluginView::platformGetValue):
    * plugins/win/PluginViewWin.cpp:
    (WebCore::PluginView::platformGetValueStatic):
    (WebCore::PluginView::platformGetValue):
    
    LayoutTests:
    
    * platform/win/Skipped: Remove plugins/private-browsing-mode-2.html now that it passes.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55432 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 03434f6..bddbeaf 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
+2010-03-02  Mark Rowe  <mrowe at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Bug 30348: Implement private mode for plug-ins on Windows
+        <http://webkit.org/b/30348> / <rdar://problem/7562261>
+
+        * platform/win/Skipped: Remove plugins/private-browsing-mode-2.html now that it passes.
+
 2010-03-02  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index e46c472..52f9915 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -674,9 +674,6 @@ fast/dom/Window/slow-unload-handler-only-frame-is-stopped.html
 # <https://bugs.webkit.org/show_bug.cgi?id=30348>
 plugins/private-browsing-mode.html
 
-# https://bugs.webkit.org/show_bug.cgi?id=33180
-plugins/private-browsing-mode-2.html
-
 # Skip these two failures I introduced this morning while I explore them.
 http/tests/globalhistory/history-delegate-basic-visited-links.html
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b4ef02d..c0bc157 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,47 @@
+2010-03-02  Mark Rowe  <mrowe at apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Bug 30348: Implement private mode for plug-ins on Windows
+        <http://webkit.org/b/30348> / <rdar://problem/7562261>
+
+        Rework PluginView::getValue and PluginView::getValueStatic to remove the amount of code that
+        was duplicated across platforms.  getValue and getValueStatic now call in to platform-specific
+        variants that indicate whether they handled the query.  If the query is not handled by the
+        platform-specific variants then the cross-platform handler has a chance to handle it.
+
+        * plugins/PluginView.cpp:
+        (WebCore::PluginView::getValueStatic): Give the platform-specific variant a chance to handle the
+        variable lookup.  If it does not handle it, return an error.
+        (WebCore::PluginView::getValue): Give the platform-specific variant and platform-specific static
+        variant a chance to handle the variable lookup.  If they do not handle it, apply the cross-platform
+        handler.  At the moment the cross-platform code handles NPNVWindowNPObject, NPNVPluginElementNPObject,
+        and NPNVprivateModeBool as they have an identical implementation across ports.
+        * plugins/PluginView.h:
+        * plugins/PluginViewNone.cpp:
+        (WebCore::PluginView::platformGetValue): PluginViewNone does not handle any lookups.
+        (WebCore::PluginView::platformGetValueStatic): Ditto.
+        * plugins/gtk/PluginViewGtk.cpp:
+        (WebCore::PluginView::platformGetValueStatic):
+        (WebCore::PluginView::platformGetValue):
+        platform-independent implementation.
+        * plugins/mac/PluginViewMac.cpp:
+        (WebCore::PluginView::platformGetValueStatic):
+        (WebCore::PluginView::platformGetValue):
+        * plugins/qt/PluginViewQt.cpp:
+        (WebCore::PluginView::platformGetValueStatic):
+        (WebCore::PluginView::platformGetValue): Fix a bug noticed while updating this code.
+        The Qt implementation of the handler for NPNVToolkit was relying on case fall-through
+        to have some values handled by the static handler.  When NPNVprivateModeBool was added
+        it was placed before the default case, interferring with this fall-through.  It now
+        explicitly indicates in this situation that it was not handled.
+        * plugins/symbian/PluginViewSymbian.cpp:
+        (WebCore::PluginView::platformGetValueStatic):
+        (WebCore::PluginView::platformGetValue):
+        * plugins/win/PluginViewWin.cpp:
+        (WebCore::PluginView::platformGetValueStatic):
+        (WebCore::PluginView::platformGetValue):
+
 2010-03-02  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index c07fbe8..5ac3ec8 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -1300,4 +1300,77 @@ void PluginView::keepAlive(NPP instance)
 }
 #endif
 
+NPError PluginView::getValueStatic(NPNVariable variable, void* value)
+{
+    LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
+
+    NPError result;
+    if (platformGetValueStatic(variable, value, &result))
+        return result;
+
+    return NPERR_GENERIC_ERROR;
+}
+
+NPError PluginView::getValue(NPNVariable variable, void* value)
+{
+    LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
+
+    NPError result;
+    if (platformGetValue(variable, value, &result))
+        return result;
+
+    if (platformGetValueStatic(variable, value, &result))
+        return result;
+
+    switch (variable) {
+#if ENABLE(NETSCAPE_PLUGIN_API)
+    case NPNVWindowNPObject: {
+        if (m_isJavaScriptPaused)
+            return NPERR_GENERIC_ERROR;
+
+        NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
+
+        // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
+        if (windowScriptObject)
+            _NPN_RetainObject(windowScriptObject);
+
+        void** v = (void**)value;
+        *v = windowScriptObject;
+
+        return NPERR_NO_ERROR;
+    }
+
+    case NPNVPluginElementNPObject: {
+        if (m_isJavaScriptPaused)
+            return NPERR_GENERIC_ERROR;
+
+        NPObject* pluginScriptObject = 0;
+
+        if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
+            pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
+
+        // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
+        if (pluginScriptObject)
+            _NPN_RetainObject(pluginScriptObject);
+
+        void** v = (void**)value;
+        *v = pluginScriptObject;
+
+        return NPERR_NO_ERROR;
+    }
+#endif
+
+    case NPNVprivateModeBool: {
+        Page* page = m_parentFrame->page();
+        if (!page)
+            return NPERR_GENERIC_ERROR;
+        *((NPBool*)value) = !page->settings() || page->settings()->privateBrowsingEnabled();
+        return NPERR_NO_ERROR;
+    }
+
+    default:
+        return NPERR_GENERIC_ERROR;
+    }
+}
+
 } // namespace WebCore
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index f3eac9a..689658e 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -244,6 +244,9 @@ namespace WebCore {
         static BOOL WINAPI hookedEndPaint(HWND, const PAINTSTRUCT*);
 #endif
 
+        static bool platformGetValueStatic(NPNVariable variable, void* value, NPError* result);
+        bool platformGetValue(NPNVariable variable, void* value, NPError* result);
+
         RefPtr<Frame> m_parentFrame;
         RefPtr<PluginPackage> m_plugin;
         Element* m_element;
diff --git a/WebCore/plugins/PluginViewNone.cpp b/WebCore/plugins/PluginViewNone.cpp
index f0d8a23..ed5ad1b 100644
--- a/WebCore/plugins/PluginViewNone.cpp
+++ b/WebCore/plugins/PluginViewNone.cpp
@@ -67,15 +67,15 @@ NPError PluginView::handlePostReadFile(Vector<char>&, uint32, const char*)
     return 0;
 }
 
-NPError PluginView::getValue(NPNVariable, void*)
+bool PluginView::platformGetValue(NPNVariable, void*, NPError*)
 {
-    return 0;
+    return false;
 }
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-NPError PluginView::getValueStatic(NPNVariable, void*)
+bool PluginView::platformGetValueStatic(NPNVariable, void*, NPError*)
 {
-    return 0;
+    return false;
 }
 #endif
 
diff --git a/WebCore/plugins/gtk/PluginViewGtk.cpp b/WebCore/plugins/gtk/PluginViewGtk.cpp
index d8cbffe..8de63e0 100644
--- a/WebCore/plugins/gtk/PluginViewGtk.cpp
+++ b/WebCore/plugins/gtk/PluginViewGtk.cpp
@@ -587,10 +587,8 @@ NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const c
     return NPERR_NO_ERROR;
 }
 
-NPError PluginView::getValueStatic(NPNVariable variable, void* value)
+bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result)
 {
-    LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
-
     switch (variable) {
     case NPNVToolkit:
 #if defined(XP_UNIX)
@@ -598,7 +596,8 @@ NPError PluginView::getValueStatic(NPNVariable variable, void* value)
 #else
         *static_cast<uint32*>(value) = 0;
 #endif
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     case NPNVSupportsXEmbedBool:
 #if defined(XP_UNIX)
@@ -606,11 +605,13 @@ NPError PluginView::getValueStatic(NPNVariable variable, void* value)
 #else
         *static_cast<NPBool*>(value) = false;
 #endif
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     case NPNVjavascriptEnabledBool:
         *static_cast<NPBool*>(value) = true;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     case NPNVSupportsWindowless:
 #if defined(XP_UNIX)
@@ -618,17 +619,16 @@ NPError PluginView::getValueStatic(NPNVariable variable, void* value)
 #else
         *static_cast<NPBool*>(value) = false;
 #endif
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     default:
-        return NPERR_GENERIC_ERROR;
+        return false;
     }
 }
 
-NPError PluginView::getValue(NPNVariable variable, void* value)
+bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* result)
 {
-    LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
-
     switch (variable) {
     case NPNVxDisplay:
 #if defined(XP_UNIX)
@@ -636,56 +636,21 @@ NPError PluginView::getValue(NPNVariable variable, void* value)
             *(void **)value = (void *)GDK_DISPLAY();
         else
             *(void **)value = (void *)GTK_XTBIN(platformPluginWidget())->xtclient.xtdisplay;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
 #else
-        return NPERR_GENERIC_ERROR;
+        *result = NPERR_GENERIC_ERROR;
 #endif
+        return true;
 
 #if defined(XP_UNIX)
     case NPNVxtAppContext:
         if (!m_needsXEmbed) {
             *(void **)value = XtDisplayToApplicationContext (GTK_XTBIN(platformPluginWidget())->xtclient.xtdisplay);
 
-            return NPERR_NO_ERROR;
+            *result = NPERR_NO_ERROR;
         } else
-            return NPERR_GENERIC_ERROR;
-#endif
-
-#if ENABLE(NETSCAPE_PLUGIN_API)
-        case NPNVWindowNPObject: {
-            if (m_isJavaScriptPaused)
-                return NPERR_GENERIC_ERROR;
-
-            NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
-
-            // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
-            if (windowScriptObject)
-                _NPN_RetainObject(windowScriptObject);
-
-            void** v = (void**)value;
-            *v = windowScriptObject;
-            
-            return NPERR_NO_ERROR;
-        }
-
-        case NPNVPluginElementNPObject: {
-            if (m_isJavaScriptPaused)
-                return NPERR_GENERIC_ERROR;
-
-            NPObject* pluginScriptObject = 0;
-
-            if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
-                pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
-
-            // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
-            if (pluginScriptObject)
-                _NPN_RetainObject(pluginScriptObject);
-
-            void** v = (void**)value;
-            *v = pluginScriptObject;
-
-            return NPERR_NO_ERROR;
-        }
+            *result = NPERR_GENERIC_ERROR;
+        return true;
 #endif
 
         case NPNVnetscapeWindow: {
@@ -697,19 +662,12 @@ NPError PluginView::getValue(NPNVariable variable, void* value)
             HGDIOBJ* w = reinterpret_cast<HGDIOBJ*>(value);
             *w = GDK_WINDOW_HWND(m_parentFrame->view()->hostWindow()->platformPageClient()->window);
 #endif
-            return NPERR_NO_ERROR;
-        }
-
-        case NPNVprivateModeBool: {
-            Page* page = m_parentFrame->page();
-            if (!page)
-                return NPERR_GENERIC_ERROR;
-            *((NPBool*)value) = !page->settings() || page->settings()->privateBrowsingEnabled();
-            return NPERR_NO_ERROR;
+            *result = NPERR_NO_ERROR;
+            return true;
         }
 
-        default:
-            return getValueStatic(variable, value);
+    default:
+        return false;
     }
 }
 
diff --git a/WebCore/plugins/mac/PluginViewMac.cpp b/WebCore/plugins/mac/PluginViewMac.cpp
index 762709d..1ac5024 100644
--- a/WebCore/plugins/mac/PluginViewMac.cpp
+++ b/WebCore/plugins/mac/PluginViewMac.cpp
@@ -254,33 +254,36 @@ void PluginView::platformDestroy()
 
 // Used before the plugin view has been initialized properly, and as a
 // fallback for variables that do not require a view to resolve.
-NPError PluginView::getValueStatic(NPNVariable variable, void* value)
+bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result)
 {
-    LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
-
     switch (variable) {
     case NPNVToolkit:
         *static_cast<uint32*>(value) = 0;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     case NPNVjavascriptEnabledBool:
         *static_cast<NPBool*>(value) = true;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
 #ifndef NP_NO_CARBON
     case NPNVsupportsCarbonBool:
         *static_cast<NPBool*>(value) = true;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
 #endif
     case NPNVsupportsCocoaBool:
         *static_cast<NPBool*>(value) = false;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     // CoreGraphics is the only drawing model we support
     case NPNVsupportsCoreGraphicsBool:
         *static_cast<NPBool*>(value) = true;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
 #ifndef NP_NO_QUICKDRAW
     // QuickDraw is deprecated in 10.5 and not supported on 64-bit
@@ -289,61 +292,20 @@ NPError PluginView::getValueStatic(NPNVariable variable, void* value)
     case NPNVsupportsOpenGLBool:
     case NPNVsupportsCoreAnimationBool:
         *static_cast<NPBool*>(value) = false;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     default:
-        return NPERR_GENERIC_ERROR;
+        return false;
     }
 }
 
 // Used only for variables that need a view to resolve
-NPError PluginView::getValue(NPNVariable variable, void* value)
+bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* error)
 {
-    LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
-
-    switch (variable) {
-    case NPNVWindowNPObject: {
-        if (m_isJavaScriptPaused)
-            return NPERR_GENERIC_ERROR;
-
-        NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
-
-        // Return value is expected to be retained, as described in
-        // <http://www.mozilla.org/projects/plugin/npruntime.html>
-        if (windowScriptObject)
-            _NPN_RetainObject(windowScriptObject);
-
-        void** v = (void**)value;
-        *v = windowScriptObject;
-
-        return NPERR_NO_ERROR;
-    }
-
-    case NPNVPluginElementNPObject: {
-        if (m_isJavaScriptPaused)
-            return NPERR_GENERIC_ERROR;
-
-        NPObject* pluginScriptObject = 0;
-
-        if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
-            pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
-
-        // Return value is expected to be retained, as described in
-        // <http://www.mozilla.org/projects/plugin/npruntime.html>
-        if (pluginScriptObject)
-            _NPN_RetainObject(pluginScriptObject);
-
-        void** v = (void**)value;
-        *v = pluginScriptObject;
-
-        return NPERR_NO_ERROR;
-    }
-
-    default:
-        return getValueStatic(variable, value);
-    }
-
+    return false;
 }
+
 void PluginView::setParent(ScrollView* parent)
 {
     LOG(Plugins, "PluginView::setParent(%p)", parent);
diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp
index 00a9073..fb88b87 100644
--- a/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/WebCore/plugins/qt/PluginViewQt.cpp
@@ -553,104 +553,64 @@ NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const c
     return NPERR_NO_ERROR;
 }
 
-NPError PluginView::getValueStatic(NPNVariable variable, void* value)
+bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result)
 {
-    LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
-
     switch (variable) {
     case NPNVToolkit:
         *static_cast<uint32*>(value) = 0;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     case NPNVSupportsXEmbedBool:
         *static_cast<NPBool*>(value) = true;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     case NPNVjavascriptEnabledBool:
         *static_cast<NPBool*>(value) = true;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     case NPNVSupportsWindowless:
         *static_cast<NPBool*>(value) = true;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     default:
-        return NPERR_GENERIC_ERROR;
+        return false;
     }
 }
 
-NPError PluginView::getValue(NPNVariable variable, void* value)
+bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* result)
 {
-    LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
-
     switch (variable) {
     case NPNVxDisplay:
         *(void **)value = QX11Info::display();
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     case NPNVxtAppContext:
-        return NPERR_GENERIC_ERROR;
-
-#if ENABLE(NETSCAPE_PLUGIN_API)
-    case NPNVWindowNPObject: {
-        if (m_isJavaScriptPaused)
-            return NPERR_GENERIC_ERROR;
-
-        NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
-
-        // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
-        if (windowScriptObject)
-            _NPN_RetainObject(windowScriptObject);
-
-        void** v = (void**)value;
-        *v = windowScriptObject;
-
-        return NPERR_NO_ERROR;
-    }
-
-    case NPNVPluginElementNPObject: {
-        if (m_isJavaScriptPaused)
-            return NPERR_GENERIC_ERROR;
-
-        NPObject* pluginScriptObject = 0;
-
-        if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
-            pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
-
-        // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
-        if (pluginScriptObject)
-            _NPN_RetainObject(pluginScriptObject);
-
-        void** v = (void**)value;
-        *v = pluginScriptObject;
-
-        return NPERR_NO_ERROR;
-    }
-#endif
+        *result = NPERR_GENERIC_ERROR;
+        return true;
 
     case NPNVnetscapeWindow: {
         void* w = reinterpret_cast<void*>(value);
         QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
         *((XID *)w) = client ? client->ownerWidget()->window()->winId() : 0;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
     }
 
     case NPNVToolkit:
         if (m_plugin->quirks().contains(PluginQuirkRequiresGtkToolKit)) {
             *((uint32 *)value) = 2;
-            return NPERR_NO_ERROR;
+            *result = NPERR_NO_ERROR;
+            return true;
         }
+        return false;
 
-    case NPNVprivateModeBool: {
-        Page* page = m_parentFrame->page();
-        if (!page)
-            return NPERR_GENERIC_ERROR;
-        *((NPBool*)value) = !page->settings() || page->settings()->privateBrowsingEnabled();
-        return NPERR_NO_ERROR;
-    }
-        // fall through
     default:
-        return getValueStatic(variable, value);
+        return false;
     }
 }
 
diff --git a/WebCore/plugins/symbian/PluginViewSymbian.cpp b/WebCore/plugins/symbian/PluginViewSymbian.cpp
index 3492868..3f3e2c0 100644
--- a/WebCore/plugins/symbian/PluginViewSymbian.cpp
+++ b/WebCore/plugins/symbian/PluginViewSymbian.cpp
@@ -307,66 +307,27 @@ NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const c
     return NPERR_NO_ERROR;
 }
 
-NPError PluginView::getValueStatic(NPNVariable variable, void* value)
+bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result)
 {
-    LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
-
     switch (variable) {
     case NPNVjavascriptEnabledBool:
         *static_cast<NPBool*>(value) = true;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     case NPNVSupportsWindowless:
         *static_cast<NPBool*>(value) = true;
-        return NPERR_NO_ERROR;
+        *result = NPERR_NO_ERROR;
+        return true;
 
     default:
-        return NPERR_GENERIC_ERROR;
+        return false;
     }
 }
 
-NPError PluginView::getValue(NPNVariable variable, void* value)
+bool PluginView::platformGetValue(NPNVariable, void*, NPError*)
 {
-    LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
-
-    switch (variable) {
-    case NPNVWindowNPObject: {
-        if (m_isJavaScriptPaused)
-            return NPERR_GENERIC_ERROR;
-
-        NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
-
-        // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
-        if (windowScriptObject)
-            _NPN_RetainObject(windowScriptObject);
-
-        void** v = (void**)value;
-        *v = windowScriptObject;
-            
-        return NPERR_NO_ERROR;
-    }
-
-    case NPNVPluginElementNPObject: {
-        if (m_isJavaScriptPaused)
-            return NPERR_GENERIC_ERROR;
-
-        NPObject* pluginScriptObject = 0;
-
-        if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
-            pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
-
-        // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
-        if (pluginScriptObject)
-            _NPN_RetainObject(pluginScriptObject);
-
-        void** v = (void**)value;
-        *v = pluginScriptObject;
-
-        return NPERR_NO_ERROR;
-    }        
-    default:
-        return getValueStatic(variable, value);
-    }
+    return false;
 }
 
 void PluginView::invalidateRect(const IntRect& rect)
diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp
index 04fda8e..15f39a9 100644
--- a/WebCore/plugins/win/PluginViewWin.cpp
+++ b/WebCore/plugins/win/PluginViewWin.cpp
@@ -26,44 +26,39 @@
  */
 
 #include "config.h"
-
 #include "PluginView.h"
 
 #include "BitmapImage.h"
-#if !PLATFORM(WX)
-#include "BitmapInfo.h"
-#endif
 #include "Bridge.h"
 #include "Document.h"
 #include "DocumentLoader.h"
 #include "Element.h"
 #include "EventNames.h"
-#include "FrameLoader.h"
+#include "FocusController.h"
+#include "Frame.h"
 #include "FrameLoadRequest.h"
+#include "FrameLoader.h"
 #include "FrameTree.h"
-#include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
-#include "HostWindow.h"
-#include "Image.h"
 #include "HTMLNames.h"
 #include "HTMLPlugInElement.h"
+#include "HostWindow.h"
+#include "Image.h"
+#include "JSDOMBinding.h"
 #include "JSDOMWindow.h"
 #include "KeyboardEvent.h"
 #include "MIMETypeRegistry.h"
 #include "MouseEvent.h"
 #include "Page.h"
-#include "FocusController.h"
 #include "PlatformMouseEvent.h"
+#include "PluginDatabase.h"
+#include "PluginDebug.h"
+#include "PluginMainThreadScheduler.h"
 #include "PluginMessageThrottlerWin.h"
 #include "PluginPackage.h"
-#include "PluginMainThreadScheduler.h"
 #include "RenderWidget.h"
-#include "JSDOMBinding.h"
 #include "ScriptController.h"
-#include "PluginDatabase.h"
-#include "PluginDebug.h"
-#include "PluginPackage.h"
 #include "Settings.h"
 #include "c_instance.h"
 #include "npruntime_impl.h"
@@ -72,6 +67,10 @@
 #include <runtime/JSValue.h>
 #include <wtf/ASCIICType.h>
 
+#if !PLATFORM(WX)
+#include "BitmapInfo.h"
+#endif
+
 #if OS(WINCE)
 #undef LOG_NPERROR
 #define LOG_NPERROR(x)
@@ -867,73 +866,30 @@ NPError PluginView::handlePostReadFile(Vector<char>& buffer, uint32 len, const c
     return NPERR_NO_ERROR;
 }
 
-NPError PluginView::getValueStatic(NPNVariable variable, void* value)
+bool PluginView::platformGetValueStatic(NPNVariable, void*, NPError*)
 {
-    LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
-
-    return NPERR_GENERIC_ERROR;
+    return false;
 }
 
-NPError PluginView::getValue(NPNVariable variable, void* value)
+bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* result)
 {
-    LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
-
     switch (variable) {
-#if ENABLE(NETSCAPE_PLUGIN_API)
-        case NPNVWindowNPObject: {
-            if (m_isJavaScriptPaused)
-                return NPERR_GENERIC_ERROR;
-
-            NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
-
-            // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
-            if (windowScriptObject)
-                _NPN_RetainObject(windowScriptObject);
-
-            void** v = (void**)value;
-            *v = windowScriptObject;
-
-            return NPERR_NO_ERROR;
-        }
-
-        case NPNVPluginElementNPObject: {
-            if (m_isJavaScriptPaused)
-                return NPERR_GENERIC_ERROR;
-
-            NPObject* pluginScriptObject = 0;
-
-            if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
-                pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
-
-            // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
-            if (pluginScriptObject)
-                _NPN_RetainObject(pluginScriptObject);
-
-            void** v = (void**)value;
-            *v = pluginScriptObject;
-
-            return NPERR_NO_ERROR;
-        }
-#endif
-
         case NPNVnetscapeWindow: {
             HWND* w = reinterpret_cast<HWND*>(value);
-
             *w = windowHandleForPageClient(parent() ? parent()->hostWindow()->platformPageClient() : 0);
-
-            return NPERR_NO_ERROR;
+            *result = NPERR_NO_ERROR;
+            return true;
         }
 
         case NPNVSupportsWindowless: {
-            NPBool *result = reinterpret_cast<NPBool*>(value);
-
-            *result = TRUE;
-            
-            return NPERR_NO_ERROR;
+            NPBool* flag = reinterpret_cast<NPBool*>(value);
+            *flag = TRUE;
+            *result = NPERR_NO_ERROR;
+            return true;
         }
 
-        default:
-            return NPERR_GENERIC_ERROR;
+    default:
+        return false;
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list