dom/apps/tests/unit/test_manifestSanitizer.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 function testEntryPoint(aRoot) {
     5   do_check_true(aRoot.name == "hello world");
     6   do_check_true(aRoot.description == "A bold name");
     7   do_check_true(aRoot.developer.name == "Blink Inc.");
     9   let permissions = aRoot.permissions;
    10   do_check_true(permissions.contacts.description == "Required for autocompletion in the share screen");
    11   do_check_true(permissions.alarms.description == "Required to schedule notifications");
    12 }
    14 function run_test() {
    15   Components.utils.import("resource:///modules/AppsUtils.jsm");
    17   do_check_true(!!AppsUtils);
    19   // Test manifest, with one entry point.
    20   let manifest = {
    21     name: "hello <b>world</b>",
    22     description: "A bold name",
    23     developer: {
    24       name: "<blink>Blink</blink> Inc.",
    25       url: "http://blink.org"
    26     },
    27     permissions : {
    28       "contacts": {
    29         "description": "Required for autocompletion in the <a href='http://shareme.com'>share</a> screen",
    30         "access": "readcreate"
    31         },
    32       "alarms": {
    33         "description": "Required to schedule notifications"
    34       }
    35     },
    37     entry_points: {
    38       "subapp": {
    39         name: "hello <b>world</b>",
    40         description: "A bold name",
    41         developer: {
    42           name: "<blink>Blink</blink> Inc.",
    43           url: "http://blink.org"
    44         },
    45         permissions : {
    46           "contacts": {
    47             "description": "Required for autocompletion in the <a href='http://shareme.com'>share</a> screen",
    48             "access": "readcreate"
    49             },
    50           "alarms": {
    51             "description": "Required to schedule notifications"
    52           }
    53         }
    54       }
    55     }
    56   }
    58   AppsUtils.sanitizeManifest(manifest);
    60   // Check the main section and the subapp entry point.
    61   testEntryPoint(manifest);
    62   testEntryPoint(manifest.entry_points.subapp);
    63 }

mercurial