toolkit/content/tests/widgets/head.js

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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