Bug 655701 - Remove test dependencies on the html5.parser.enable pref. r=ted.mielczarek.
authorHenri Sivonen <hsivonen@iki.fi>
Thu, 12 May 2011 10:56:37 +0300
changeset 69378 63fe82a5f1421c933ff662d1f63550b59494edcf
parent 69377 11d16811104f3cdf883e997170bffb7f2ac3a0ae
child 69379 2f5f0bc44bdfbf9013d34e1b2c61cccab907737c
push id19949
push userhsivonen@iki.fi
push dateThu, 12 May 2011 07:58:44 +0000
treeherdermozilla-central@63fe82a5f142 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted.mielczarek
bugs655701
milestone6.0a1
first release with
nightly win64
63fe82a5f142 / 6.0a1 / 20110512030216 / files
nightly linux32
nightly linux64
nightly mac
nightly win32
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win64
Bug 655701 - Remove test dependencies on the html5.parser.enable pref. r=ted.mielczarek.
content/base/test/test_bug503473.html
content/base/test/test_bug527896.html
content/html/content/test/test_bug389797.html
content/html/content/test/test_bug555567.html
content/html/content/test/test_bug562932.html
content/html/document/test/Makefile.in
content/html/document/test/test_bug255820.html
content/html/document/test/test_bug570376.html
layout/reftests/bugs/reftest.list
parser/htmlparser/tests/mochitest/parser_web_testrunner.js
parser/htmlparser/tests/mochitest/test_bug502091.html
parser/htmlparser/tests/mochitest/test_compatmode.html
--- a/content/base/test/test_bug503473.html
+++ b/content/base/test/test_bug503473.html
@@ -12,32 +12,23 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=503473">Mozilla Bug 503473</a>
 <p id="display"></p>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** 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() {
   var iframe = document.getElementById("iframe");
   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();
 }
 
 </script>
 </pre>
 <div id="content" style="display: none">
   <iframe id='iframe' src="file_bug503473-frame.sjs">
   </iframe>
--- a/content/base/test/test_bug527896.html
+++ b/content/base/test/test_bug527896.html
@@ -15,22 +15,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
   <iframe></iframe>
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** 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;
 var scriptInsertedSrcExecuted = false;
 
 // the iframe test runs with the HTML5 parser
 
 var iframe = document.getElementsByTagName('iframe')[0];
@@ -53,20 +47,15 @@ div.appendChild(script); // this shouldn
 script.setAttribute("src", "data:text/javascript,scriptInsertedSrcExecuted = true;");
 
 todo(false, "Add SVG tests after bug 528442.");
 
 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();
 }
 
 </script>
 </pre>
 </body>
 </html>
