Bug 1115437: Part 2 - Update layout reftests to be compatible with asynchronous plugin initialization; r=roc

--HG--
extra : rebase_source : 77e24041ced152ff1e82c98ab943f9282f2aca7d
This commit is contained in:
Aaron Klotz 2015-01-27 14:44:06 -07:00
parent 9ff9f9c026
commit 040621b98e
8 changed files with 67 additions and 17 deletions

View File

@ -1,15 +1,12 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="setTimeout(doTest, 0)"
onload="setTimeout(function() { forceLoadPlugin('plugin'); }, 0)"
class="reftest-wait">
<script>
function doTest() {
document.documentElement.removeAttribute("class");
}
<script src="forceloadplugin.js">
</script>
<menulist>
<menupopup>
<html:embed type="application/x-test"></html:embed>
<html:embed type="application/x-test" id="plugin"></html:embed>
</menupopup>
</menulist>
</window>

View File

@ -1,7 +1,11 @@
<!DOCTYPE HTML>
<html style="overflow:hidden">
<body>
<html class="reftest-wait" style="overflow:hidden">
<head>
<script src="forceloadplugin.js">
</script>
</head>
<body onload="forceLoadPlugin('p')">
<object style="position:absolute; width:100%; height:100%; left:0; top:0;"
type="application/x-test"></object>
type="application/x-test" id="p"></object>
</body>
</html>

View File

@ -1,6 +1,14 @@
<!DOCTYPE HTML>
<html>
<body onload="document.getElementById('p').focus()">
<html class="reftest-wait">
<head>
<script src="forceloadplugin.js">
</script>
</head>
<body onload="forceLoadPlugin('p', function() {
var p = document.getElementById('p');
p.focus();
document.documentElement.removeAttribute('class');
})">
<object style="position:absolute; width:100%; height:100%; left:0; top:0;"
type="application/x-test" id="p"></object>
</body>

View File

@ -1,7 +1,9 @@
<!DOCTYPE HTML>
<html>
<body>
<embed style="-moz-transform:scaleY(-1)" type="application/x-test" drawmode="solid" color="FF00FF00" width="200" height="200"></embed>
<html class="reftest-wait">
<script src="forceloadplugin.js">
</script>
<body onload="forceLoadPlugin('p')">
<embed style="-moz-transform:scaleY(-1)" type="application/x-test" drawmode="solid" color="FF00FF00" width="200" height="200" id="p"></embed>
</body>
</html>

View File

@ -1,6 +1,10 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<body>
<head>
<script src="forceloadplugin.js">
</script>
</head>
<body onLoad="forceLoadPlugin('p', true)">
<embed type="application/x-test" id="p"
style="width:200px; height:400px;"></embed>
<script>

View File

@ -1,6 +1,10 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<body>
<head>
<script src="forceloadplugin.js">
</script>
</head>
<body onLoad="forceLoadPlugin('p', true)">
<embed type="application/x-test" id="p"
style="position:fixed; width:200px; height:200px;"></embed>
<script>

View File

@ -1,5 +1,13 @@
<!DOCTYPE HTML>
<embed type="application/x-test" drawmode="solid" color="#FFFF0000" style="width:400px; height:200px; display:block"></embed>
<html class="reftest-wait">
<head>
<script src="forceloadplugin.js">
</script>
</head>
<body onLoad="forceLoadPlugin('p')">
<embed type="application/x-test" drawmode="solid" color="#FFFF0000" style="width:400px; height:200px; display:block" id="p"></embed>
<div style="background:rgba(255,255,255,0.8); width:200px; position:relative; top:-200px; font-size:50px;">
Hello
</div>
</body>
</html>

View File

@ -0,0 +1,23 @@
function forceLoadPluginElement(id) {
var e = document.getElementById(id);
var found = e.pluginFoundElement;
}
function forceLoadPlugin(ids, dontRemoveClassAttribute) {
if (Array.isArray(ids)) {
ids.forEach(function(element, index, array) {
forceLoadPluginElement(element);
});
} else {
forceLoadPluginElement(ids);
}
if (dontRemoveClassAttribute) {
// In some tests we need to do other stuff instead of removing the class
// attribute. In that case we pass a function and run that before returning.
if (typeof dontRemoveClassAttribute === 'function') {
dontRemoveClassAttribute();
}
return;
}
document.documentElement.removeAttribute("class");
}