Bug 655701 - Remove test dependencies on the html5.parser.enable pref. r=ted.mielczarek.

This commit is contained in:
Henri Sivonen 2011-05-12 10:56:37 +03:00
Родитель 5b91815474
Коммит 92fadb988d
12 изменённых файлов: 22 добавлений и 192 удалений

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

@ -17,12 +17,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=503473
/** Test for Bug 503473 **/
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gOriginalHtml5Pref = prefs.getBoolPref("html5.parser.enable");
prefs.setBoolPref("html5.parser.enable", true);
SimpleTest.waitForExplicitFinish();
function done() {
@ -30,9 +24,6 @@ function done() {
var divs = iframe.contentWindow.document.getElementsByTagName("div").length;
is(divs, 0, "Div wasn't blown away.")
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
prefs.setBoolPref("html5.parser.enable", gOriginalHtml5Pref);
SimpleTest.finish();
}

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

@ -20,12 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=527896
/** Test for Bug 527896 **/
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gOriginalHtml5Pref = prefs.getBoolPref("html5.parser.enable");
prefs.setBoolPref("html5.parser.enable", true);
SimpleTest.waitForExplicitFinish();
var docWrittenSrcExecuted = false;
@ -58,11 +52,6 @@ function done() {
ok(docWrittenSrcExecuted, "document.written src didn't execute");
ok(scriptInsertedSrcExecuted, "script-inserted src didn't execute");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("html5.parser.enable", gOriginalHtml5Pref);
SimpleTest.finish();
}

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

@ -24,10 +24,6 @@ var classInfos = {};
var interfaces = {};
var interfacesNonClassinfo = {};
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
function getClassName(tag) {
return "HTML" + classInfos[tag] + "Element";
}
@ -179,14 +175,7 @@ HTML_TAG("input", "Input", [], [ "imgIDecoderObserver",
"nsIImageLoadingContent",
"nsIDOMNSEditableElement" ]);
HTML_TAG("ins", "Ins", [ "nsIDOMHTMLModElement" ]);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
if (prefs.getBoolPref("html5.parser.enable")) {
HTML_TAG("isindex", ""); // HTMLElement
} else {
HTML_TAG("isindex", "IsIndex");
}
HTML_TAG("kbd", ""); // HTMLElement
HTML_TAG("keygen", "Span");
HTML_TAG("label", "Label");

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

@ -26,12 +26,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=555567
/** Test for Bug 555567 **/
// This test works only with html5 parser.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (prefs.getBoolPref("html5.parser.enable")) {
var a = document.getElementById('a');
var b = document.getElementById('b');
var c = document.getElementById('c');
@ -42,7 +36,6 @@ if (prefs.getBoolPref("html5.parser.enable")) {
"Second legend element should have a null form IDL attribute");
is(c.form, null,
"Third legend element should have a null form IDL attribute");
}
</script>
</pre>

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

