| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "PluginObject.h" | 26 #include "PluginObject.h" |
| 27 | 27 |
| 28 #include "TestObject.h" | 28 #include "TestObject.h" |
| 29 #include <assert.h> | 29 #include <assert.h> |
| 30 #include <stdlib.h> | 30 #include <stdlib.h> |
| 31 #include <stdio.h> | 31 #include <stdio.h> |
| 32 #include <string.h> |
| 32 #ifdef WIN32 | 33 #ifdef WIN32 |
| 33 #define snprintf sprintf_s | 34 #define snprintf sprintf_s |
| 34 #endif | 35 #endif |
| 35 | 36 |
| 36 static void logWithWindowObject(NPObject* windowObject, NPP instance, const char
* message) | 37 static void logWithWindowObject(NPObject* windowObject, NPP instance, const char
* message) |
| 37 { | 38 { |
| 38 NPVariant consoleVariant; | 39 NPVariant consoleVariant; |
| 39 if (!browser->getproperty(instance, windowObject, browser->getstringidentifi
er("console"), &consoleVariant)) { | 40 if (!browser->getproperty(instance, windowObject, browser->getstringidentifi
er("console"), &consoleVariant)) { |
| 40 fprintf(stderr, "Failed to retrieve console object while logging: %s\n",
message); | 41 fprintf(stderr, "Failed to retrieve console object while logging: %s\n",
message); |
| 41 return; | 42 return; |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 DOUBLE_TO_NPVARIANT(242.242, args[4]); | 1067 DOUBLE_TO_NPVARIANT(242.242, args[4]); |
| 1067 STRINGZ_TO_NPVARIANT("Hello, World", args[5]); | 1068 STRINGZ_TO_NPVARIANT("Hello, World", args[5]); |
| 1068 OBJECT_TO_NPVARIANT(windowScriptObject, args[6]); | 1069 OBJECT_TO_NPVARIANT(windowScriptObject, args[6]); |
| 1069 | 1070 |
| 1070 NPVariant result; | 1071 NPVariant result; |
| 1071 if (browser->invoke(npp, windowScriptObject, testNPInvoke, args, 7, &result)
) | 1072 if (browser->invoke(npp, windowScriptObject, testNPInvoke, args, 7, &result)
) |
| 1072 browser->releasevariantvalue(&result); | 1073 browser->releasevariantvalue(&result); |
| 1073 | 1074 |
| 1074 browser->releaseobject(windowScriptObject); | 1075 browser->releaseobject(windowScriptObject); |
| 1075 } | 1076 } |
| OLD | NEW |