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.

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

mercurial