mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 14:56:07 +00:00
Test for bug 564607 - Firefox crashes when an OOPP plugin implements NPClass.enumerate
This commit is contained in:
parent
d5b8a23321
commit
11fa580385
@ -91,6 +91,7 @@ _MOCHITEST_FILES = \
|
||||
test_propertyAndMethod.html \
|
||||
test_bug539565-1.html \
|
||||
test_bug539565-2.html \
|
||||
test_enumerate.html \
|
||||
$(NULL)
|
||||
|
||||
# test_npruntime_npnsetexception.html \ Disabled for e10s
|
||||
|
33
modules/plugin/test/mochitest/test_enumerate.html
Normal file
33
modules/plugin/test/mochitest/test_enumerate.html
Normal file
@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>NPAPI Cookie 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>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
|
||||
<body onload="runTests()">
|
||||
<p id="display"></p>
|
||||
|
||||
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
|
||||
<script class="testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
function runTests() {
|
||||
var pluginElement = document.getElementById("plugin1");
|
||||
var c = 0;
|
||||
var foundSetColor = false;
|
||||
for (var n in pluginElement) {
|
||||
++c;
|
||||
ok(n in pluginElement, "Enumerated property which doesn't exist?");
|
||||
if (n == 'setColor')
|
||||
foundSetColor = true;
|
||||
}
|
||||
ok(c > 0, "Should have enumerated some properties");
|
||||
ok(foundSetColor, "Should have enumerated .setColor");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1676,7 +1676,15 @@ scriptableRemoveProperty(NPObject* npobj, NPIdentifier name)
|
||||
bool
|
||||
scriptableEnumerate(NPObject* npobj, NPIdentifier** identifier, uint32_t* count)
|
||||
{
|
||||
return false;
|
||||
const int bufsize = sizeof(NPIdentifier) * ARRAY_LENGTH(sPluginMethodIdentifierNames);
|
||||
NPIdentifier* ids = (NPIdentifier*) NPN_MemAlloc(bufsize);
|
||||
if (!ids)
|
||||
return false;
|
||||
|
||||
memcpy(ids, sPluginMethodIdentifiers, bufsize);
|
||||
*identifier = ids;
|
||||
*count = ARRAY_LENGTH(sPluginMethodIdentifierNames);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user