browser/base/content/test/newtab/browser_newtab_disable.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /*
     5  * These tests make sure that the 'New Tab Page' feature can be disabled if the
     6  * decides not to use it.
     7  */
     8 function runTests() {
     9   // create a new tab page and hide it.
    10   yield setLinks("0,1,2,3,4,5,6,7,8");
    11   setPinnedLinks("");
    13   yield addNewTabPageTab();
    14   let gridNode = getGrid().node;
    16   ok(!gridNode.hasAttribute("page-disabled"), "page is not disabled");
    18   NewTabUtils.allPages.enabled = false;
    19   ok(gridNode.hasAttribute("page-disabled"), "page is disabled");
    21   let oldGridNode = gridNode;
    23   // create a second new tage page and make sure it's disabled. enable it
    24   // again and check if the former page gets enabled as well.
    25   yield addNewTabPageTab();
    26   ok(gridNode.hasAttribute("page-disabled"), "page is disabled");
    28   // check that no sites have been rendered
    29   is(0, getContentDocument().querySelectorAll(".site").length, "no sites have been rendered");
    31   NewTabUtils.allPages.enabled = true;
    32   ok(!gridNode.hasAttribute("page-disabled"), "page is not disabled");
    33   ok(!oldGridNode.hasAttribute("page-disabled"), "old page is not disabled");
    34 }

mercurial