[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

andersca at apple.com andersca at apple.com
Thu Oct 29 20:43:57 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit c912076a6dcb9d88fc8ff95ded1831df4e987201
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 13 21:59:54 2009 +0000

    <rdar://problem/6660507> Add "privacy mode" to Netscape Plug-in API
    
    Reviewed by Sam Weinig.
    
    WebKit/mac:
    
    Listen for WebPreferences notifications and update the _isPrivateBrowsingEnabled ivar
    when the value changes. Also call -[WebBaseNetscapePluginView privateBrowsingModeDidChange] when the
    value changes. In process this just calls NPP_SetValue, and OOP it sends a MIG message to the plug-in host.
    
    * Plugins/Hosted/NetscapePluginHostManager.h:
    * Plugins/Hosted/NetscapePluginHostManager.mm:
    (WebKit::NetscapePluginHostManager::instantiatePlugin):
    * Plugins/Hosted/NetscapePluginInstanceProxy.h:
    * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
    (WebKit::NetscapePluginInstanceProxy::privateBrowsingModeDidChange):
    * Plugins/Hosted/WebHostedNetscapePluginView.mm:
    (-[WebHostedNetscapePluginView createPlugin]):
    (-[WebHostedNetscapePluginView privateBrowsingModeDidChange]):
    * Plugins/Hosted/WebKitPluginHost.defs:
    * Plugins/WebBaseNetscapePluginView.h:
    * Plugins/WebBaseNetscapePluginView.mm:
    (-[WebBaseNetscapePluginView privateBrowsingModeDidChange]):
    (-[WebBaseNetscapePluginView viewDidMoveToWindow]):
    (-[WebBaseNetscapePluginView preferencesHaveChanged:]):
    * Plugins/WebNetscapePluginView.mm:
    (-[WebNetscapePluginView privateBrowsingModeDidChange]):
    (-[WebNetscapePluginView getVariable:value:]):
    
    WebKitTools:
    
    Make the private browsing mode testable by the test plug-in.
    
    * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
    (pluginGetProperty):
    * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
    * DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp:
    (NPP_New):
    (NPP_SetValue):
    
    LayoutTests:
    
    Add test.
    
    * platform/mac-snowleopard/Skipped:
    Remove now passing tests that was fixed by https://bugs.webkit.org/show_bug.cgi?id=30295.
    
    * plugins/private-browsing-mode-expected.txt: Added.
    * plugins/private-browsing-mode.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49512 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ae37ec9..a54ab57 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2009-10-13  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        <rdar://problem/6660507> Add "privacy mode" to Netscape Plug-in API
+
+        Add test.
+        
+        * platform/mac-snowleopard/Skipped:
+        Remove now passing tests that was fixed by https://bugs.webkit.org/show_bug.cgi?id=30295.
+        
+        * plugins/private-browsing-mode-expected.txt: Added.
+        * plugins/private-browsing-mode.html: Added.
+
 2009-10-13  Michelangelo De Simone  <micdesim at gmail.com>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/platform/mac-snowleopard/Skipped b/LayoutTests/platform/mac-snowleopard/Skipped
index 86a28de..ef8f89a 100644
--- a/LayoutTests/platform/mac-snowleopard/Skipped
+++ b/LayoutTests/platform/mac-snowleopard/Skipped
@@ -5,9 +5,6 @@ plugins/netscape-throw-exception.html
 plugins/netscape-destroy-plugin-script-objects.html
 plugins/open-and-close-window-with-plugin.html
 
-plugins/mouse-events.html
-plugins/return-error-from-new-stream-doesnt-invoke-destroy-stream.html
-
 # Radar bugs needed for these
 fast/canvas/set-colors.html
 svg/W3C-SVG-1.1/coords-viewattr-01-b.svg
diff --git a/LayoutTests/plugins/private-browsing-mode-expected.txt b/LayoutTests/plugins/private-browsing-mode-expected.txt
new file mode 100644
index 0000000..78a293c
--- /dev/null
+++ b/LayoutTests/plugins/private-browsing-mode-expected.txt
@@ -0,0 +1,12 @@
+Tests that the private browsing API implementation works as expected
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS plugin1.privateBrowsingEnabled is false
+PASS plugin1.cachedPrivateBrowsingEnabled is false
+PASS plugin1.privateBrowsingEnabled is true
+PASS plugin1.cachedPrivateBrowsingEnabled is true
+PASS plugin2.privateBrowsingEnabled is true
+PASS plugin2.cachedPrivateBrowsingEnabled is true
+
diff --git a/LayoutTests/plugins/private-browsing-mode.html b/LayoutTests/plugins/private-browsing-mode.html
new file mode 100644
index 0000000..0094b43
--- /dev/null
+++ b/LayoutTests/plugins/private-browsing-mode.html
@@ -0,0 +1,44 @@
+<head>
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body onload="runTest()">
+<p id="description"></p>
+<div id="console"></div>
+<script>
+function runTest() 
+{
+    if (!window.layoutTestController) {
+        debug("This test can only run from within DumpRenderTree because it requires TestNetscapePlugin.\n");
+        return;
+    }
+    
+    plugin1 = document.createElement("embed");
+    plugin1.type = "application/x-webkit-test-netscape";
+    document.body.appendChild(plugin1);
+    
+    shouldBe("plugin1.privateBrowsingEnabled", "false");
+    shouldBe("plugin1.cachedPrivateBrowsingEnabled", "false");
+
+    // Now enable private browsing
+    layoutTestController.setPrivateBrowsingEnabled(true);
+
+    shouldBe("plugin1.privateBrowsingEnabled", "true");
+    shouldBe("plugin1.cachedPrivateBrowsingEnabled", "true");
+    
+    plugin2 = document.createElement("embed");
+    plugin2.type = "application/x-webkit-test-netscape";
+    document.body.appendChild(plugin2);
+    
+    shouldBe("plugin2.privateBrowsingEnabled", "true");
+    shouldBe("plugin2.cachedPrivateBrowsingEnabled", "true");
+    
+}
+</script>
+
+<script>
+description("Tests that the private browsing API implementation works as expected");
+
+
+successfullyParsed = true;
+</script>
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 2200f2c..9c42339 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,32 @@
+2009-10-13  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        <rdar://problem/6660507> Add "privacy mode" to Netscape Plug-in API
+
+        Listen for WebPreferences notifications and update the _isPrivateBrowsingEnabled ivar 
+        when the value changes. Also call -[WebBaseNetscapePluginView privateBrowsingModeDidChange] when the
+        value changes. In process this just calls NPP_SetValue, and OOP it sends a MIG message to the plug-in host.
+        
+        * Plugins/Hosted/NetscapePluginHostManager.h:
+        * Plugins/Hosted/NetscapePluginHostManager.mm:
+        (WebKit::NetscapePluginHostManager::instantiatePlugin):
+        * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+        (WebKit::NetscapePluginInstanceProxy::privateBrowsingModeDidChange):
+        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+        (-[WebHostedNetscapePluginView createPlugin]):
+        (-[WebHostedNetscapePluginView privateBrowsingModeDidChange]):
+        * Plugins/Hosted/WebKitPluginHost.defs:
+        * Plugins/WebBaseNetscapePluginView.h:
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (-[WebBaseNetscapePluginView privateBrowsingModeDidChange]):
+        (-[WebBaseNetscapePluginView viewDidMoveToWindow]):
+        (-[WebBaseNetscapePluginView preferencesHaveChanged:]):
+        * Plugins/WebNetscapePluginView.mm:
+        (-[WebNetscapePluginView privateBrowsingModeDidChange]):
+        (-[WebNetscapePluginView getVariable:value:]):
+
 2009-10-12  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
index a1d9bad..9e29062 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
@@ -43,7 +43,7 @@ class NetscapePluginHostManager {
 public:
     static NetscapePluginHostManager& shared();
     
-    PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(WebNetscapePluginPackage *, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame);
+    PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(WebNetscapePluginPackage *, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled);
 
     void pluginHostDied(NetscapePluginHostProxy*);
 
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
index 4aa290a..6b36a6d 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
@@ -211,7 +211,7 @@ void NetscapePluginHostManager::pluginHostDied(NetscapePluginHostProxy* pluginHo
     }
 }
 
-PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(WebNetscapePluginPackage *pluginPackage, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame)
+PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(WebNetscapePluginPackage *pluginPackage, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled)
 {
     NetscapePluginHostProxy* hostProxy = hostForPackage(pluginPackage);
     if (!hostProxy)
@@ -235,6 +235,7 @@ PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePl
         [properties.get() setObject:[sourceURL absoluteString] forKey:@"sourceURL"];
     
     [properties.get() setObject:[NSNumber numberWithBool:fullFrame] forKey:@"fullFrame"];
+    [properties.get() setObject:[NSNumber numberWithBool:isPrivateBrowsingEnabled] forKey:@"privateBrowsingEnabled"];
     
     NSData *data = [NSPropertyListSerialization dataFromPropertyList:properties.get() format:NSPropertyListBinaryFormat_v1_0 errorDescription:nil];
     ASSERT(data);
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
index 280f161..c950ab7 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
@@ -163,6 +163,7 @@ public:
     void resolveURL(const char* url, const char* target, data_t& resolvedURLData, mach_msg_type_number_t& resolvedURLLength);
     
     void didDraw();
+    void privateBrowsingModeDidChange(bool isPrivateBrowsingEnabled);
     
     // Reply structs
     struct Reply {
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index 21f35e2..782520c 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -1442,6 +1442,11 @@ void NetscapePluginInstanceProxy::resolveURL(const char* url, const char* target
     memcpy(resolvedURLData, resolvedURL.data(), resolvedURLLength);
 }
 
+void NetscapePluginInstanceProxy::privateBrowsingModeDidChange(bool isPrivateBrowsingEnabled)
+{
+    _WKPHPluginInstancePrivateBrowsingModeDidChange(m_pluginHostProxy->port(), m_pluginID, isPrivateBrowsingEnabled);
+}
+
 } // namespace WebKit
 
 #endif // USE(PLUGIN_HOST_PROCESS)
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 34a2211..356d141 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -102,7 +102,8 @@ extern "C" {
 
     NSString *userAgent = [[self webView] userAgentForURL:_baseURL.get()];
 
-    _proxy = NetscapePluginHostManager::shared().instantiatePlugin(_pluginPackage.get(), self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(), _mode == NP_FULL);
+    _proxy = NetscapePluginHostManager::shared().instantiatePlugin(_pluginPackage.get(), self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(), 
+                                                                   _mode == NP_FULL, _isPrivateBrowsingEnabled);
     if (!_proxy) 
         return NO;
 
@@ -128,6 +129,12 @@ extern "C" {
         [newLayer addSublayer:_pluginLayer.get()];
 }
 
+- (void)privateBrowsingModeDidChange
+{
+    if (_proxy)
+        _proxy->privateBrowsingModeDidChange(_isPrivateBrowsingEnabled);
+}
+
 - (void)loadStream
 {
 }
diff --git a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
index 04edf64..9882bb5 100644
--- a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
+++ b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
@@ -236,4 +236,8 @@ simpleroutine PHBooleanAndDataReply(pluginHostPort :mach_port_t;
              
 simpleroutine PHPluginInstanceDidDraw(pluginHostPort :mach_port_t;
                                       pluginID :uint32_t);
+simpleroutine PHPluginInstancePrivateBrowsingModeDidChange(pluginHostPort :mach_port_t;
+                                                           pluginID :uint32_t;
+                                                           privateBrowsingEnabled :boolean_t);
+
                               
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index bd05ebe..a5dbdca 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -62,6 +62,7 @@ class WebHaltablePlugin;
     BOOL _isStarted;
     BOOL _hasFocus;
     BOOL _isCompletelyObscured;
+    BOOL _isPrivateBrowsingEnabled;
     
     RefPtr<WebCore::HTMLPlugInElement> _element;
     RetainPtr<NSString> _MIMEType;
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index 4af043d..2c9a630 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -243,6 +243,10 @@ private:
     ASSERT_NOT_REACHED();
 }
 
+- (void)privateBrowsingModeDidChange
+{
+}
+
 - (void)removeTrackingRect
 {
     if (_trackingTag) {
@@ -506,6 +510,8 @@ private:
                                                      name:WebPreferencesChangedNotification
                                                    object:nil];
 
+        _isPrivateBrowsingEnabled = [[[self webView] preferences] privateBrowsingEnabled];
+        
         // View moved to an actual window. Start it if not already started.
         [self start];
 
@@ -586,9 +592,12 @@ private:
 - (void)preferencesHaveChanged:(NSNotification *)notification
 {
     WebPreferences *preferences = [[self webView] preferences];
-    BOOL arePlugInsEnabled = [preferences arePlugInsEnabled];
+
+    if ([notification object] != preferences)
+        return;
     
-    if ([notification object] == preferences && _isStarted != arePlugInsEnabled) {
+    BOOL arePlugInsEnabled = [preferences arePlugInsEnabled];
+    if (_isStarted != arePlugInsEnabled) {
         if (arePlugInsEnabled) {
             if ([self currentWindow]) {
                 [self start];
@@ -598,6 +607,12 @@ private:
             [self invalidatePluginContentRect:[self bounds]];
         }
     }
+    
+    BOOL isPrivateBrowsingEnabled = [preferences privateBrowsingEnabled];
+    if (isPrivateBrowsingEnabled != _isPrivateBrowsingEnabled) {
+        _isPrivateBrowsingEnabled = isPrivateBrowsingEnabled;
+        [self privateBrowsingModeDidChange];
+    }
 }
 
 - (void)renewGState
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index 5debb97..5ecfba3 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -838,6 +838,21 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
     _eventHandler->syntheticKeyDownWithCommandModifier(keyCode, character);
 }
 
+- (void)privateBrowsingModeDidChange
+{
+    if (!_isStarted)
+        return;
+    
+    NPBool value = _isPrivateBrowsingEnabled;
+
+    [self willCallPlugInFunction];
+    {
+        JSC::JSLock::DropAllLocks dropAllLocks(JSC::SilenceAssertionsOnly);
+        [_pluginPackage.get() pluginFuncs]->setvalue(plugin, NPNVprivateModeBool, &value);
+    }
+    [self didCallPlugInFunction];
+}
+
 #pragma mark WEB_NETSCAPE_PLUGIN
 
 - (BOOL)isNewWindowEqualToOldWindow
@@ -2022,13 +2037,19 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
             return NPERR_NO_ERROR;
         }
 #endif /* NP_NO_CARBON */
-            
+
         case NPNVsupportsCocoaBool:
         {
             *(NPBool *)value = TRUE;
             return NPERR_NO_ERROR;
         }
 
+        case NPNVprivateModeBool:
+        {
+            *(NPBool *)value = _isPrivateBrowsingEnabled;
+            return NPERR_NO_ERROR;
+        }
+
         case WKNVBrowserContainerCheckFuncs:
         {
             *(WKNBrowserContainerCheckFuncs **)value = browserContainerCheckFuncs();
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index d0ab8eb..964817e 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,18 @@
+2009-10-13  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        <rdar://problem/6660507> Add "privacy mode" to Netscape Plug-in API
+
+        Make the private browsing mode testable by the test plug-in.
+        
+        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
+        (pluginGetProperty):
+        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
+        * DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp:
+        (NPP_New):
+        (NPP_SetValue):
+
 2009-10-13  Pavel Feldman  <pfeldman at chromium.org>
 
         No review, just adding self to the list of reviewers.
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
index 3a04c3c..8a61bb6 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
@@ -106,13 +106,17 @@ NPClass *getPluginClass(void)
 
 static bool identifiersInitialized = false;
 
-#define ID_PROPERTY_PROPERTY                    0
-#define ID_PROPERTY_EVENT_LOGGING               1
-#define ID_PROPERTY_HAS_STREAM                  2
-#define ID_PROPERTY_TEST_OBJECT                 3
-#define ID_PROPERTY_LOG_DESTROY                 4
-#define ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM 5
-#define NUM_PROPERTY_IDENTIFIERS                6
+enum {
+    ID_PROPERTY_PROPERTY = 0,
+    ID_PROPERTY_EVENT_LOGGING,
+    ID_PROPERTY_HAS_STREAM,
+    ID_PROPERTY_TEST_OBJECT,
+    ID_PROPERTY_LOG_DESTROY,
+    ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM,
+    ID_PROPERTY_PRIVATE_BROWSING_ENABLED,
+    ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED,
+    NUM_PROPERTY_IDENTIFIERS
+};
 
 static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
 static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
@@ -122,6 +126,8 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
     "testObject",
     "logDestroy",
     "returnErrorFromNewStream",
+    "privateBrowsingEnabled",
+    "cachedPrivateBrowsingEnabled",
 };
 
 enum {
@@ -226,6 +232,14 @@ static bool pluginGetProperty(NPObject* obj, NPIdentifier name, NPVariant* resul
     } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) {
         BOOLEAN_TO_NPVARIANT(plugin->returnErrorFromNewStream, *result);
         return true;
+    } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_PRIVATE_BROWSING_ENABLED]) {
+        NPBool privateBrowsingEnabled = FALSE;
+        browser->getvalue(plugin->npp, NPNVprivateModeBool, &privateBrowsingEnabled);
+        BOOLEAN_TO_NPVARIANT(privateBrowsingEnabled, *result);
+        return true;
+    } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED]) {
+        BOOLEAN_TO_NPVARIANT(plugin->cachedPrivateBrowsingMode, *result);
+        return true;
     }
     return false;
 }
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
index 17b11e1..7437d04 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
@@ -35,6 +35,7 @@ typedef struct {
     NPBool logSetWindow;
     NPBool logDestroy;
     NPBool returnErrorFromNewStream;
+    NPBool cachedPrivateBrowsingMode;
     NPObject* testObject;
     NPStream* stream;
     char* onStreamLoad;
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
index 88618c3..125d2e8 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
@@ -130,7 +130,9 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
         return NPERR_INCOMPATIBLE_VERSION_ERROR;
     }
     
+    browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
     browser->setvalue(instance, NPPVpluginEventModel, (void *)obj->eventModel);
+    
     return NPERR_NO_ERROR;
 }
 
@@ -383,5 +385,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