1 /*****************************************************************************
2 * runtime.cpp: support for NPRuntime API for Netscape Script-able plugins
3 * FYI: http://www.mozilla.org/projects/plugins/npruntime.html
4 *****************************************************************************
5 * Copyright (C) 2005 the VideoLAN team
7 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
31 #ifdef HAVE_MOZILLA_CONFIG_H
32 # include <mozilla-config.h>
35 #include "nporuntime.h"
36 #include "vlcplugin.h"
38 RuntimeNPObject::InvokeResult RuntimeNPObject::getProperty(int index, NPVariant *result)
40 /* default behaviour */
41 return INVOKERESULT_GENERIC_ERROR;
44 RuntimeNPObject::InvokeResult RuntimeNPObject::setProperty(int index, const NPVariant *value)
46 /* default behaviour */
47 return INVOKERESULT_GENERIC_ERROR;
50 RuntimeNPObject::InvokeResult RuntimeNPObject::removeProperty(int index)
52 /* default behaviour */
53 return INVOKERESULT_GENERIC_ERROR;
56 RuntimeNPObject::InvokeResult RuntimeNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant *result)
58 /* default beahviour */
59 return INVOKERESULT_GENERIC_ERROR;
62 RuntimeNPObject::InvokeResult RuntimeNPObject::invokeDefault(const NPVariant *args, uint32_t argCount, NPVariant *result)
65 VOID_TO_NPVARIANT(*result);
66 return INVOKERESULT_NO_ERROR;
69 bool RuntimeNPObject::returnInvokeResult(RuntimeNPObject::InvokeResult result)
73 case INVOKERESULT_NO_ERROR:
75 case INVOKERESULT_GENERIC_ERROR:
77 case INVOKERESULT_NO_SUCH_METHOD:
78 NPN_SetException(this, "No such method or arguments mismatch");
80 case INVOKERESULT_INVALID_ARGS:
81 NPN_SetException(this, "Invalid arguments");
83 case INVOKERESULT_INVALID_VALUE:
84 NPN_SetException(this, "Invalid value in assignment");
86 case INVOKERESULT_OUT_OF_MEMORY:
87 NPN_SetException(this, "Out of memory");