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.

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

mercurial