dom/bindings/test/test_exception_messages.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=882653
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 <title>Test for Bug 882653</title>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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 /** Test for Bug 882653 **/
michael@0 14 // Each test is a string to eval, the expected exception message, and the
michael@0 15 // test description.
michael@0 16 var tests = [
michael@0 17 [ 'document.documentElement.appendChild.call({}, new Image())',
michael@0 18 "'appendChild' called on an object that does not implement interface Node.",
michael@0 19 "bogus method this object" ],
michael@0 20 [ 'Object.getOwnPropertyDescriptor(Document.prototype, "documentElement").get.call({})',
michael@0 21 "'documentElement' getter called on an object that does not implement interface Document.",
michael@0 22 "bogus getter this object" ],
michael@0 23 [ 'Object.getOwnPropertyDescriptor(Element.prototype, "innerHTML").set.call({})',
michael@0 24 "'innerHTML' setter called on an object that does not implement interface Element.",
michael@0 25 "bogus setter this object" ],
michael@0 26 [ 'document.documentElement.appendChild(5)',
michael@0 27 "Argument 1 of Node.appendChild is not an object.",
michael@0 28 "bogus interface argument" ],
michael@0 29 [ 'document.documentElement.appendChild(null)',
michael@0 30 "Argument 1 of Node.appendChild is not an object.",
michael@0 31 "null interface argument" ],
michael@0 32 [ 'document.createTreeWalker(document).currentNode = 5',
michael@0 33 "Value being assigned to TreeWalker.currentNode is not an object.",
michael@0 34 "interface setter call" ],
michael@0 35 [ 'document.documentElement.appendChild({})',
michael@0 36 "Argument 1 of Node.appendChild does not implement interface Node.",
michael@0 37 "wrong interface argument" ],
michael@0 38 [ 'document.createTreeWalker(document).currentNode = {}',
michael@0 39 "Value being assigned to TreeWalker.currentNode does not implement interface Node.",
michael@0 40 "wrong interface setter call" ],
michael@0 41 [ 'document.createElement("canvas").getContext("2d").fill("bogus")',
michael@0 42 "Argument 1 of CanvasRenderingContext2D.fill 'bogus' is not a valid value for enumeration CanvasWindingRule.",
michael@0 43 "bogus enum value" ],
michael@0 44 [ 'document.createTreeWalker(document, 0xFFFFFFFF, { acceptNode: 5 }).nextNode()',
michael@0 45 "Property 'acceptNode' is not callable.",
michael@0 46 "non-callable callback interface operation property" ],
michael@0 47 [ '(new TextEncoder).encode("", new RegExp())',
michael@0 48 "Argument 2 of TextEncoder.encode can't be converted to a dictionary.",
michael@0 49 "regexp passed for a dictionary" ],
michael@0 50 [ 'URL.createObjectURL(null, null)',
michael@0 51 "Argument 1 is not valid for any of the 2-argument overloads of URL.createObjectURL.",
michael@0 52 "overload resolution failure" ],
michael@0 53 [ 'document.createElement("select").add({})',
michael@0 54 "Argument 1 of HTMLSelectElement.add could not be converted to any of: HTMLOptionElement, HTMLOptGroupElement.",
michael@0 55 "invalid value passed for union" ],
michael@0 56 [ 'document.createElement("canvas").getContext("2d").createLinearGradient(0, 1, 0, 1).addColorStop(NaN, "")',
michael@0 57 "Argument 1 of CanvasGradient.addColorStop is not a finite floating-point value.",
michael@0 58 "invalid float" ]
michael@0 59 ];
michael@0 60
michael@0 61 for (var i = 0; i < tests.length; ++i) {
michael@0 62 msg = "Correct exception should be thrown for " + tests[i][2];
michael@0 63 try {
michael@0 64 eval(tests[i][0]);
michael@0 65 ok(false, msg);
michael@0 66 } catch (e) {
michael@0 67 is(e.message, tests[i][1], msg);
michael@0 68 }
michael@0 69 }
michael@0 70
michael@0 71 </script>
michael@0 72 </head>
michael@0 73 <body>
michael@0 74 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=882653">Mozilla Bug 882653</a>
michael@0 75 <p id="display"></p>
michael@0 76 <div id="content" style="display: none">
michael@0 77
michael@0 78 </div>
michael@0 79 <pre id="test">
michael@0 80 </pre>
michael@0 81 </body>
michael@0 82 </html>

mercurial