Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <!DOCTYPE HTML>
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=553917
4 -->
5 <html>
6 <head>
7 <title>Test for Bug 553917</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 <script type="application/javascript">
12 var stringBundleService =
13 SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"]
14 .getService(SpecialPowers.Ci.nsIStringBundleService);
15 var g_bundl =
16 stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties");
18 var g_errorInfo = {
19 /*<math><mroot></mroot></math>
20 <math><msub></msub></math>
21 <math><msup></msup></math>
22 <math><mfrac></mfrac></math>
23 <math><msubsup></msubsup></math>
24 <math><munderover></munderover></math>*/
25 ChildCountIncorrect: {
26 status : [false, false, false, false, false, false],
27 args : [["mroot"], ["msub"], ["msup"], ["mfrac"], ["msubsup"], ["munderover"]] },
28 /*<math fontfamily="serif"></math>
29 <math color="#112233"></math>
30 <math background="#FFFFFF"></math>
31 <math fontsize="10"></math>
32 <math xlink:href="http://www.mozilla.org"></math>*/
33 DeprecatedSupersededBy: {
34 status: [false, false, false, false, false],
35 args: [["fontfamily","mathvariant"],["color","mathcolor"], ["background","mathbackground"],
36 ["fontsize","mathsize"], ["xlink:href","href"]] },
37 /*<math><mpadded width="BAD!"></mpadded></math>
38 <math><mpadded height="BAD!"></mpadded></math>
39 <math><mpadded voffset="BAD!"></mpadded></math>*/
40 AttributeParsingError: {
41 status: [false, false, false],
42 args: [["BAD!","width","mpadded"], ["BAD!","height","mpadded"], ["BAD!","voffset","mpadded"]]
43 },
44 /*<math scriptlevel="BAD!"></math>
45 <math scriptsizemultiplier="BAD!"></math>*/
46 AttributeParsingErrorNoTag: {
47 status: [false, false],
48 args: [["BAD!","scriptlevel"], ["BAD!","scriptsizemultiplier"]]
49 },
50 /* <math><mo rspace="2..0">+</mo></math>
51 <math><mo minsize="1.5notaunit">+</mo></math>
52 <math><mspace width="2"/></math>
53 <math><mo lspace="BADlspace">+</mo></math>
54 <math><mspace height="BADheight"/></math>
55 <math><mspace depth="BADdepth"/></math>*/
56 LengthParsingError : {
57 status: [false, false, false, false, false, false],
58 args: [["2..0"], ["1.5notaunit"], ["2"],["BADlspace"],["BADheight"],["BADdepth"]]
59 },
60 /*<math><mmultiscripts></mmultiscripts></math>
61 <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
62 <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>*/
63 MMultiscriptsErrors: {
64 status: [false, false, false],
65 args: ["NoBase","DuplicateMprescripts", "SubSupMismatch"]
66 },
67 /*<math><mo minsize="2">+</mo></math>*/
68 UnitlessValuesAreDeprecated : {
69 status : [false],
70 args : [[]] }};
72 var g_errorTypes = ["ChildCountIncorrect","DeprecatedSupersededBy","AttributeParsingError",
73 "AttributeParsingErrorNoTag","LengthParsingError", "MMultiscriptsErrors",
74 "UnitlessValuesAreDeprecated"];
76 function getErrorMessage(name,idx)
77 {
78 if (name != "MMultiscriptsErrors") {
79 var formatParams = g_errorInfo[name].args[idx];
80 if (formatParams.length > 0) {
81 return g_bundl.formatStringFromName(name,formatParams,formatParams.length);
82 } else {
83 return g_bundl.GetStringFromName(name);
84 }
85 } else {
86 return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
87 }
88 }
90 /** Checks the roll call to see if all expected error messages were present. */
91 function processRollCall()
92 {
93 for (var i=0; i<g_errorTypes.length;i++) {
94 for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
95 ok(g_errorInfo[g_errorTypes[i]].status[j],
96 "\"" + getErrorMessage(g_errorTypes[i], j)
97 + "\" was expected to be in the error console.");
98 }
99 }
100 }
102 /** Tests a candidate to see if it is one of the expected messages and updates the
103 g_errorInfo structure if it is. */
104 function doRollCall(msg)
105 {
106 for (var i = 0; i < g_errorTypes.length; i++) {
107 for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
108 if (msg == getErrorMessage(g_errorTypes[i], j))
109 {
110 g_errorInfo[g_errorTypes[i]].status[j] = true;
111 }
112 }
113 }
114 }
116 SpecialPowers.registerConsoleListener(
117 function (msg) {
118 if (msg.message == "SENTINEL") {
119 processRollCall();
120 SimpleTest.finish();
121 } else if (msg.isScriptError) {
122 doRollCall(msg.errorMessage);
123 }
124 });
126 SimpleTest.waitForExplicitFinish();
127 </script>
128 </head>
129 <body onload="SpecialPowers.postConsoleSentinel();">
130 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=553917">Mozilla Bug 553917</a>
131 <!-- ChildCountIncorrect -->
132 <math><mroot></mroot></math>
133 <math><msub></msub></math>
134 <math><msup></msup></math>
135 <math><mfrac></mfrac></math>
136 <math><msubsup></msubsup></math>
137 <math><munderover></munderover></math>
139 <!-- DeprecatedSupersededBy -->
140 <math fontfamily="serif"></math>
141 <math color="#112233"></math>
142 <math background="#FFFFFF"></math>
143 <math fontsize="10"></math>
144 <math xlink:href="http://www.mozilla.org"></math>
146 <!-- AttributeParsingError -->
147 <math><mpadded width="BAD!"></mpadded></math>
148 <math><mpadded height="BAD!"></mpadded></math>
149 <math><mpadded voffset="BAD!"></mpadded></math>
151 <!-- AttributeParsingErrorNoTag -->
152 <math scriptlevel="BAD!"></math>
153 <math scriptsizemultiplier="BAD!"></math>
155 <!-- LengthParsingError -->
156 <math><mo rspace="2..0">+</mo></math>
157 <math><mo minsize="1.5notaunit">+</mo></math>
158 <math><mspace width="2"/></math>
159 <math><mo lspace="BADlspace">+</mo></math>
160 <math><mspace height="BADheight"/></math>
161 <math><mspace depth="BADdepth"/></math>
163 <!-- MMultiscriptsErrors -->
164 <math><mmultiscripts></mmultiscripts></math>
165 <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
166 <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>
168 <!-- UnitlessValuesAreDeprecated -->
169 <math><mo minsize="2">+</mo></math>
170 </body>
171 </html>