[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:03 UTC 2010


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

    Bug 35576: WebKit should tell plug-in instances when private browsing state changes
    <http://webkit.org/b/35576>
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    Notify plug-in instances when the private browsing state changes to match the behavior of the
    Mac plug-in code.
    
    * page/Page.cpp:
    (WebCore::Page::privateBrowsingStateChanged): Walk the frame tree and notify each PluginView that
    the private browsing state has changed.
    * page/Page.h:
    * page/Settings.cpp:
    (WebCore::Settings::setPrivateBrowsingEnabled): Notify the page that the private browsing state
    has changed.
    * plugins/PluginView.cpp:
    (WebCore::PluginView::privateBrowsingStateChanged): Notify the plug-in instance of the new private
    browsing state.
    * plugins/PluginView.h:
    
    WebKitTools:
    
    TestNetscapePlugin is another bit of plug-in code where copy-paste was heavily used
    when porting.  Update the Windows and UNIX implementations of NPP_New and NPP_SetValue
    to provide the expected behavior related to NPNVprivateModeBool.  Hopefully this code
    duplication can be cleaned up in the future.
    
    * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
    (webkit_test_plugin_new_instance):
    (webkit_test_plugin_set_value):
    * DumpRenderTree/win/TestNetscapePlugin/main.cpp:
    (NPP_New):
    (NPP_SetValue):
    
    LayoutTests:
    
    * platform/win/Skipped: Remove plugins/private-browsing-mode.html now that it passes.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55433 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index bddbeaf..4c80092 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,14 @@
 2010-03-02  Mark Rowe  <mrowe at apple.com>
 
+        Reviewed by Darin Adler.
+
+        Bug 35576: WebKit should tell plug-in instances when private browsing state changes
+        <http://webkit.org/b/35576>
+
+        * platform/win/Skipped: Remove plugins/private-browsing-mode.html now that it passes.
+
+2010-03-02  Mark Rowe  <mrowe at apple.com>
+
         Reviewed by Oliver Hunt.
 
         Bug 30348: Implement private mode for plug-ins on Windows
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index 52f9915..53d3090 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -671,9 +671,6 @@ http/tests/xmlhttprequest/xmlhttprequest-missing-file-exception.html
 fast/dom/Window/slow-unload-handler.html
 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
-
 # 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 c0bc157..44a4131 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,27 @@
 2010-03-02  Mark Rowe  <mrowe at apple.com>
 
+        Reviewed by Darin Adler.
+
+        Bug 35576: WebKit should tell plug-in instances when private browsing state changes
+        <http://webkit.org/b/35576>
+
+        Notify plug-in instances when the private browsing state changes to match the behavior of the
+        Mac plug-in code.
+
+        * page/Page.cpp:
+        (WebCore::Page::privateBrowsingStateChanged): Walk the frame tree and notify each PluginView that
+        the private browsing state has changed.
+        * page/Page.h:
+        * page/Settings.cpp:
+        (WebCore::Settings::setPrivateBrowsingEnabled): Notify the page that the private browsing state
+        has changed.
+        * plugins/PluginView.cpp:
+        (WebCore::PluginView::privateBrowsingStateChanged): Notify the plug-in instance of the new private
+        browsing state.
+        * plugins/PluginView.h:
+
+2010-03-02  Mark Rowe  <mrowe at apple.com>
+
         Reviewed by Oliver Hunt.
 
         Bug 30348: Implement private mode for plug-ins on Windows
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index fd235a7..6321855 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -52,6 +52,7 @@
 #include "PageGroup.h"
 #include "PluginData.h"
 #include "PluginHalter.h"
+#include "PluginView.h"
 #include "ProgressTracker.h"
 #include "RenderWidget.h"
 #include "RenderTheme.h"
@@ -775,6 +776,35 @@ InspectorTimelineAgent* Page::inspectorTimelineAgent() const
 }
 #endif
 
