toolkit/content/tests/widgets/head.js

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 "use strict";
     3 function waitForCondition(condition, nextTest, errorMsg) {
     4   var tries = 0;
     5   var interval = setInterval(function() {
     6     if (tries >= 30) {
     7       ok(false, errorMsg);
     8       moveOn();
     9     }
    10     var conditionPassed;
    11     try {
    12       conditionPassed = condition();
    13     } catch (e) {
    14       ok(false, e + "\n" + e.stack);
    15       conditionPassed = false;
    16     }
    17     if (conditionPassed) {
    18       moveOn();
    19     }
    20     tries++;
    21   }, 100);
    22   var moveOn = function() { clearInterval(interval); nextTest(); };
    23 }

mercurial