Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1512)

Unified Diff: Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp

Issue 10388233: Merge 117012 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/bindings/v8/V8NPObject.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
===================================================================
--- Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp (revision 118022)
+++ Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp (working copy)
@@ -145,6 +145,7 @@
ID_LAST_SET_WINDOW_ARGUMENTS,
ID_PROPERTY_WINDOWED_PLUGIN,
ID_PROPERTY_TEST_OBJECT_COUNT,
+ ID_PROPERTY_DELETE_IN_GET_PROPERTY,
NUM_PROPERTY_IDENTIFIERS
};
@@ -161,6 +162,7 @@
"lastSetWindowArguments",
"windowedPlugin",
"testObjectCount",
+ "deletePluginInGetProperty"
};
enum {
@@ -202,6 +204,7 @@
ID_NORMALIZE,
ID_INVALIDATE_RECT,
ID_OBJECTS_ARE_SAME,
+ ID_TEST_DELETE_WITHIN_INVOKE,
NUM_METHOD_IDENTIFIERS
};
@@ -244,7 +247,8 @@
"resizeTo",
"normalize",
"invalidateRect",
- "objectsAreSame"
+ "objectsAreSame",
+ "testDeleteWithinInvoke"
};
static NPUTF8* createCStringFromNPVariant(const NPVariant* variant)
@@ -262,8 +266,30 @@
browser->getstringidentifiers(pluginMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, pluginMethodIdentifiers);
}
+static bool callDeletePlugin(NPObject* obj, NPIdentifier name, NPIdentifier identifierToMatch)
+{
+ if (name != identifierToMatch)
+ return false;
+
+ PluginObject* plugin = reinterpret_cast<PluginObject*>(obj);
+ NPObject* windowScriptObject;
+ browser->getvalue(plugin->npp, NPNVWindowNPObject, &windowScriptObject);
+
+ NPIdentifier callbackIdentifier = browser->getstringidentifier("deletePlugin");
+ NPVariant browserResult;
+ if (browser->invoke(plugin->npp, windowScriptObject, callbackIdentifier, 0, 0, &browserResult))
+ browser->releasevariantvalue(&browserResult);
+ return true;
+}
+
static bool pluginHasProperty(NPObject *obj, NPIdentifier name)
{
+ if (callDeletePlugin(obj, name, browser->getstringidentifier("deletePluginReturnTrue")))
+ return true;
+
+ if (callDeletePlugin(obj, name, browser->getstringidentifier("deletePluginReturnFalse")))
+ return false;
+
for (int i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++)
if (name == pluginPropertyIdentifiers[i])
return true;
@@ -272,6 +298,9 @@
static bool pluginHasMethod(NPObject *obj, NPIdentifier name)
{
+ if (callDeletePlugin(obj, name, browser->getstringidentifier("deletePluginInHasMethod")))
+ return true;
+
for (int i = 0; i < NUM_METHOD_IDENTIFIERS; i++)
if (name == pluginMethodIdentifiers[i])
return true;
@@ -331,12 +360,25 @@
return true;
}
+ if (name == pluginPropertyIdentifiers[ID_PROPERTY_DELETE_IN_GET_PROPERTY]) {
+ browser->retainobject(obj);
+ callDeletePlugin(obj, name, pluginPropertyIdentifiers[ID_PROPERTY_DELETE_IN_GET_PROPERTY]);
+ NPObject* testObject = plugin->testObject;
+ browser->retainobject(testObject);
+ OBJECT_TO_NPVARIANT(testObject, *result);
+ browser->releaseobject(obj);
+ return true;
+ }
+
return false;
}
static bool pluginSetProperty(NPObject* obj, NPIdentifier name, const NPVariant* variant)
{
PluginObject* plugin = reinterpret_cast<PluginObject*>(obj);
+ if (callDeletePlugin(obj, name, browser->getstringidentifier("deletePluginReturnTrue")))
+ return true;
+
if (name == pluginPropertyIdentifiers[ID_PROPERTY_EVENT_LOGGING]) {
plugin->eventLogging = NPVARIANT_TO_BOOLEAN(*variant);
return true;
@@ -1123,7 +1165,12 @@
return invalidateRect(plugin, args, argCount, result);
if (name == pluginMethodIdentifiers[ID_OBJECTS_ARE_SAME])
return objectsAreSame(plugin, args, argCount, result);
-
+ if (name == pluginMethodIdentifiers[ID_TEST_DELETE_WITHIN_INVOKE]) {
+ NPObject* newObject = browser->createobject(plugin->npp, &pluginClass);
+ OBJECT_TO_NPVARIANT(newObject, *result);
+ callDeletePlugin(header, name, pluginMethodIdentifiers[ID_TEST_DELETE_WITHIN_INVOKE]);
+ return true;
+ }
return false;
}
« no previous file with comments | « Source/WebCore/bindings/v8/V8NPObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698