toolkit/devtools/sourcemap/tests/unit/test_base64.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 /*
     2  * WARNING!
     3  *
     4  * Do not edit this file directly, it is built from the sources at
     5  * https://github.com/mozilla/source-map/
     6  */
     8 Components.utils.import('resource://test/Utils.jsm');
     9 /* -*- Mode: js; js-indent-level: 2; -*- */
    10 /*
    11  * Copyright 2011 Mozilla Foundation and contributors
    12  * Licensed under the New BSD license. See LICENSE or:
    13  * http://opensource.org/licenses/BSD-3-Clause
    14  */
    15 define("test/source-map/test-base64", ["require", "exports", "module"], function (require, exports, module) {
    17   var base64 = require('source-map/base64');
    19   exports['test out of range encoding'] = function (assert, util) {
    20     assert.throws(function () {
    21       base64.encode(-1);
    22     });
    23     assert.throws(function () {
    24       base64.encode(64);
    25     });
    26   };
    28   exports['test out of range decoding'] = function (assert, util) {
    29     assert.throws(function () {
    30       base64.decode('=');
    31     });
    32   };
    34   exports['test normal encoding and decoding'] = function (assert, util) {
    35     for (var i = 0; i < 64; i++) {
    36       assert.equal(base64.decode(base64.encode(i)), i);
    37     }
    38   };
    40 });
    41 function run_test() {
    42   runSourceMapTests('test/source-map/test-base64', do_throw);
    43 }

mercurial