dom/xbl/test/test_bug371724.xhtml

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 <?xml version="1.0" encoding="UTF-8"?>
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=371724
     5 -->
     6 <head>
     7   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
     8   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     9   <bindings xmlns="http://www.mozilla.org/xbl">
    10     <binding id="rd">
    11       <implementation>
    12         <property name="hallo" onget="return true;" readonly="true" exposeToUntrustedContent="true"/>
    13       </implementation>
    14     </binding>
    15   </bindings>
    16 </head>
    17 <body>
    18   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=371724">Mozilla Bug 371724</a>
    19   <p id="display"></p>
    20   <div id="content" style="display: none"></div>
    21   <div id="a" style="-moz-binding:url('#rd');">Success!</div>
    22   <pre id="test">
    23     <script class="testbody" type="text/javascript">  
    24       /** Test for Bug 371724 **/
    25       SimpleTest.waitForExplicitFinish();
    26       function checkReadOnly() {
    27         var elt = document.getElementById('a');
    28         var oldValue = elt.hallo;
    29         var actual;
    30         try {
    31           elt.hallo = false;
    32           actual = elt.hallo;
    33         } catch (ex) {
    34           actual = "" + ex;
    35         }
    36         is(actual, true,
    37            "Setting a readonly xbl property should do nothing if !strict");
    38         checkReadOnlyStrict();
    39       }
    40       function checkReadOnlyStrict() {
    41         "use strict";
    42         var elt = document.getElementById('a');
    43         var actual;
    44         try {
    45           elt.hallo = false;
    46           actual = "should have thrown";
    47         } catch (ex) {
    48           actual = ex instanceof TypeError;
    49         }
    50         is(actual, true,
    51            "Setting a readonly xbl property should throw a TypeError exception if strict");
    52         SimpleTest.finish();
    53       }
    54       addLoadEvent(checkReadOnly);
    55     </script>
    56   </pre>
    57 </body>
    58 </html>

mercurial