Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <!-- |
michael@0 | 3 | https://bugzilla.mozilla.org/show_bug.cgi?id=553917 |
michael@0 | 4 | --> |
michael@0 | 5 | <html> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for error handling aspect of Bug 827713</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 11 | <script type="application/javascript"> |
michael@0 | 12 | |
michael@0 | 13 | var stringBundleService = |
michael@0 | 14 | SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"] |
michael@0 | 15 | .getService(SpecialPowers.Ci.nsIStringBundleService); |
michael@0 | 16 | var g_bundl = |
michael@0 | 17 | stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties"); |
michael@0 | 18 | |
michael@0 | 19 | var g_errorInfo = { |
michael@0 | 20 | InvalidChild: { |
michael@0 | 21 | status : [false, false, false, false, false, false], |
michael@0 | 22 | args : [["mprescripts", "msubsup"], ["mprescripts", "msubsup"], |
michael@0 | 23 | ["mprescripts", "msub"], ["none", "msub"], ["none","msup"], |
michael@0 | 24 | ["none","msubsup"]] |
michael@0 | 25 | }, |
michael@0 | 26 | |
michael@0 | 27 | MMultiscriptsErrors: { |
michael@0 | 28 | status: [false, false], |
michael@0 | 29 | args: ["NoBase", "SubSupMismatch"] |
michael@0 | 30 | } |
michael@0 | 31 | }; |
michael@0 | 32 | |
michael@0 | 33 | var g_errorTypes = ["InvalidChild", "MMultiscriptsErrors"]; |
michael@0 | 34 | |
michael@0 | 35 | function getErrorMessage(name,idx) |
michael@0 | 36 | { |
michael@0 | 37 | if (name != "MMultiscriptsErrors") { |
michael@0 | 38 | return g_bundl.formatStringFromName(name,g_errorInfo[name].args[idx], |
michael@0 | 39 | g_errorInfo[name].args[idx].length); |
michael@0 | 40 | } |
michael@0 | 41 | else { |
michael@0 | 42 | return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]); |
michael@0 | 43 | } |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | /** Checks the roll call to see if all expected error messages were present. */ |
michael@0 | 47 | function processRollCall() |
michael@0 | 48 | { |
michael@0 | 49 | for (var i=0; i<g_errorTypes.length;i++) { |
michael@0 | 50 | for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) { |
michael@0 | 51 | ok(g_errorInfo[g_errorTypes[i]].status[j], |
michael@0 | 52 | "\"" + getErrorMessage(g_errorTypes[i], j) |
michael@0 | 53 | + "\" was expected to be in the error console."); |
michael@0 | 54 | } |
michael@0 | 55 | } |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | /** Tests a candidate to see if it is one of the expected messages and updates the |
michael@0 | 59 | g_errorInfo structure if it is. */ |
michael@0 | 60 | function doRollCall(msg) |
michael@0 | 61 | { |
michael@0 | 62 | for (var i = 0; i < g_errorTypes.length; i++) { |
michael@0 | 63 | for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) { |
michael@0 | 64 | if (msg == getErrorMessage(g_errorTypes[i], j)) |
michael@0 | 65 | { |
michael@0 | 66 | g_errorInfo[g_errorTypes[i]].status[j] = true; |
michael@0 | 67 | } |
michael@0 | 68 | } |
michael@0 | 69 | } |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | SpecialPowers.registerConsoleListener( |
michael@0 | 73 | function (msg) { |
michael@0 | 74 | if (msg.message == "SENTINEL") { |
michael@0 | 75 | processRollCall(); |
michael@0 | 76 | SimpleTest.finish(); |
michael@0 | 77 | } else if (msg.isScriptError) { |
michael@0 | 78 | doRollCall(msg.errorMessage); |
michael@0 | 79 | } |
michael@0 | 80 | }); |
michael@0 | 81 | |
michael@0 | 82 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 83 | </script> |
michael@0 | 84 | </head> |
michael@0 | 85 | <body onload="SpecialPowers.postConsoleSentinel();"> |
michael@0 | 86 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827713">Mozilla Bug 827713</a> |
michael@0 | 87 | |
michael@0 | 88 | <!-- InvalidChild --> |
michael@0 | 89 | <math> |
michael@0 | 90 | <msubsup> |
michael@0 | 91 | <mprescripts/> |
michael@0 | 92 | </msubsup> |
michael@0 | 93 | </math> |
michael@0 | 94 | |
michael@0 | 95 | <math> |
michael@0 | 96 | <msubsup> |
michael@0 | 97 | <mprescripts/> |
michael@0 | 98 | <mprescripts/> |
michael@0 | 99 | </msubsup> |
michael@0 | 100 | </math> |
michael@0 | 101 | |
michael@0 | 102 | <math> |
michael@0 | 103 | <msub> |
michael@0 | 104 | <mtext>a</mtext> |
michael@0 | 105 | <mprescripts/> |
michael@0 | 106 | <mtext>a</mtext> |
michael@0 | 107 | <mprescripts/> |
michael@0 | 108 | </msub> |
michael@0 | 109 | </math> |
michael@0 | 110 | |
michael@0 | 111 | <math> |
michael@0 | 112 | <msub> |
michael@0 | 113 | <mtext>a</mtext> |
michael@0 | 114 | <none/> |
michael@0 | 115 | </msub> |
michael@0 | 116 | </math> |
michael@0 | 117 | |
michael@0 | 118 | <math> |
michael@0 | 119 | <msup> |
michael@0 | 120 | <mtext>a</mtext> |
michael@0 | 121 | <none/> |
michael@0 | 122 | </msup> |
michael@0 | 123 | </math> |
michael@0 | 124 | |
michael@0 | 125 | <math> |
michael@0 | 126 | <msubsup> |
michael@0 | 127 | <mtext>a</mtext> |
michael@0 | 128 | <mtext>b</mtext> |
michael@0 | 129 | <none/> |
michael@0 | 130 | </msubsup> |
michael@0 | 131 | </math> |
michael@0 | 132 | |
michael@0 | 133 | <!-- NoBase --> |
michael@0 | 134 | <math> |
michael@0 | 135 | <mmultiscripts> |
michael@0 | 136 | <none/> |
michael@0 | 137 | <mtext>b</mtext> |
michael@0 | 138 | <mtext>c</mtext> |
michael@0 | 139 | </mmultiscripts> |
michael@0 | 140 | </math> |
michael@0 | 141 | |
michael@0 | 142 | <!-- SubSupMismatch --> |
michael@0 | 143 | <math> |
michael@0 | 144 | <mmultiscripts> |
michael@0 | 145 | <mtext>b</mtext> |
michael@0 | 146 | <mtext>c</mtext> |
michael@0 | 147 | <mprescripts/> |
michael@0 | 148 | <mtext>a</mtext> |
michael@0 | 149 | </mmultiscripts> |
michael@0 | 150 | </math> |
michael@0 | 151 | </body> |
michael@0 | 152 | </html> |