зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
b111d984ee
Коммит
16764b5df2
|
@ -52,6 +52,7 @@ _MOCHITEST_FILES = \
|
||||||
test_npruntime_npninvoke.html \
|
test_npruntime_npninvoke.html \
|
||||||
test_npruntime_npninvokedefault.html \
|
test_npruntime_npninvokedefault.html \
|
||||||
test_npruntime_identifiers.html \
|
test_npruntime_identifiers.html \
|
||||||
|
npruntime_identifiers_subpage.html \
|
||||||
loremipsum.txt \
|
loremipsum.txt \
|
||||||
loremipsum_file.txt \
|
loremipsum_file.txt \
|
||||||
loremipsum_nocache.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"
|
<link rel="stylesheet" type="text/css"
|
||||||
href="/tests/SimpleTest/test.css" />
|
href="/tests/SimpleTest/test.css" />
|
||||||
</head>
|
</head>
|
||||||
<body onload="runTests()">
|
<body>
|
||||||
<p id="display"></p>
|
<p id="display"></p>
|
||||||
|
|
||||||
<embed id="plugin1" type="application/x-test" width="400" height="100">
|
<iframe id="subframe" src="npruntime_identifiers_subpage.html"></iframe>
|
||||||
</embed>
|
|
||||||
|
|
||||||
<script class="testbody" type="application/javascript">
|
<script class="testbody" type="application/javascript">
|
||||||
////
|
////
|
||||||
|
@ -21,16 +20,42 @@
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
function runTests() {
|
var testsRun = 0;
|
||||||
var reflector = document.getElementById("plugin1").getReflector();
|
|
||||||
|
|
||||||
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);
|
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");
|
||||||
is(reflector['a'], 'a', "Property ['a']");
|
is(reflector['a'], 'a', "Property ['a']");
|
||||||
|
reflector = null;
|
||||||
SimpleTest.finish();
|
|
||||||
|
SpecialPowers.gc();
|
||||||
|
|
||||||
|
++testsRun;
|
||||||
|
if (testsRun == 3) {
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById('subframe').contentWindow.location.reload(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче