Bug 1213710 part 1 - Convert all html/xul files in dom/plugins/test/mochitest to unix format. r=bsmedberg

--HG--
extra : source : db1aa81c82af657e44614fa94bf10e34296d40c1
This commit is contained in:
Xidorn Quan 2015-11-17 09:54:12 +11:00
Родитель 12532a74a8
Коммит 667d6f4b8d
15 изменённых файлов: 628 добавлений и 628 удалений

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

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

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

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

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

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

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

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<body style="background-color: #88AAFF;">
<h1>This Page Has a Solid Plugin</h1>
<p><embed id="p" type="application/x-test" drawmode="solid" color="FFFF0000" width="200" height="200"></embed>
<!DOCTYPE html>
<html>
<body style="background-color: #88AAFF;">
<h1>This Page Has a Solid Plugin</h1>
<p><embed id="p" type="application/x-test" drawmode="solid" color="FFFF0000" width="200" height="200"></embed>

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

@ -1,36 +1,36 @@
<html>
<head>
<title>NPAPI Cookie Tests</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body onload="runTests()">
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
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>
<p id="display"></p>
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
</body>
</html>
<html>
<head>
<title>NPAPI Cookie Tests</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body onload="runTests()">
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
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>
<p id="display"></p>
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
</body>
</html>

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

@ -1,33 +1,33 @@
<head>
<title>Plugin instantiation</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="utils.js"></script>
<body onload="mainLoaded()">
<iframe id="iframe1" src="about:blank" width="600" height="600"></iframe>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var iframe = document.getElementById('iframe1');
function mainLoaded() {
var p = iframe.contentDocument.createElement('embed');
p.setAttribute('id', 'plugin1');
p.setAttribute('type', 'application/x-test');
p.setAttribute('width', '400');
p.setAttribute('height', '400');
p.setAttribute('drawmode', 'solid');
p.setAttribute('color', 'FF00FFFF');
iframe.contentDocument.body.appendChild(p);
// Plugin instantiation happens asynchronously
SimpleTest.executeSoon(function() {
SimpleTest.executeSoon(function() {
ok(p.setColor !== undefined, "Dynamic plugin instantiation.");
SimpleTest.finish();
})
});
}
</script>
<head>
<title>Plugin instantiation</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="utils.js"></script>
<body onload="mainLoaded()">
<iframe id="iframe1" src="about:blank" width="600" height="600"></iframe>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var iframe = document.getElementById('iframe1');
function mainLoaded() {
var p = iframe.contentDocument.createElement('embed');
p.setAttribute('id', 'plugin1');
p.setAttribute('type', 'application/x-test');
p.setAttribute('width', '400');
p.setAttribute('height', '400');
p.setAttribute('drawmode', 'solid');
p.setAttribute('color', 'FF00FFFF');
iframe.contentDocument.body.appendChild(p);
// Plugin instantiation happens asynchronously
SimpleTest.executeSoon(function() {
SimpleTest.executeSoon(function() {
ok(p.setColor !== undefined, "Dynamic plugin instantiation.");
SimpleTest.finish();
})
});
}
</script>

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

@ -1,32 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>Test whether windowless plugins receive correct visible/invisible notifications.</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<body>
<script type="text/javascript">
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
</script>
<p id="display"></p>
<embed id="theplugin" type="application/x-test"></embed>
<script type="application/javascript">
function MyFunc(arg) {
is(arg, "hi", "Argument passed to constructor function");
this.localProp = 'local';
}
MyFunc.prototype.protoProp = 't';
var theplugin = document.getElementById('theplugin');
ok(theplugin.constructObject(Array) instanceof Array, "Constructed Array");
var o = theplugin.constructObject(MyFunc, "hi");
ok(o instanceof MyFunc, "Constructed MyFunc");
is(o.localProp, 'local', "this property correct");
is(o.protoProp, 't', "prototype property correct");
</script>
<!DOCTYPE html>
<html>
<head>
<title>Test whether windowless plugins receive correct visible/invisible notifications.</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<body>
<script type="text/javascript">
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
</script>
<p id="display"></p>
<embed id="theplugin" type="application/x-test"></embed>
<script type="application/javascript">
function MyFunc(arg) {
is(arg, "hi", "Argument passed to constructor function");
this.localProp = 'local';
}
MyFunc.prototype.protoProp = 't';
var theplugin = document.getElementById('theplugin');
ok(theplugin.constructObject(Array) instanceof Array, "Constructed Array");
var o = theplugin.constructObject(MyFunc, "hi");
ok(o instanceof MyFunc, "Constructed MyFunc");
is(o.localProp, 'local', "this property correct");
is(o.protoProp, 't', "prototype property correct");
</script>

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

@ -1,67 +1,67 @@
<html>
<head>
<title>NPN_Invoke Tests</title>
<script type="text/javascript"
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<script class="testbody" type="application/javascript">
////
// This test exercises NP identifiers by querying the reflector to make sure
// that identifiers are translated to values correctly.
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var testsRun = 0;
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 < 0; ++i) {
is(reflector[i], String(i), "Property " + i);
prop = "prop" + i;
is(reflector[prop], prop, "Property " + prop);
}
for (i = 0; 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']");
reflector = null;
SpecialPowers.gc();
++testsRun;
if (testsRun == 3) {
SimpleTest.finish();
}
else {
document.getElementById('subframe').contentWindow.location.reload(true);
}
}
</script>
<iframe id="subframe" src="npruntime_identifiers_subpage.html" onload="doTest()"></iframe>
</body>
</html>
<html>
<head>
<title>NPN_Invoke Tests</title>
<script type="text/javascript"
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<script class="testbody" type="application/javascript">
////
// This test exercises NP identifiers by querying the reflector to make sure
// that identifiers are translated to values correctly.
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var testsRun = 0;
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 < 0; ++i) {
is(reflector[i], String(i), "Property " + i);
prop = "prop" + i;
is(reflector[prop], prop, "Property " + prop);
}
for (i = 0; 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']");
reflector = null;
SpecialPowers.gc();
++testsRun;
if (testsRun == 3) {
SimpleTest.finish();
}
else {
document.getElementById('subframe').contentWindow.location.reload(true);
}
}
</script>
<iframe id="subframe" src="npruntime_identifiers_subpage.html" onload="doTest()"></iframe>
</body>
</html>

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

@ -1,43 +1,43 @@
<html>
<head>
<title>NPAPI src="" NPStream Test</title>
<script type="text/javascript"
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="pluginstream.js"></script>
<script type="text/javascript" src="utils.js"></script>
<script type="text/javascript">
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
</script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<iframe id="testframe" name="testframe" onload="frameLoaded()"></iframe>
<!--
- A stream is sent to the browser via NPP_NewStream, NP_NORMAL.
- The plugin reports that data can only be sent to it in 100-byte
- chunks. When NPP_DestroyStream is called, the plugin sends the stream
- content back to the browser by passing it as a data: url to
- NPN_GetURL, using a frame, so that the stream content should
- be displayed in the frame in the browser.
-
- We create the object element dynamically, which in some cases has caused us to deliver the data=""
- stream twice. This verifies that we only deliver the data="" stream once.
-->
<script type="text/javascript">
var e = document.createElement('object');
e.setAttribute('data', 'loremipsum.xtest');
e.setAttribute('type', 'application/x-test');
e.setAttribute('streammode', 'normal');
e.setAttribute('streamchunksize', '100');
e.setAttribute('frame', 'testframe');
e.setAttribute('style', 'width: 400px; height: 100px;');
document.body.appendChild(e);
</script>
</body>
</html>
<html>
<head>
<title>NPAPI src="" NPStream Test</title>
<script type="text/javascript"
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="pluginstream.js"></script>
<script type="text/javascript" src="utils.js"></script>
<script type="text/javascript">
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
</script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<iframe id="testframe" name="testframe" onload="frameLoaded()"></iframe>
<!--
- A stream is sent to the browser via NPP_NewStream, NP_NORMAL.
- The plugin reports that data can only be sent to it in 100-byte
- chunks. When NPP_DestroyStream is called, the plugin sends the stream
- content back to the browser by passing it as a data: url to
- NPN_GetURL, using a frame, so that the stream content should
- be displayed in the frame in the browser.
-
- We create the object element dynamically, which in some cases has caused us to deliver the data=""
- stream twice. This verifies that we only deliver the data="" stream once.
-->
<script type="text/javascript">
var e = document.createElement('object');
e.setAttribute('data', 'loremipsum.xtest');
e.setAttribute('type', 'application/x-test');
e.setAttribute('streammode', 'normal');
e.setAttribute('streamchunksize', '100');
e.setAttribute('frame', 'testframe');
e.setAttribute('style', 'width: 400px; height: 100px;');
document.body.appendChild(e);
</script>
</body>
</html>

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

