summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-11-05 09:23:40 +0000
committerSteve Block <steveblock@google.com>2009-11-10 22:41:12 +0000
commitcac0f67c402d107cdb10971b95719e2ff9c7c76b (patch)
treed182c7f87211c6f201a5f038e332336493ebdbe7 /WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
parent4b2ef0f288e7c6c4602f621b7a0e9feed304b70e (diff)
downloadexternal_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.zip
external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.gz
external_webkit-cac0f67c402d107cdb10971b95719e2ff9c7c76b.tar.bz2
Merge webkit.org at r50258 : Initial merge by git.
Change-Id: I1a9e1dc4ed654b69174ad52a4f031a07240f37b0
Diffstat (limited to 'WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp')
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp40
1 files changed, 30 insertions, 10 deletions
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
index 3a04c3c..14280ba 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 {
@@ -144,6 +150,7 @@ enum {
ID_TEST_POSTURL_FILE,
ID_TEST_CONSTRUCT,
ID_TEST_THROW_EXCEPTION_METHOD,
+ ID_TEST_FAIL_METHOD,
ID_DESTROY_NULL_STREAM,
NUM_METHOD_IDENTIFIERS
};
@@ -169,6 +176,7 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testPostURLFile",
"testConstruct",
"testThrowException",
+ "testFail",
"destroyNullStream"
};
@@ -226,6 +234,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;
}
@@ -309,13 +325,13 @@ static NPIdentifier variantToIdentifier(NPVariant variant)
static bool testIdentifierToString(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount != 1)
- return false;
+ return true;
NPIdentifier identifier = variantToIdentifier(args[0]);
if (!identifier)
- return false;
+ return true;
NPUTF8* utf8String = browser->utf8fromidentifier(identifier);
if (!utf8String)
- return false;
+ return true;
STRINGZ_TO_NPVARIANT(utf8String, *result);
return true;
}
@@ -669,6 +685,10 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
else if (name == pluginMethodIdentifiers[ID_TEST_THROW_EXCEPTION_METHOD]) {
browser->setexception(header, "plugin object testThrowException SUCCESS");
return true;
+ } else if (name == pluginMethodIdentifiers[ID_TEST_FAIL_METHOD]) {
+ NPObject* windowScriptObject;
+ browser->getvalue(plugin->npp, NPNVWindowNPObject, &windowScriptObject);
+ browser->invoke(plugin->npp, windowScriptObject, name, args, argCount, result);
} else if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM])
return destroyNullStream(plugin, args, argCount, result);