--- a/content/html/content/test/test_bug389797.html
+++ b/content/html/content/test/test_bug389797.html
@@ -19,20 +19,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 389797 **/
 var allTags = [];
 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";
 }
 
 function HTML_TAG(aTagName, aImplClass) {
   allTags.push(aTagName);
   classInfos[aTagName] = aImplClass;
   interfaces[aTagName] =
@@ -174,24 +170,17 @@ HTML_TAG("iframe", "IFrame", [ "nsIDOMNS
                              [ "nsIFrameLoaderOwner" ]);
 HTML_TAG("image", "Span");
 HTML_TAG("img", "Image", [], [ "imgIDecoderObserver",
                                "nsIImageLoadingContent" ]);
 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("isindex", ""); // HTMLElement
 HTML_TAG("kbd", ""); // HTMLElement
 HTML_TAG("keygen", "Span");
 HTML_TAG("label", "Label");
 HTML_TAG("legend", "Legend");
 HTML_TAG("li", "LI");
 HTML_TAG("link", "Link", [ "nsIDOMLinkStyle" ]);
 HTML_TAG("listing", ""); // HTMLElement
 HTML_TAG("map", "Map");
--- a/content/html/content/test/test_bug555567.html
+++ b/content/html/content/test/test_bug555567.html
@@ -21,30 +21,23 @@ https://bugzilla.mozilla.org/show_bug.cg
   <legend id="c"></legend>
 </div>
 <pre id="test">
 <p id="display"></p>
 <script type="application/javascript">
 
 /** 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);
+var a = document.getElementById('a');
+var b = document.getElementById('b');
+var c = document.getElementById('c');
 
-if (prefs.getBoolPref("html5.parser.enable")) {
-  var a = document.getElementById('a');
-  var b = document.getElementById('b');
-  var c = document.getElementById('c');
-
-  isnot(a.form, null,
-    "First legend element should have a not null form IDL attribute");
-  is(b.form, null,
-    "Second legend element should have a null form IDL attribute");
-  is(c.form, null,
-    "Third legend element should have a null form IDL attribute");
-}
+isnot(a.form, null,
+  "First legend element should have a not null form IDL attribute");
+is(b.form, null,
+  "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>
 </body>
 </html>
--- a/content/html/content/test/test_bug562932.html
+++ b/content/html/content/test/test_bug562932.html
@@ -33,23 +33,16 @@ https://bugzilla.mozilla.org/show_bug.cg
   <label id='l13' for=''><input></label>
   <!-- <label id='l14'> is created in script -->
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** 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;
 
   if (aElementId != null) {
     element = document.getElementById(aElementId);
   }
 
@@ -59,26 +52,22 @@ function checkControl(aLabelId, aElement
 ok('control' in document.createElement('label'),
    "label element should have a control IDL attribute");
 
 checkControl('l1', 'i1', "label control should be the first form element");
 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('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('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");
 checkControl('l6', null,
              "label control should be null if the id in @for is not valid");
 checkControl('l7', null,
              "label control should be null if the id in @for is not valid");
 checkControl('l8', null,
--- a/content/html/document/test/Makefile.in
+++ b/content/html/document/test/Makefile.in
@@ -97,17 +97,16 @@ include $(topsrcdir)/config/rules.mk
 		test_bug482659.html \
 		test_bug486741.html \
 		test_bug489532.html \
 		test_bug497242.xhtml \
 		test_bug499092.html \
 		bug499092.xml \
 		bug499092.html \
 		test_bug512367.html \
-		test_bug570376.html \
 		test_bug571981.html \
 		$(NULL)
 
 ifneq (mobile,$(MOZ_BUILD_APP))
 _BROWSER_TEST_FILES = \
 		browser_bug592641.js \
 		bug592641_img.jpg \
 		$(NULL)
--- a/content/html/document/test/test_bug255820.html
+++ b/content/html/document/test/test_bug255820.html
@@ -64,21 +64,16 @@ function f3Continue() {
                  'is(doc.defaultView.getComputedStyle(doc.body, "").color, ' +
                  '   "rgb(0, 180, 0)",' +
                  '   "Wrong color after reload");' +
                  "charsetTestFinished('f1', this.contentDocument, 'UTF-8')");
   $("f3").contentWindow.location.reload();
 }
 
 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");
   doc.open();
   doc.write('<html></html>');
   doc.close();
   is(doc.characterSet, "UTF-8",
      "Unexpected character set for first frame after write");
@@ -95,27 +90,20 @@ function runTest() {
   str += '<script src="data:application/javascript,"><'+'/script>';
   str += '<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">';
   str += '</head><body>';
   str += '</body></html>';
   doc.write(str);
   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()");
-  }
+  $("f2").
+    setAttribute("onload",
+      "charsetTestFinished('f2', this.contentDocument, 'UTF-8');" +
+      "f2Continue()");
 
   doc = $("f3").contentDocument;
   is(doc.characterSet, "UTF-8",
      "Unexpected initial character set for first frame");
   doc.open();
   var str = '<html><head>';
   str += '<style>body { color: rgb(255, 0, 0) }</style>';
   str += '<link type="text/css" rel="stylesheet" href="data:text/css, body { color: rgb(0, 180, 0) }">';
deleted file mode 100644
--- a/content/html/document/test/test_bug570376.html
+++ /dev/null
@@ -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>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -326,17 +326,17 @@ fails-if(Android) == 302379.html 302379-
 == 307102-3.html 307102-3-ref.html
 == 307102-4.html 307102-4-ref.html
 == 308406-1.html 308406-1-ref.html
 == 308406-2.html 308406-2-ref.html
 == 309550-1.html 309550-1-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
 == 311822-1.html 311822-1-ref-b.html
 == 315620-1a.html 315620-1-ref.html
 != 315620-1b.html 315620-1-ref.html
 == 315620-2a.xhtml 315620-2-ref.xhtml
 != 315620-2b.xhtml 315620-2-ref.xhtml
--- a/parser/htmlparser/tests/mochitest/parser_web_testrunner.js
+++ b/parser/htmlparser/tests/mochitest/parser_web_testrunner.js
@@ -133,18 +133,16 @@ function nextTest(testframe) {
                                        fragment, 
                                        testframe));
     } else {
       dataURL = "data:text/html;charset=utf-8," + encodeURIComponent(input);
       testframe.onload = makeTestChecker(input, output, errors);
       testframe.src = dataURL;
     }
   } catch (err if err instanceof StopIteration) {
-    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-    prefService.setBoolPref("html5.parser.enable", origPref);
     SimpleTest.finish();
   }
 }
 
 var testFileContents = [];
 function loadNextTestFile() {
   var datFile = parserDatFiles.shift();
   if (datFile) {
@@ -158,16 +156,10 @@ function loadNextTestFile() {
     xhr.open("GET", "html5lib_tree_construction/" + datFile);
     xhr.send();
   } else {
     testcases = test_parser(testFileContents);
     nextTest($("testframe"));
   }
 }
 
-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();
--- a/parser/htmlparser/tests/mochitest/test_bug502091.html
+++ b/parser/htmlparser/tests/mochitest/test_bug502091.html
@@ -16,34 +16,23 @@ Adding a <meta> element by writing to in
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <div id="test">
 <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";
   iframe.onload = function () {
     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);
 
 </script>
 </div>
 </body>
 </html>
 
--- a/parser/htmlparser/tests/mochitest/test_compatmode.html
+++ b/parser/htmlparser/tests/mochitest/test_compatmode.html
@@ -48,92 +48,47 @@ var doctypes = [
 'BackCompat' , '<!DOCTYPEz HTML PUBLIC "-//IETF//DTD HTML 3.2//en">',
 'BackCompat' , '<!DOCTYPE HTMLz PUBLIC "DTD HTML 3.2">',
 'BackCompat' , '<!DOCTYPE "DTD HTML 3.2">',
 /* end from bug 363883 */
 // from bug 502600
 '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();
-    }
-    else {
-      finishTest();
-    }
+    SimpleTest.finish();
   }
 }
 
 ////
-// 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();
-}
-
-////
 // Insert a hidden iframe into the document, with the src 
 // containing the test doctype.  The iframe's onload
 // function is set to call the test's verification step.
 //
 function insert_iframe(doctype,expected) {
   var elm = document.createElement('iframe');
   elm.setAttribute('src', 'data:text/html,' + doctype +
     '<html><body onload="parent.test(document.compatMode,'+i+')"></body>');
   elm.setAttribute('style', 'display:none');
   document.getElementsByTagName('body')[0].appendChild(elm);
 }
 
 ////
-// 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) {
     insert_iframe(doctypes[i+1],doctypes[i]);
   }
 }
 
 ////
-// 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();
 
 </script>
 </pre>
 </body>
 </html>