embedding/test/test_bug499115.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 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     3    - License, v. 2.0. If a copy of the MPL was not distributed with this
     4    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     6 <html>
     7 <!--
     8 https://bugzilla.mozilla.org/show_bug.cgi?id=499115
     9 -->
    10 <head>
    11   <title>Test for Bug 499115</title>
    12   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    13   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    14 </head>
    15 <body onload="onLoad();">
    16   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=499115">Mozilla Bug 499115</a>
    17   <p id="display"></p>
    18   <div id="content" style="display: none">
    19   </div>
    20   <pre id="test">
    21     <script type="application/javascript">
    23       /** Test for Bug 499115 **/
    24       SimpleTest.waitForExplicitFinish();
    26       const SEARCH_TEXT="minefield";
    28       function getMatches() {
    29         var numMatches = 0;
    31         var searchRange = document.createRange();
    32         searchRange.selectNodeContents(document.body);
    34         var startPoint = searchRange.cloneRange();
    35         startPoint.collapse(true);
    37         var endPoint = searchRange.cloneRange();
    38         endPoint.collapse(false);
    40         var retRange = null;
    41         var finder = SpecialPowers.Cc["@mozilla.org/embedcomp/rangefind;1"]
    42                                   .createInstance(SpecialPowers.Ci.nsIFind);
    44         finder.caseSensitive = false;
    46         while ((retRange = finder.Find(SEARCH_TEXT, searchRange,
    47                                        startPoint, endPoint))) {
    48           numMatches++;
    50           // Start next search from end of current match
    51           startPoint = retRange.cloneRange();
    52           startPoint.collapse(false);
    53         }
    55         return numMatches;
    56        }
    58        function onLoad() {
    59          var matches = getMatches();
    60          is(matches, 2, "found second match in anonymous content");
    61          SimpleTest.finish();
    62        }
    63    </script>
    64   </pre>
    65 <input type="text" value="minefield minefield"></body>
    66 </html>

mercurial