blob: 8d3a01948104c4f640010290bd308290ab4a6d55 [file] [log] [blame]
<html>
<script>
function runTest()
{
if (window.layoutTestController)
layoutTestController.dumpAsText();
var plugin = document.getElementById("testPlugin");
var result = document.getElementById('result');
// First test NPN_Enumerate from the plugin's side
var testObject = { "one" : 1, "two" : 2, "three" : 3, 4 : 4 }
var outArray = [];
plugin.testEnumerate(testObject, outArray);
if (outArray.toString() != 'one,two,three,4') {
result.innerHTML = 'FAILURE: Array returned from plugin was ' + outArray.toString();
return;
}
// Now try enumerating a plugin object's properties
var propNames = [];
for (var v in plugin.testObject) {
propNames.push(v);
}
if (propNames.toString() != 'foo,bar') {
result.innerHTML = 'FAILURE: Plugin object properties was ' + propNames.toString();
return;
}
result.innerHTML = 'SUCCESS';
}
</script>
<body onload="runTest();">
<embed id="testPlugin" type="application/x-webkit-test-netscape" width="200" height="200"></embed>
This tests that a plugin can enumerate an object's properties using NPN_Enumerate. It also tests that JavaScript can enumerate a plugin object's properties. If this test is successful the text "SUCCESS" will be show below.
<div id="result">FAILURE</div>
</body>
</html>