dom/mobileconnection/tests/marionette/mobile_header.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 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 SpecialPowers.addPermission("mobileconnection", true, document);
     6 // In single sim scenario, there is only one mobileConnection, we can always use
     7 // the first instance.
     8 let mobileConnection = window.navigator.mozMobileConnections[0];
     9 ok(mobileConnection instanceof MozMobileConnection,
    10    "mobileConnection is instanceof " + mobileConnection.constructor);
    12 let _pendingEmulatorCmdCount = 0;
    14 /* Remove permission and execute finish() */
    15 let cleanUp = function() {
    16   waitFor(function() {
    17     SpecialPowers.removePermission("mobileconnection", document);
    18     finish();
    19   }, function() {
    20     return _pendingEmulatorCmdCount === 0;
    21   });
    22 };
    24 /* Helper for tasks */
    25 let taskHelper = {
    26   tasks: [],
    28   push: function(task) {
    29     this.tasks.push(task);
    30   },
    32   runNext: function() {
    33     let task = this.tasks.shift();
    34     if (!task) {
    35       cleanUp();
    36       return;
    37     }
    39     if (typeof task === "function") {
    40       task();
    41     }
    42   },
    43 };
    45 /* Helper for emulator console command */
    46 let emulatorHelper = {
    47   sendCommand: function(cmd, callback) {
    48     _pendingEmulatorCmdCount++;
    49     runEmulatorCmd(cmd, function(results) {
    50       _pendingEmulatorCmdCount--;
    52       let result = results[results.length - 1];
    53       is(result, "OK", "'"+ cmd +"' returns '" + result + "'");
    55       if (callback && typeof callback === "function") {
    56         callback(results);
    57       }
    58     });
    59   },
    60 };

mercurial