This commit is contained in:
Robert Sayre 2009-10-16 13:34:46 -04:00
commit 7203024ba1
5 changed files with 42 additions and 5 deletions

View File

@ -9781,7 +9781,7 @@ nsHTMLPluginObjElementSH::Call(nsIXPConnectWrappedNative *wrapper,
// If obj is a native wrapper, or if there's no plugin around for
// this object, throw.
if (!ObjectIsNativeWrapper(cx, obj) || !pi) {
if (ObjectIsNativeWrapper(cx, obj) || !pi) {
return NS_ERROR_NOT_AVAILABLE;
}

View File

@ -125,6 +125,7 @@ Are you executing $objdir/_tests/reftest/runreftest.py?""" \
options.xrePath = getFullPath(options.xrePath)
options.symbolsPath = getFullPath(options.symbolsPath)
options.utilityPath = getFullPath(options.utilityPath)
profileDir = None
try:

View File

@ -51,8 +51,6 @@
["Boolean", "false", true],
["Boolean", new Boolean(false), true],
["Boolean", { "value": false }, true],
// Date object
// ["Date", "December 17, 1995 03:24:00", Date("December 17, 1995 03:24:00")],
// Function object
["Function", "return 3", Function("return 3")],
["Function", "window.alert('test')", Function("window.alert('test')")],
@ -87,6 +85,7 @@
function runTests() {
var plugin = document.getElementById("plugin1");
// Test calling NPN_InvokeDefault from within plugin code.
for each (var test in tests) {
var result = plugin.npnInvokeDefaultTest(test[0], test[1]);
// serialize the two values for easy
@ -110,7 +109,17 @@
BR()
);
}
// Test calling the invokedefault method of plugin-defined object
is(plugin(), "Test Plug-in",
"calling NPN_InvokeDefault on plugin-defined Object doesn't work");
is(plugin(1), "Test Plug-in;1",
"calling NPN_InvokeDefault on plugin-defined Object doesn't work");
is(plugin("test"), "Test Plug-in;test",
"calling NPN_InvokeDefault on plugin-defined Object doesn't work");
is(plugin(undefined, -1, null), "Test Plug-in;undefined;-1;null",
"calling NPN_InvokeDefault on plugin-defined Object doesn't work");
SimpleTest.finish();
}
</script>

View File

@ -47,6 +47,10 @@ with the specified argument. Returns the result of the invocation.
If an error has occurred during the last stream or npruntime function,
this will return a string error message, otherwise it returns "pass".
* () - default method
Returns a string consisting of the plugin name, concatenated with any
arguments passed to the method.
== Private browsing ==
The test plugin object supports the following scriptable methods:

View File

@ -1192,7 +1192,30 @@ scriptableInvoke(NPObject* npobj, NPIdentifier name, const NPVariant* args, uint
bool
scriptableInvokeDefault(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
return false;
ostringstream value;
value << PLUGIN_NAME;
for (uint32_t i = 0; i < argCount; i++) {
switch(args[i].type) {
case NPVariantType_Int32:
value << ";" << NPVARIANT_TO_INT32(args[i]);
break;
case NPVariantType_String: {
const NPString* argstr = &NPVARIANT_TO_STRING(args[i]);
value << ";" << argstr->UTF8Characters;
break;
}
case NPVariantType_Void:
value << ";undefined";
break;
case NPVariantType_Null:
value << ";null";
break;
default:
value << ";other";
}
}
STRINGZ_TO_NPVARIANT(strdup(value.str().c_str()), *result);
return true;
}
bool