@ -38,13 +38,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=562932
/** Test for Bug 562932 **/
// Check if we are using the html5 parser
// because some tests will fail otherwise.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var gHtml5Parser = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch)
.getBoolPref("html5.parser.enable");
function checkControl(aLabelId, aElementId, aMsg)
{
var element = null;
@ -64,16 +57,12 @@ checkControl('l2', 'i2', "label control should be the first form element");
checkControl('l3', null, "label control should be null when there is no child");
checkControl('l4a', null, "label control should be null when there is no \
labelable form element child");
if (gHtml5Parser) {
checkControl('l4b', 'i3', "label control should be the first labelable element \
in tree order");
}
checkControl('l4c', 'i3', "label control should be the first labelable element \
in tree order");
if (gHtml5Parser) {
checkControl('l4d', 'i3b', "label control should be the first labelable element \
in tree order");
}
checkControl('l4e', 'i3b', "label control should be the first labelable element \
in tree order");
checkControl('l5', 'i1', "label control should be the id in @for");

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

@ -102,7 +102,6 @@ _TEST_FILES = test_bug1682.html \
bug499092.xml \
bug499092.html \
test_bug512367.html \
test_bug570376.html \
test_bug571981.html \
$(NULL)

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

@ -69,11 +69,6 @@ function f3Continue() {
}
function runTest() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var html5enabled = prefs.getBoolPref("html5.parser.enable");
var doc = $("f1").contentDocument;
is(doc.characterSet, "UTF-8",
"Unexpected initial character set for first frame");
@ -100,17 +95,10 @@ function runTest() {
doc.close();
is(doc.characterSet, "UTF-8",
"Unexpected character set for second frame after write");
if (html5enabled) {
$("f2").
setAttribute("onload",
"charsetTestFinished('f2', this.contentDocument, 'UTF-8');" +
"f2Continue()");
} else {
$("f2").
setAttribute("onload",
"charsetTestFinished('f2', this.contentDocument, 'us-ascii');" +
"f2Continue()");
}
doc = $("f3").contentDocument;
is(doc.characterSet, "UTF-8",

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

@ -1,44 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=570376
-->
<head>
<title>Test for Bug 570376</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=570376">Mozilla Bug 570376</a>
<p id="display">
<iframe id="testiframe"></iframe>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 570376
Don't crash loading <form><legend> with the html5 parser preffed off.
**/
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gOriginalHtml5Pref = prefs.getBoolPref("html5.parser.enable");
prefs.setBoolPref("html5.parser.enable", false);
$("testiframe").onload = function () {
ok(true, "Shouldn't crash loading a form containing a legend with the html5 parser preffed off");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("html5.parser.enable", gOriginalHtml5Pref);
}
$("testiframe").src = "data:text/html,<form><legend>";
</script>
</pre>
</body>
</html>

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

@ -331,7 +331,7 @@ fails-if(Android) == 302379.html 302379-ref.html
== 309914-1.xul 309914-1-ref.xul
== 311366-unknown-inline-1.html 311366-unknown-inline-1-ref.html
== 311366-unknown-block-1.html 311366-unknown-block-1-ref.html
fails-if(!prefs.getBoolPref("html5.parser.enable")) == 311366-unknown-block-3.html 311366-unknown-block-3-ref.html
== 311366-unknown-block-3.html 311366-unknown-block-3-ref.html
== 311366-unknown-block-2.html 311366-unknown-block-2-ref.html
== 311366-unknown-inline-2.html 311366-unknown-inline-2-ref.html
== 311822-1.html 311822-1-ref-a.html

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

@ -138,8 +138,6 @@ function nextTest(testframe) {
testframe.src = dataURL;
}
} catch (err if err instanceof StopIteration) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
prefService.setBoolPref("html5.parser.enable", origPref);
SimpleTest.finish();
}
}
@ -163,11 +161,5 @@ function loadNextTestFile() {
}
}
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch)
.QueryInterface(Components.interfaces.nsIPrefService);
var origPref = prefService.getBoolPref("html5.parser.enable");
prefService.setBoolPref("html5.parser.enable", true);
addLoadEvent(loadNextTestFile);
SimpleTest.waitForExplicitFinish();

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

@ -21,12 +21,6 @@ Adding a <meta> element by writing to innerHTML should work correctly.
<script class="testbody" type="text/javascript">
function $(id) { return document.getElementById(id); }
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gOriginalHtml5Pref = prefs.getBoolPref("html5.parser.enable");
prefs.setBoolPref("html5.parser.enable", true);
var iframe=document.createElement("iframe");
iframe.setAttribute("id", "iframe");
iframe.src = "bug_502091_iframe.html";
@ -34,11 +28,6 @@ Adding a <meta> element by writing to innerHTML should work correctly.
var div = $("iframe").contentDocument.getElementById("testdiv");
var meta = div.getElementsByTagName("meta");
is(meta.length, 1, "meta element not added to div");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("html5.parser.enable", gOriginalHtml5Pref);
};
$("test").appendChild(iframe);

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

@ -53,51 +53,11 @@ var doctypes = [
'BackCompat' , '<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">',
];
////
// Restore the original value of the html5.parser.enable pref,
// and finish.
//
function finishTest() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("html5.parser.enable", gOriginalHtml5Pref);
SimpleTest.finish();
}
////
// Verify that the iframe's compatibility mode matches
// the expected value. This function is called from the
// test iframe's onload handler. When verifying the
// last test in the group, if there is no original
// value for the html5.parser.enable pref stored in the
// 'gOriginalHtml5Pref' variable, then run the tests
// again in HTML5 mode. Otherwise, finish the test.
//
function test(mode,i){
is(mode,doctypes[i],doctypes[i+1]);
if (i == doctypes.length - 2) {
if (typeof(gOriginalHtml5Pref) == "undefined") {
doTestHtml5();
SimpleTest.finish();
}
else {
finishTest();
}
}
}
////
// Enable the HTML5 parser, then iterate through the tests
// a second time.
//
function doTestHtml5() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
gOriginalHtml5Pref = prefs.getBoolPref("html5.parser.enable");
prefs.setBoolPref("html5.parser.enable", true);
doTest();
}
////
@ -114,8 +74,7 @@ function insert_iframe(doctype,expected) {
}
////
// First iteration of the compatibility mode tests, without
// the HTML5 parser enabled.
// Iterate over the tests
//
function doTest() {
for (i=0; i < doctypes.length; i+=2) {
@ -124,12 +83,8 @@ function doTest() {
}
////
// Run the compatbility mode tests. First, the tests are run
// without the HTML5 parser enabled. Completing the last test
// then triggers a second iteration, this time with the HTML5
// parser enabled.
// Run the compatbility mode tests.
//
var gOriginalHtml5Pref;
SimpleTest.waitForExplicitFinish();
doTest();