diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index f2be4e61bcd..5a6a9281d0c 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -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; } diff --git a/layout/tools/reftest/runreftest.py b/layout/tools/reftest/runreftest.py index a1ac1d3bb61..effad65119a 100644 --- a/layout/tools/reftest/runreftest.py +++ b/layout/tools/reftest/runreftest.py @@ -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: diff --git a/modules/plugin/test/mochitest/test_npruntime_npninvokedefault.html b/modules/plugin/test/mochitest/test_npruntime_npninvokedefault.html index 094a0b5a3ba..798c8a77d93 100644 --- a/modules/plugin/test/mochitest/test_npruntime_npninvokedefault.html +++ b/modules/plugin/test/mochitest/test_npruntime_npninvokedefault.html @@ -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(); } diff --git a/modules/plugin/test/testplugin/README b/modules/plugin/test/testplugin/README index 955b47b1b58..513842a8ef8 100644 --- a/modules/plugin/test/testplugin/README +++ b/modules/plugin/test/testplugin/README @@ -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: diff --git a/modules/plugin/test/testplugin/nptest.cpp b/modules/plugin/test/testplugin/nptest.cpp index 99c2cab4c79..9273db9a321 100644 --- a/modules/plugin/test/testplugin/nptest.cpp +++ b/modules/plugin/test/testplugin/nptest.cpp @@ -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