@ -1,56 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<title>Test whether windowless plugins receive correct visible/invisible notifications.</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style type="text/css">
body {
height: 10000px;
}
</style>
<body onload="startTest()">
<p id="display"></p>
<script type="application/javascript;version=1.8">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var p = null;
function startTest() {
p = document.getElementById('theplugin');
// Wait for the plugin to have painted once
var interval = setInterval(function() {
if (!p.getPaintCount())
return;
clearInterval(interval);
doScroll();
}, 100);
}
const kScrollAmount = 1000;
var startY;
function doScroll() {
let [x, y, w, h] = p.getWindowPosition();
startY = y;
scrollBy(0, kScrollAmount);
setTimeout(checkScroll, 500);
}
function checkScroll() {
let [x, y, w, h] = p.getWindowPosition();
is(y, startY - kScrollAmount, "Window should be informed of its new position.");
SimpleTest.finish();
}
</script>
<embed id="theplugin" type="application/x-test" width="200" height="200"></embed>
<!DOCTYPE html>
<html>
<head>
<title>Test whether windowless plugins receive correct visible/invisible notifications.</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style type="text/css">
body {
height: 10000px;
}
</style>
<body onload="startTest()">
<p id="display"></p>
<script type="application/javascript;version=1.8">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var p = null;
function startTest() {
p = document.getElementById('theplugin');
// Wait for the plugin to have painted once
var interval = setInterval(function() {
if (!p.getPaintCount())
return;
clearInterval(interval);
doScroll();
}, 100);
}
const kScrollAmount = 1000;
var startY;
function doScroll() {
let [x, y, w, h] = p.getWindowPosition();
startY = y;
scrollBy(0, kScrollAmount);
setTimeout(checkScroll, 500);
}
function checkScroll() {
let [x, y, w, h] = p.getWindowPosition();
is(y, startY - kScrollAmount, "Window should be informed of its new position.");
SimpleTest.finish();
}
</script>
<embed id="theplugin" type="application/x-test" width="200" height="200"></embed>

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

@ -1,46 +1,46 @@
<html>
<head>
<title>Dual NPAPI NP_ASFILEONLY NPStream Test</title>
<script type="text/javascript"
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<script type="text/javascript">
SimpleTest.expectAssertions(0, 2);
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var framesToLoad = 2;
function frameLoaded(id) {
var frame = document.getElementById('testframe' + id);
if (!frame.contentDocument.body.innerHTML.length)
return;
--framesToLoad;
if (0 == framesToLoad) {
is(document.getElementById('testframe1').contentDocument.body.innerHTML,
document.getElementById('testframe2').contentDocument.body.innerHTML,
"Frame contents should match");
SimpleTest.finish();
}
}
</script>
<iframe id="testframe1" name="testframe1" onload="frameLoaded(1)"></iframe>
<iframe id="testframe2" name="testframe2" onload="frameLoaded(2)"></iframe>
<embed src="loremipsum_nocache.txt" streammode="asfileonly"
frame="testframe1"
id="embedtest" style="width: 400px; height: 100px;"
type="application/x-test"></embed>
<embed src="loremipsum_nocache.txt" streammode="asfileonly"
frame="testframe2"
id="embedtest2" style="width: 400px; height: 100px;"
type="application/x-test"></embed>
<html>
<head>
<title>Dual NPAPI NP_ASFILEONLY NPStream Test</title>
<script type="text/javascript"
src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css"
href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<script type="text/javascript">
SimpleTest.expectAssertions(0, 2);
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var framesToLoad = 2;
function frameLoaded(id) {
var frame = document.getElementById('testframe' + id);
if (!frame.contentDocument.body.innerHTML.length)
return;
--framesToLoad;
if (0 == framesToLoad) {
is(document.getElementById('testframe1').contentDocument.body.innerHTML,
document.getElementById('testframe2').contentDocument.body.innerHTML,
"Frame contents should match");
SimpleTest.finish();
}
}
</script>
<iframe id="testframe1" name="testframe1" onload="frameLoaded(1)"></iframe>
<iframe id="testframe2" name="testframe2" onload="frameLoaded(2)"></iframe>
<embed src="loremipsum_nocache.txt" streammode="asfileonly"
frame="testframe1"
id="embedtest" style="width: 400px; height: 100px;"
type="application/x-test"></embed>
<embed src="loremipsum_nocache.txt" streammode="asfileonly"
frame="testframe2"
id="embedtest2" style="width: 400px; height: 100px;"
type="application/x-test"></embed>

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

@ -1,100 +1,100 @@
<!DOCTYPE html>
<html>
<head>
<title>Test whether windowless plugins receive correct visible/invisible notifications.</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style>
.hidden { visibility: hidden; }
</style>
<body onload="startTest()">
<p id="display"></p>
<script type="application/javascript" src="utils.js"></script>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var didPaint = function() {};
function startTest() {
if (p.getPaintCount() < 1) {
setTimeout(startTest, 0);
return;
}
didPaint = function() {
ok(false, "Plugin should not paint until it is visible!");
};
ok(!p.isVisible(), "Plugin should not be visible.");
paintCountIs(p, 0, "Plugin should not have painted.");
didPaint = part2;
p.style.visibility = 'visible';
}
function part2() {
ok(p.isVisible(), "Plugin should now be visible.");
paintCountIs(p, 1, "Plugin should have painted once.");
didPaint = part3;
p.setColor('FF0000FF'); // this causes an invalidate/repaint
}
const kTimeout = 5000; // 5 seconds
var part4GiveUp;
var part4Interval;
function part3() {
ok(p.isVisible(), "Plugin should still be visible.");
paintCountIs(p, 2, "Plugin should have painted twice.");
didPaint = function() {
ok(false, "Plugin should not paint when it is invisible.");
};
p.style.visibility = 'hidden';
part4GiveUp = Date.now() + kTimeout;
part4Interval = setInterval(part4, 100);
}
function part4() {
if (p.isVisible()) {
if (Date.now() < part4GiveUp)
return;
ok(false, "Plugin never became invisible in part4.");
SimpleTest.finish();
return;
}
clearInterval(part4Interval);
ok(true, "Plugin became invisible again.");
p.setColor('FF00FF00');
setTimeout(SimpleTest.finish, 500);
// wait to make sure we don't actually paint
}
function inPaint() {
// We're actually in the middle of painting the plugin so don't do anything
// complex here, for the sake of cases where async plugin painting isn't
// enabled yet
setTimeout(didPaint, 0);
// Don't run that didPaint callback again
didPaint = function() {};
}
</script>
<embed id="theplugin" class="hidden" type="application/x-test" drawmode="solid" color="FFFF0000" paintscript="inPaint()"></embed>
<script type="application/javascript">
var p = document.getElementById('theplugin');
</script>
<!DOCTYPE html>
<html>
<head>
<title>Test whether windowless plugins receive correct visible/invisible notifications.</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style>
.hidden { visibility: hidden; }
</style>
<body onload="startTest()">
<p id="display"></p>
<script type="application/javascript" src="utils.js"></script>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var didPaint = function() {};
function startTest() {
if (p.getPaintCount() < 1) {
setTimeout(startTest, 0);
return;
}
didPaint = function() {
ok(false, "Plugin should not paint until it is visible!");
};
ok(!p.isVisible(), "Plugin should not be visible.");
paintCountIs(p, 0, "Plugin should not have painted.");
didPaint = part2;
p.style.visibility = 'visible';
}
function part2() {
ok(p.isVisible(), "Plugin should now be visible.");
paintCountIs(p, 1, "Plugin should have painted once.");
didPaint = part3;
p.setColor('FF0000FF'); // this causes an invalidate/repaint
}
const kTimeout = 5000; // 5 seconds
var part4GiveUp;
var part4Interval;
function part3() {
ok(p.isVisible(), "Plugin should still be visible.");
paintCountIs(p, 2, "Plugin should have painted twice.");
didPaint = function() {
ok(false, "Plugin should not paint when it is invisible.");
};
p.style.visibility = 'hidden';
part4GiveUp = Date.now() + kTimeout;
part4Interval = setInterval(part4, 100);
}
function part4() {
if (p.isVisible()) {
if (Date.now() < part4GiveUp)
return;
ok(false, "Plugin never became invisible in part4.");
SimpleTest.finish();
return;
}
clearInterval(part4Interval);
ok(true, "Plugin became invisible again.");
p.setColor('FF00FF00');
setTimeout(SimpleTest.finish, 500);
// wait to make sure we don't actually paint
}
function inPaint() {
// We're actually in the middle of painting the plugin so don't do anything
// complex here, for the sake of cases where async plugin painting isn't
// enabled yet
setTimeout(didPaint, 0);
// Don't run that didPaint callback again
didPaint = function() {};
}
</script>
<embed id="theplugin" class="hidden" type="application/x-test" drawmode="solid" color="FFFF0000" paintscript="inPaint()"></embed>
<script type="application/javascript">
var p = document.getElementById('theplugin');
</script>

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

@ -1,24 +1,24 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript" src="utils.js"></script>
<script>
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var w = window.open('xulbrowser_plugin_visibility.xul', '_blank', 'chrome,resizable=yes,width=400,height=600');
function done()
{
w.close();
SimpleTest.finish();
}
</script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;" />
</window>
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript" src="utils.js"></script>
<script>
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var w = window.open('xulbrowser_plugin_visibility.xul', '_blank', 'chrome,resizable=yes,width=400,height=600');
function done()
{
w.close();
SimpleTest.finish();
}
</script>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;" />
</window>

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

@ -1,44 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<title>Test whether windowed plugins with opacity:0 get their window set correctly</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<body onload="startTest()">
<script type="application/javascript;version=1.8">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var p = null;
function startTest() {
p = document.getElementById('theplugin');
if (!p.hasWidget()) {
todo(false, "This test is only relevant for windowed plugins");
SimpleTest.finish();
return;
}
// Wait for the plugin to have painted once.
var interval = setInterval(function() {
if (!p.getPaintCount())
return;
clearInterval(interval);
doTest();
SimpleTest.finish();
}, 100);
}
function doTest() {
is(p.getClipRegionRectCount(), 1, "getClipRegionRectCount should be a single rect");
is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100, "width of clip region rect");
is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 50, "height of clip region rect");
}
</script>
<p id="display"></p>
<!DOCTYPE html>
<html>
<head>
<title>Test whether windowed plugins with opacity:0 get their window set correctly</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<body onload="startTest()">
<script type="application/javascript;version=1.8">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
var p = null;
function startTest() {
p = document.getElementById('theplugin');
if (!p.hasWidget()) {
todo(false, "This test is only relevant for windowed plugins");
SimpleTest.finish();
return;
}
// Wait for the plugin to have painted once.
var interval = setInterval(function() {
if (!p.getPaintCount())
return;
clearInterval(interval);
doTest();
SimpleTest.finish();
}, 100);
}
function doTest() {
is(p.getClipRegionRectCount(), 1, "getClipRegionRectCount should be a single rect");
is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100, "width of clip region rect");
is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 50, "height of clip region rect");
}
</script>
<p id="display"></p>
<embed id="theplugin" type="application/x-test" width="100" height="50" style="opacity:0" wmode="window"></embed>

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

@ -1,139 +1,139 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical">
<tabbox id="tabbox" flex="1">
<tabs>
<tab id="tab1" label="Tab 1" />
<tab id="tab2" label="Tab 2" />
</tabs>
<tabpanels flex="1">
<browser id="browser1" type="content-primary" flex="1" src="about:blank"/>
<browser id="browser2" type="content-primary" flex="1" src="about:blank"/>
</tabpanels>
</tabbox>
<script type="application/javascript" src="utils.js"/>
<script type="application/javascript"><![CDATA[
const ok = window.opener.wrappedJSObject.ok;
const is = window.opener.wrappedJSObject.is;
const done = window.opener.wrappedJSObject.done;
const SimpleTest = window.opener.wrappedJSObject.SimpleTest;
const nsIWebProgress = Components.interfaces.nsIWebProgress;
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const kURI = 'http://mochi.test:8888/chrome/dom/plugins/test/mochitest/plugin_visibility_loader.html';
function ProgressListener() {
}
ProgressListener.prototype.onStateChange =
function(progress, req, flags, status) {
if ((flags & nsIWebProgressListener.STATE_IS_WINDOW) &&
(flags & nsIWebProgressListener.STATE_STOP))
browserLoaded();
};
ProgressListener.prototype.QueryInterface = function(iid) {
if (iid.equals(nsIWebProgressListener) ||
iid.equals(Components.interfaces.nsISupportsWeakReference))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
};
var loadCount = 0;
function browserLoaded() {
++loadCount;
if (2 == loadCount)
startTest();
}
var tabbox = document.getElementById('tabbox');
var browser1 = document.getElementById('browser1');
var browser2 = document.getElementById('browser2');
var progressListener1, progressListener2;
function setup() {
progressListener1 = new ProgressListener();
browser1.addProgressListener(progressListener1, nsIWebProgress.NOTIFY_STATE_WINDOW);
browser1.loadURI(kURI, null, null);
progressListener2 = new ProgressListener();
browser2.addProgressListener(progressListener2, nsIWebProgress.NOTIFY_STATE_WINDOW);
browser2.loadURI(kURI, null, null);
}
window.addEventListener("load", setup, false);
var plugin1, plugin2;
const kTimeout = 5000; // 5 seconds
var paintGiveUp;
var paintInterval;
function startTest() {
plugin1 = browser1.contentDocument.getElementById('p').wrappedJSObject;
plugin2 = browser2.contentDocument.getElementById('p').wrappedJSObject;
paintGiveUp = Date.now() + kTimeout;
paintInterval = setInterval(waitForPaint, 100);
}
function waitForPaint() {
if (!plugin1.isVisible()) {
if (Date.now() < paintGiveUp)
return;
ok(false, "Plugin in tab 1 never became visible.");
done();
return;
}
clearInterval(paintInterval);
ok(true, "Plugin in tab 1 should be visible.");
paintCountIs(plugin1, 1, "Plugin in tab 1 should have painted once.");
ok(!plugin2.isVisible(), "Plugin in tab 2 should not be visible.");
paintCountIs(plugin2, 0, "Plugin in tab 2 should not have painted.");
tabbox.selectedIndex = 1;
paintGiveUp = Date.now() + kTimeout;
paintInterval = setInterval(part2, 100);
}
function part2() {
if (!plugin2.isVisible()) {
if (Date.now() < paintGiveUp)
return;
ok(false, "Plugin in tab 2 never became visible.");
done();
return;
}
clearInterval(paintInterval);
ok(true, "Plugin in tab 2 became visible.");
paintCountIs(plugin2, 1, "Plugin in tab 2 should have painted once.");
ok(!plugin1.isVisible(), "Plugin in tab 1 should have become invisible.");
paintCountIs(plugin1, 1, "Plugin in tab 1 should have painted once.");
// Setcolor invalidates
plugin1.setColor('FF00FF00');
plugin2.setColor('FF00FF00');
setTimeout(part3, 500);
}
function part3() {
paintCountIs(plugin1, 1,
"Plugin in tab 1 should not have repainted after invalidate.");
paintCountIs(plugin2, 2,
"Plugin in tab 2 should have repainted after invalidate.");
done();
}
]]></script>
</window>
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical">
<tabbox id="tabbox" flex="1">
<tabs>
<tab id="tab1" label="Tab 1" />
<tab id="tab2" label="Tab 2" />
</tabs>
<tabpanels flex="1">
<browser id="browser1" type="content-primary" flex="1" src="about:blank"/>
<browser id="browser2" type="content-primary" flex="1" src="about:blank"/>
</tabpanels>
</tabbox>
<script type="application/javascript" src="utils.js"/>
<script type="application/javascript"><![CDATA[
const ok = window.opener.wrappedJSObject.ok;
const is = window.opener.wrappedJSObject.is;
const done = window.opener.wrappedJSObject.done;
const SimpleTest = window.opener.wrappedJSObject.SimpleTest;
const nsIWebProgress = Components.interfaces.nsIWebProgress;
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const kURI = 'http://mochi.test:8888/chrome/dom/plugins/test/mochitest/plugin_visibility_loader.html';
function ProgressListener() {
}
ProgressListener.prototype.onStateChange =
function(progress, req, flags, status) {
if ((flags & nsIWebProgressListener.STATE_IS_WINDOW) &&
(flags & nsIWebProgressListener.STATE_STOP))
browserLoaded();
};
ProgressListener.prototype.QueryInterface = function(iid) {
if (iid.equals(nsIWebProgressListener) ||
iid.equals(Components.interfaces.nsISupportsWeakReference))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
};
var loadCount = 0;
function browserLoaded() {
++loadCount;
if (2 == loadCount)
startTest();
}
var tabbox = document.getElementById('tabbox');
var browser1 = document.getElementById('browser1');
var browser2 = document.getElementById('browser2');
var progressListener1, progressListener2;
function setup() {
progressListener1 = new ProgressListener();
browser1.addProgressListener(progressListener1, nsIWebProgress.NOTIFY_STATE_WINDOW);
browser1.loadURI(kURI, null, null);
progressListener2 = new ProgressListener();
browser2.addProgressListener(progressListener2, nsIWebProgress.NOTIFY_STATE_WINDOW);
browser2.loadURI(kURI, null, null);
}
window.addEventListener("load", setup, false);
var plugin1, plugin2;
const kTimeout = 5000; // 5 seconds
var paintGiveUp;
var paintInterval;
function startTest() {
plugin1 = browser1.contentDocument.getElementById('p').wrappedJSObject;
plugin2 = browser2.contentDocument.getElementById('p').wrappedJSObject;
paintGiveUp = Date.now() + kTimeout;
paintInterval = setInterval(waitForPaint, 100);
}
function waitForPaint() {
if (!plugin1.isVisible()) {
if (Date.now() < paintGiveUp)
return;
ok(false, "Plugin in tab 1 never became visible.");
done();
return;
}
clearInterval(paintInterval);
ok(true, "Plugin in tab 1 should be visible.");
paintCountIs(plugin1, 1, "Plugin in tab 1 should have painted once.");
ok(!plugin2.isVisible(), "Plugin in tab 2 should not be visible.");
paintCountIs(plugin2, 0, "Plugin in tab 2 should not have painted.");
tabbox.selectedIndex = 1;
paintGiveUp = Date.now() + kTimeout;
paintInterval = setInterval(part2, 100);
}
function part2() {
if (!plugin2.isVisible()) {
if (Date.now() < paintGiveUp)
return;
ok(false, "Plugin in tab 2 never became visible.");
done();
return;
}
clearInterval(paintInterval);
ok(true, "Plugin in tab 2 became visible.");
paintCountIs(plugin2, 1, "Plugin in tab 2 should have painted once.");
ok(!plugin1.isVisible(), "Plugin in tab 1 should have become invisible.");
paintCountIs(plugin1, 1, "Plugin in tab 1 should have painted once.");
// Setcolor invalidates
plugin1.setColor('FF00FF00');
plugin2.setColor('FF00FF00');
setTimeout(part3, 500);
}
function part3() {
paintCountIs(plugin1, 1,
"Plugin in tab 1 should not have repainted after invalidate.");
paintCountIs(plugin2, 2,
"Plugin in tab 2 should have repainted after invalidate.");
done();
}
]]></script>
</window>