最後に、なぜcontentWindow
void要素を返すのかを理解しました。iframeドキュメントを取得するためのコードは次のとおりです。
STRINGZ_TO_NPVARIANT("IFRAME", searchString);
NPN_Invoke(instanceNPP,NPVARIANT_TO_OBJECT(document), NPN_GetStringIdentifier("getElementsByTagName"), &searchString, 1, &frameCollection);
if (!NPN_GetProperty(instanceNPP, NPVARIANT_TO_OBJECT(frameCollection), NPN_GetStringIdentifier("length"), &lenght))
{
return;
}
for (int i=0; i<NPVARIANT_TO_INT32(lenght); i++)
{
INT32_TO_NPVARIANT(i, index);
if (!NPN_Invoke(instanceNPP, NPVARIANT_TO_OBJECT(frameCollection), NPN_GetStringIdentifier("item"), &index, 1, &frameItem))
{
continue;
}
if (!NPN_GetProperty(instanceNPP, NPVARIANT_TO_OBJECT(frameItem), NPN_GetStringIdentifier("contentWindow"), &contentWindow))
{
continue;
}
if (!NPN_GetProperty(instanceNPP, NPVARIANT_TO_OBJECT(contentWindow), NPN_GetStringIdentifier("document"), &frameDocument))
{
continue;
}
//do something with the frame's document
}