+void Page::privateBrowsingStateChanged()
+{
+    bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled();
+
+    // Collect the PluginViews in to a vector to ensure that action the plug-in takes
+    // from below privateBrowsingStateChanged does not affect their lifetime.
+
+    Vector<RefPtr<PluginView>, 32> pluginViews;
+    for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+        FrameView* view = frame->view();
+        if (!view)
+            return;
+
+        const HashSet<RefPtr<Widget> >* children = view->children();
+        ASSERT(children);
+
+        HashSet<RefPtr<Widget> >::const_iterator end = children->end();
+        for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(); it != end; ++it) {
+            Widget* widget = (*it).get();
+            if (!widget->isPluginView())
+                continue;
+            pluginViews.append(static_cast<PluginView*>(widget));
+        }
+    }
+
+    for (size_t i = 0; i < pluginViews.size(); i++)
+        pluginViews[i]->privateBrowsingStateChanged(privateBrowsingEnabled);
+}
+
 void Page::pluginAllowedRunTimeChanged()
 {
     if (m_pluginHalter)
diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h
index 04a545c..2a90ca7 100644
--- a/WebCore/page/Page.h
+++ b/WebCore/page/Page.h
@@ -197,6 +197,8 @@ namespace WebCore {
         void userStyleSheetLocationChanged();
         const String& userStyleSheet() const;
 
+        void privateBrowsingStateChanged();
+
         void didStartPlugin(HaltablePlugin*);
         void didStopPlugin(HaltablePlugin*);
         void pluginAllowedRunTimeChanged();
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index 57f3cdd..2783bcc 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -277,7 +277,11 @@ void Settings::setLocalStorageQuota(unsigned localStorageQuota)
 
 void Settings::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
 {
+    if (m_privateBrowsingEnabled == privateBrowsingEnabled)
+        return;
+
     m_privateBrowsingEnabled = privateBrowsingEnabled;
+    m_page->privateBrowsingStateChanged();
 }
 
 void Settings::setJavaScriptCanOpenWindowsAutomatically(bool javaScriptCanOpenWindowsAutomatically)
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index 5ac3ec8..f13a2d6 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -1373,4 +1373,19 @@ NPError PluginView::getValue(NPNVariable variable, void* value)
     }
 }
 
+void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled)
+{
+    NPP_SetValueProcPtr setValue = m_plugin->pluginFuncs()->setvalue;
+    if (!setValue)
+        return;
+
+    PluginView::setCurrentPluginView(this);
+    JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly);
+    setCallingPlugin(true);
+    NPBool value = privateBrowsingEnabled;
+    setValue(m_instance, NPNVprivateModeBool, &value);
+    setCallingPlugin(false);
+    PluginView::setCurrentPluginView(0);
+}
+
 } // namespace WebCore
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index 689658e..21a25f6 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -156,6 +156,8 @@ namespace WebCore {
 
         void setJavaScriptPaused(bool);
 
+        void privateBrowsingStateChanged(bool);
+
         void disconnectStream(PluginStream*);
         void streamDidFinishLoading(PluginStream* stream) { disconnectStream(stream); }
 
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 995ac25..7a16921 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,22 @@
+2010-03-02  Mark Rowe  <mrowe at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Bug 35576: WebKit should tell plug-in instances when private browsing state changes
+        <http://webkit.org/b/35576>
+
+        TestNetscapePlugin is another bit of plug-in code where copy-paste was heavily used
+        when porting.  Update the Windows and UNIX implementations of NPP_New and NPP_SetValue
+        to provide the expected behavior related to NPNVprivateModeBool.  Hopefully this code
+        duplication can be cleaned up in the future.
+
+        * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp:
+        (webkit_test_plugin_new_instance):
+        (webkit_test_plugin_set_value):
+        * DumpRenderTree/win/TestNetscapePlugin/main.cpp:
+        (NPP_New):
+        (NPP_SetValue):
+
 2010-03-02  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
index cb01267..a532b65 100644
--- a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
+++ b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
@@ -58,6 +58,7 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/,
 {
     if (browser->version >= 14) {
         PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
+        instance->pdata = obj;
 
         for (int i = 0; i < argc; i++) {
             if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
@@ -86,7 +87,8 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/,
             else if (strcasecmp(argn[i], "testwindowopen") == 0)
                 obj->testWindowOpen = TRUE;
         }
-        instance->pdata = obj;
+
+        browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
     }
 
     return NPERR_NO_ERROR;
@@ -282,9 +284,17 @@ webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value)
 }
 
 static NPError
-webkit_test_plugin_set_value(NPP /*instance*/, NPNVariable /*variable*/, void* /*value*/)
+webkit_test_plugin_set_value(NPP instance, NPNVariable variable, void* value)
 {
-    return NPERR_NO_ERROR;
+    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+
+    switch (variable) {
+        case NPNVprivateModeBool:
+            obj->cachedPrivateBrowsingMode = *(NPBool*)value;
+            return NPERR_NO_ERROR;
+        default:
+            return NPERR_GENERIC_ERROR;
+    }
 }
 
 char *
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
index 08a2f6a..09e6f93 100644
--- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
+++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
@@ -89,7 +89,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
 {
     if (browser->version >= 14) {
         PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
-        
+        instance->pdata = obj;
+
         for (int16 i = 0; i < argc; i++) {
             if (_stricmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
                 obj->onStreamLoad = _strdup(argv[i]);
@@ -108,8 +109,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
               else if (_stricmp(argn[i], "testwindowopen") == 0)
                 obj->testWindowOpen = TRUE;
         }
-        
-        instance->pdata = obj;
+
+        browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
     }
 
     return NPERR_NO_ERROR;
@@ -238,5 +239,13 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
 
 NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
 {
-    return NPERR_GENERIC_ERROR;
+    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+
+    switch (variable) {
+        case NPNVprivateModeBool:
+            obj->cachedPrivateBrowsingMode = *(NPBool*)value;
+            return NPERR_NO_ERROR;
+        default:
+            return NPERR_GENERIC_ERROR;
+    }
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list