mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 510963 - NPN_GetValue(NPNVPluginElementNPObject) is broken, r=josh
--HG-- extra : rebase_source : e1242620d2adfee22a5c8ede076e4d43916e72d9
This commit is contained in:
parent
fdb442917d
commit
d31bf1898b
@ -1168,16 +1168,16 @@ _getpluginelement(NPP npp)
|
||||
NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getpluginelement called from the wrong thread\n"));
|
||||
return nsnull;
|
||||
}
|
||||
nsIDOMElement *elementp = nsnull;
|
||||
NPError nperr = _getvalue(npp, NPNVDOMElement, &elementp);
|
||||
|
||||
if (nperr != NPERR_NO_ERROR) {
|
||||
nsNPAPIPluginInstance* inst = static_cast<nsNPAPIPluginInstance*>(npp->ndata);
|
||||
if (!inst)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// Pass ownership of elementp to element
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element.swap(elementp);
|
||||
inst->GetDOMElement(getter_AddRefs(element));
|
||||
|
||||
if (!element)
|
||||
return nsnull;
|
||||
|
||||
JSContext *cx = GetJSContextFromNPP(npp);
|
||||
NS_ENSURE_TRUE(cx, nsnull);
|
||||
|
@ -44,7 +44,11 @@ relativesrcdir = modules/plugin/test
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES = \
|
||||
_MOCHITEST_FILES = \
|
||||
test_npobject_getters.html \
|
||||
$(NULL)
|
||||
|
||||
_MOCHICHROME_FILES = \
|
||||
test_bug479979.xul \
|
||||
test_npruntime.xul \
|
||||
test_privatemode.xul \
|
||||
@ -52,5 +56,8 @@ _TEST_FILES = \
|
||||
test_npapi_timers.xul \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
libs:: $(_MOCHICHROME_FILES)
|
||||
$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
|
||||
|
||||
libs:: $(_MOCHITEST_FILES)
|
||||
$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
20
modules/plugin/test/mochitest/test_npobject_getters.html
Normal file
20
modules/plugin/test/mochitest/test_npobject_getters.html
Normal file
@ -0,0 +1,20 @@
|
||||
<head>
|
||||
<title>NPNV*NPObject accessibility tests</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body onload="runTests()">
|
||||
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
dump('lastScript');
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTests() {
|
||||
ok(document.getElementById('plugin1').pluginFoundElement, "plugin1.pluginFoundElement (NPNVPluginElementNPObject)", document.getElementById('plugin1').pluginFoundElement);
|
||||
ok(window.pluginFoundWindow, "window.pluginFoundWindow (NPNVWindowNPObject)", window.pluginFoundWindow);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
@ -356,6 +356,28 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
|
||||
return err;
|
||||
}
|
||||
|
||||
NPVariant variantTrue;
|
||||
BOOLEAN_TO_NPVARIANT(true, variantTrue);
|
||||
|
||||
// Set a property on NPNVPluginElementNPObject
|
||||
NPObject* o = NULL;
|
||||
err = NPN_GetValue(instance, NPNVPluginElementNPObject, &o);
|
||||
if (err == NPERR_NO_ERROR) {
|
||||
NPN_SetProperty(instance, o,
|
||||
NPN_GetStringIdentifier("pluginFoundElement"), &variantTrue);
|
||||
NPN_ReleaseObject(o);
|
||||
o = NULL;
|
||||
}
|
||||
|
||||
// Set a property on NPNVWindowNPObject
|
||||
err = NPN_GetValue(instance, NPNVWindowNPObject, &o);
|
||||
if (err == NPERR_NO_ERROR) {
|
||||
NPN_SetProperty(instance, o,
|
||||
NPN_GetStringIdentifier("pluginFoundWindow"), &variantTrue);
|
||||
NPN_ReleaseObject(o);
|
||||
o = NULL;
|
||||
}
|
||||
|
||||
++sInstanceCount;
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user