Test for bug 653083 - "temporary" string NPIdentifiers (those not requested explicitly with NPN_GetStringIdentifier) are being cached incorrectly across GCs

--HG--
extra : rebase_source : 15e38546e0c7beeb3cab5a981dc27e15c2316757
This commit is contained in:
Benjamin Smedberg 2011-06-10 12:12:32 -04:00
Родитель 796b357b43
Коммит b7c34a4caa
3 изменённых файлов: 38 добавлений и 8 удалений

Просмотреть файл

@ -52,6 +52,7 @@ _MOCHITEST_FILES = \
test_npruntime_npninvoke.html \
test_npruntime_npninvokedefault.html \
test_npruntime_identifiers.html \
npruntime_identifiers_subpage.html \
loremipsum.txt \
loremipsum_file.txt \
loremipsum_nocache.txt \

Просмотреть файл

@ -0,0 +1,4 @@
<html>
<body>
<embed id="plugin1" type="application/x-test" width="400" height="100">
</embed>

Просмотреть файл

@ -8,11 +8,10 @@
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body onload="runTests()">
<body>
<p id="display"></p>
<embed id="plugin1" type="application/x-test" width="400" height="100">
</embed>
<iframe id="subframe" src="npruntime_identifiers_subpage.html"></iframe>
<script class="testbody" type="application/javascript">
////
@ -21,16 +20,42 @@
SimpleTest.waitForExplicitFinish();
function runTests() {
var reflector = document.getElementById("plugin1").getReflector();
var testsRun = 0;
for (var i = -10; i < 10; ++i)
document.getElementById('subframe').addEventListener('load', doTest, false);
function doTest() {
SpecialPowers.gc();
var reflector = document.getElementById("subframe").contentDocument.getElementById("plugin1").getReflector();
var i, prop, randomnumber;
for (i = 0; i < 20; ++i) {
randomnumber=Math.floor(Math.random()*1001);
prop = "prop" + randomnumber;
is(reflector[prop], prop, "Property " + prop);
}
for (i = -10; i < 10; ++i) {
is(reflector[i], i, "Property " + i);
prop = "prop" + i;
is(reflector[prop], prop, "Property " + prop);
}
is(reflector.a, 'a', "Property .a");
is(reflector['a'], 'a', "Property ['a']");
SimpleTest.finish();
reflector = null;
SpecialPowers.gc();
++testsRun;
if (testsRun == 3) {
SimpleTest.finish();
}
else {
document.getElementById('subframe').contentWindow.location.reload(true);
}
}
</script>
</body>