Implement NPNVdocumentOrigin
No one implements it yet, but it's a very simple variable, and very very important to support when it does get used.
This commit is contained in:
parent
2090fbafdc
commit
62a50c7197
|
@ -49,6 +49,9 @@ int rpc_type_of_NPNVariable(int variable)
|
|||
case NPNVnetscapeWindow:
|
||||
type = RPC_TYPE_UINT32;
|
||||
break;
|
||||
case NPNVdocumentOrigin:
|
||||
type = RPC_TYPE_STRING;
|
||||
break;
|
||||
case NPNVWindowNPObject:
|
||||
case NPNVPluginElementNPObject:
|
||||
type = RPC_TYPE_NP_OBJECT;
|
||||
|
|
|
@ -1089,6 +1089,25 @@ invoke_NPN_GetValue(PluginInstance *plugin, NPNVariable variable, void *value)
|
|||
*((NPBool *)value) = b ? TRUE : FALSE;
|
||||
break;
|
||||
}
|
||||
case RPC_TYPE_STRING:
|
||||
{
|
||||
char *str = NULL;
|
||||
error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INT32, &ret, RPC_TYPE_STRING, &str, RPC_TYPE_INVALID);
|
||||
if (error != RPC_ERROR_NO_ERROR) {
|
||||
npw_perror("NPN_GetValue() wait for reply", error);
|
||||
ret = NPERR_GENERIC_ERROR;
|
||||
}
|
||||
D(bug("-> value: %s\n", str ? str : "(null)"));
|
||||
// Reallocate with NPN_MemAlloc. Caller frees.
|
||||
if (ret == NPERR_NO_ERROR) {
|
||||
char *npn_str = NULL;
|
||||
ret = NPW_ReallocData(str, strlen(str) + 1, (void**)&npn_str);
|
||||
free(str);
|
||||
str = npn_str;
|
||||
}
|
||||
*((char **)value) = str;
|
||||
break;
|
||||
}
|
||||
case RPC_TYPE_NP_OBJECT:
|
||||
{
|
||||
NPObject *npobj = NULL;
|
||||
|
@ -1171,6 +1190,7 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value)
|
|||
case NPNVPluginElementNPObject:
|
||||
case NPNVprivateModeBool:
|
||||
case NPNVsupportsAdvancedKeyHandling:
|
||||
case NPNVdocumentOrigin:
|
||||
return g_NPN_GetValue_real(instance, variable, value);
|
||||
default:
|
||||
switch (variable & 0xff) {
|
||||
|
|
|
@ -519,6 +519,15 @@ static int handle_NPN_GetValue(rpc_connection_t *connection)
|
|||
ret = g_NPN_GetValue(PLUGIN_INSTANCE_NPP(plugin), variable, (void *)&b);
|
||||
return rpc_method_send_reply(connection, RPC_TYPE_INT32, ret, RPC_TYPE_BOOLEAN, b, RPC_TYPE_INVALID);
|
||||
}
|
||||
case RPC_TYPE_STRING:
|
||||
{
|
||||
char *str = NULL;
|
||||
ret = g_NPN_GetValue(PLUGIN_INSTANCE_NPP(plugin), variable, (void *)&str);
|
||||
error = rpc_method_send_reply(connection, RPC_TYPE_INT32, ret, RPC_TYPE_STRING, str, RPC_TYPE_INVALID);
|
||||
if (str)
|
||||
NPN_MemFree(str);
|
||||
return error;
|
||||
}
|
||||
case RPC_TYPE_NP_OBJECT:
|
||||
{
|
||||
NPObject *npobj = NULL;
|
||||
|
|
|
@ -293,6 +293,7 @@ const char *string_of_NPNVariable(int variable)
|
|||
_(NPNVSupportsWindowless);
|
||||
_(NPNVprivateModeBool);
|
||||
_(NPNVsupportsAdvancedKeyHandling);
|
||||
_(NPNVdocumentOrigin);
|
||||
#undef _
|
||||
default:
|
||||
switch (variable & 0xff) {
|
||||
|
|
Loading…
Reference in New Issue