toolkit/devtools/server/tests/mochitest/test_device.html

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 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 Bug 895360 - [app manager] Device meta data actor
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Mozilla Bug</title>
     9   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
    11 </head>
    12 <body>
    13 <pre id="test">
    14 <script>
    16 window.onload = function() {
    17   var Cu = Components.utils;
    18   var Cc = Components.classes;
    19   var Ci = Components.interfaces;
    21   Cu.import("resource://gre/modules/PermissionsTable.jsm");
    22   Cu.import("resource://gre/modules/devtools/Loader.jsm");
    23   Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
    24   Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
    25   Cu.import("resource://gre/modules/Services.jsm");
    27   SimpleTest.waitForExplicitFinish();
    29   var {getDeviceFront} = devtools.require("devtools/server/actors/device");
    31   DebuggerServer.init(function () { return true; });
    32   DebuggerServer.addBrowserActors();
    34   var client = new DebuggerClient(DebuggerServer.connectPipe());
    35   client.connect(function onConnect() {
    36     client.listTabs(function onListTabs(aResponse) {
    37       var d = getDeviceFront(client, aResponse);
    39       var desc, permissions;
    40       var appInfo = Services.appinfo;
    41       var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
    44       var localDesc = {
    45         appid: appInfo.ID,
    46         vendor: appInfo.vendor,
    47         name: appInfo.name,
    48         version: appInfo.version,
    49         appbuildid: appInfo.appBuildID,
    50         platformbuildid: appInfo.platformBuildID,
    51         platformversion: appInfo.platformVersion,
    52         geckobuildid: appInfo.platformBuildID,
    53         geckoversion: appInfo.platformVersion,
    54         useragent: window.navigator.userAgent,
    55         locale: Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global"),
    56         os: appInfo.OS,
    57         processor: appInfo.XPCOMABI.split("-")[0],
    58         compiler: appInfo.XPCOMABI.split("-")[1],
    59         dpi: utils.displayDPI,
    60         width: window.screen.width,
    61         height: window.screen.height
    62       }
    64       function checkValues() {
    65         for (var key in localDesc) {
    66           is(desc[key], localDesc[key], "valid field (" + key + ")");
    67         }
    69         var currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
    70         var profileDir = currProfD.path;
    71         ok(profileDir.indexOf(desc.profile.length > 0 && desc.profile) != -1, "valid profile name");
    73         var a = JSON.stringify(PermissionsTable);
    74         var b = JSON.stringify(permissions.rawPermissionsTable);
    76         is(a, b, "Permissions Tables is valid");
    78         client.close(() => {
    79           DebuggerServer.destroy();
    80           SimpleTest.finish()
    81         });
    82       }
    85       d.getDescription().then((v) => desc = v)
    86       .then(() => d.getRawPermissionsTable())
    87       .then((json) => permissions = json)
    88       .then(checkValues);
    90     });
    91   });
    93 }
    94 </script>
    95 </pre>
    96 </body>
    97 </html>

mercurial