diff options
Diffstat (limited to 'devtools/shared')
-rw-r--r-- | devtools/shared/gcli/commands/cmd.js | 4 | ||||
-rw-r--r-- | devtools/shared/gcli/commands/cookie.js | 22 | ||||
-rw-r--r-- | devtools/shared/gcli/commands/screenshot.js | 6 | ||||
-rw-r--r-- | devtools/shared/gcli/source/lib/gcli/commands/help.js | 4 | ||||
-rw-r--r-- | devtools/shared/inspector/css-logic.js | 12 | ||||
-rw-r--r-- | devtools/shared/locales/en-US/gcli.properties | 9 | ||||
-rw-r--r-- | devtools/shared/specs/stylesheets.js | 8 | ||||
-rw-r--r-- | devtools/shared/webconsole/network-helper.js | 27 | ||||
-rw-r--r-- | devtools/shared/webconsole/network-monitor.js | 55 |
9 files changed, 125 insertions, 22 deletions
diff --git a/devtools/shared/gcli/commands/cmd.js b/devtools/shared/gcli/commands/cmd.js index 1777ed960..1b3cb2ecb 100644 --- a/devtools/shared/gcli/commands/cmd.js +++ b/devtools/shared/gcli/commands/cmd.js @@ -137,8 +137,6 @@ exports.items = [ return !prefBranch.prefHasUserValue(PREF_DIR); }, exec: function(args, context) { - gcli.load(); - let dirName = prefBranch.getComplexValue(PREF_DIR, Ci.nsISupportsString).data.trim(); return l10n.lookupFormat("cmdStatus3", [ dirName ]); @@ -170,8 +168,6 @@ exports.items = [ supportsString.data = args.directory; prefBranch.setComplexValue(PREF_DIR, Ci.nsISupportsString, supportsString); - gcli.load(); - return l10n.lookupFormat("cmdStatus3", [ args.directory ]); } } diff --git a/devtools/shared/gcli/commands/cookie.js b/devtools/shared/gcli/commands/cookie.js index f1680042f..203ac738c 100644 --- a/devtools/shared/gcli/commands/cookie.js +++ b/devtools/shared/gcli/commands/cookie.js @@ -100,7 +100,7 @@ exports.items = [ let cookies = []; while (enm.hasMoreElements()) { - let cookie = enm.getNext().QueryInterface(Ci.nsICookie); + let cookie = enm.getNext().QueryInterface(Ci.nsICookie2); if (isCookieAtHost(cookie, host)) { cookies.push({ host: cookie.host, @@ -108,9 +108,10 @@ exports.items = [ value: cookie.value, path: cookie.path, expires: cookie.expires, - secure: cookie.secure, - httpOnly: cookie.httpOnly, - sameDomain: cookie.sameDomain + isDomain: cookie.isDomain, + isHttpOnly: cookie.isHttpOnly, + isSecure: cookie.isSecure, + isSession: cookie.isSession, }); } } @@ -169,11 +170,14 @@ exports.items = [ for (let cookie of cookies) { cookie.expires = translateExpires(cookie.expires); - let noAttrs = !cookie.secure && !cookie.httpOnly && !cookie.sameDomain; - cookie.attrs = (cookie.secure ? "secure" : " ") + - (cookie.httpOnly ? "httpOnly" : " ") + - (cookie.sameDomain ? "sameDomain" : " ") + - (noAttrs ? l10n.lookup("cookieListOutNone") : " "); + let noAttrs = !cookie.isDomain && !cookie.isHttpOnly && + !cookie.isSecure && !cookie.isSession; + cookie.attrs = ((cookie.isDomain ? "isDomain " : "") + + (cookie.isHttpOnly ? "isHttpOnly " : "") + + (cookie.isSecure ? "isSecure " : "") + + (cookie.isSession ? "isSession " : "") + + (noAttrs ? l10n.lookup("cookieListOutNone") : "")) + .trim(); } return context.createView({ diff --git a/devtools/shared/gcli/commands/screenshot.js b/devtools/shared/gcli/commands/screenshot.js index e2f38b6d9..11bafcab9 100644 --- a/devtools/shared/gcli/commands/screenshot.js +++ b/devtools/shared/gcli/commands/screenshot.js @@ -277,6 +277,12 @@ function createScreenshotData(document, args) { window.scrollTo(0,0); width = window.innerWidth + window.scrollMaxX - window.scrollMinX; height = window.innerHeight + window.scrollMaxY - window.scrollMinY; + let writingMode = "horizontal-tb"; + if (window.getComputedStyle(document.documentElement)) { + writingMode = window.getComputedStyle(document.documentElement).writingMode; + } + let orientation = writingMode.substring(0, writingMode.indexOf("-")).toLowerCase(); + left = ((orientation != "vertical") ? left : (-width + window.innerWidth)); filename = filename.replace(".png", "-fullpage.png"); } else if (args.selector) { diff --git a/devtools/shared/gcli/source/lib/gcli/commands/help.js b/devtools/shared/gcli/source/lib/gcli/commands/help.js index 7d1cc9087..365c53380 100644 --- a/devtools/shared/gcli/source/lib/gcli/commands/help.js +++ b/devtools/shared/gcli/source/lib/gcli/commands/help.js @@ -275,7 +275,7 @@ exports.items = [ ' <div if="${command.isParent}">\n' + ' <p class="gcli-help-header">${l10n.subCommands}:</p>\n' + ' <ul class="gcli-help-${subcommands}">\n' + - ' <li if="${subcommands.length === 0}">${l10n.subcommandsNone}</li>\n' + + ' <li if="${subcommands.length === 0}">${l10n.subCommandsNone}</li>\n' + ' <li foreach="subcommand in ${subcommands}">\n' + ' ${subcommand.name}: ${subcommand.description}\n' + ' <span class="gcli-out-shortcut" data-command="help ${subcommand.name}"\n' + @@ -321,7 +321,7 @@ exports.items = [ '\n' + '<span if="${command.isParent}"># ${l10n.subCommands}:</span>\n' + '\n' + - '<span if="${subcommands.length === 0}">${l10n.subcommandsNone}</span>\n' + + '<span if="${subcommands.length === 0}">${l10n.subCommandsNone}</span>\n' + '<loop foreach="subcommand in ${subcommands}">* ${subcommand.name}: ${subcommand.description}\n' + '</loop>\n' + '</div>\n', diff --git a/devtools/shared/inspector/css-logic.js b/devtools/shared/inspector/css-logic.js index c8cdd2fdb..901b7a189 100644 --- a/devtools/shared/inspector/css-logic.js +++ b/devtools/shared/inspector/css-logic.js @@ -30,6 +30,8 @@ "use strict"; +const MAX_DATA_URL_LENGTH = 40; + /** * Provide access to the style information in a page. * CssLogic uses the standard DOM API, and the Gecko inIDOMUtils API to access @@ -103,6 +105,13 @@ exports.shortSource = function (sheet) { return exports.l10n("rule.sourceInline"); } + // If the sheet is a data URL, return a trimmed version of it. + let dataUrl = sheet.href.trim().match(/^data:.*?,((?:.|\r|\n)*)$/); + if (dataUrl) { + return dataUrl[1].length > MAX_DATA_URL_LENGTH ? + `${dataUrl[1].substr(0, MAX_DATA_URL_LENGTH - 1)}…` : dataUrl[1]; + } + // We try, in turn, the filename, filePath, query string, whole thing let url = {}; try { @@ -123,8 +132,7 @@ exports.shortSource = function (sheet) { return url.query; } - let dataUrl = sheet.href.match(/^(data:[^,]*),/); - return dataUrl ? dataUrl[1] : sheet.href; + return sheet.href; }; const TAB_CHARS = "\t"; diff --git a/devtools/shared/locales/en-US/gcli.properties b/devtools/shared/locales/en-US/gcli.properties index e5231e44a..59c344832 100644 --- a/devtools/shared/locales/en-US/gcli.properties +++ b/devtools/shared/locales/en-US/gcli.properties @@ -141,9 +141,10 @@ helpManual=Provide help either on a specific command (if a search string is prov helpSearchDesc=Search string helpSearchManual3=search string to use in narrowing down the displayed commands. Regular expressions not supported. -# LOCALIZATION NOTE: These strings are displayed in the help page for a -# command in the console. +# LOCALIZATION NOTE (helpManSynopsis, helpManDescription): These strings are +# displayed in the help page for a command in the console. helpManSynopsis=Synopsis +helpManDescription=Description # LOCALIZATION NOTE: This message is displayed in the help page if the command # has no parameters. @@ -177,6 +178,10 @@ helpIntro=GCLI is an experiment to create a highly usable command line for web d # sub-commands. subCommands=Sub-Commands +# LOCALIZATION NOTE: Text shown as part of the output of the 'help' command +# when the command in question should have sub-commands but in fact has none. +subCommandsNone=None + # LOCALIZATION NOTE: This error message is displayed when the command line is # cannot find a match for the parse types. commandParseError=Command line parsing error diff --git a/devtools/shared/specs/stylesheets.js b/devtools/shared/specs/stylesheets.js index c89a7c088..fc75281f8 100644 --- a/devtools/shared/specs/stylesheets.js +++ b/devtools/shared/specs/stylesheets.js @@ -105,6 +105,14 @@ exports.styleSheetSpec = styleSheetSpec; const styleSheetsSpec = generateActorSpec({ typeName: "stylesheets", + events: { + "stylesheet-added": { + type: "stylesheetAdded", + sheet: Arg(0, "stylesheet"), + isNew: Arg(1, "boolean") + }, + }, + methods: { getStyleSheets: { request: {}, diff --git a/devtools/shared/webconsole/network-helper.js b/devtools/shared/webconsole/network-helper.js index af6a2e55b..4e25fac26 100644 --- a/devtools/shared/webconsole/network-helper.js +++ b/devtools/shared/webconsole/network-helper.js @@ -63,6 +63,8 @@ const {components, Cc, Ci} = require("chrome"); loader.lazyImporter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); const DevToolsUtils = require("devtools/shared/DevToolsUtils"); const Services = require("Services"); +const { LocalizationHelper } = require("devtools/shared/l10n"); +const L10N = new LocalizationHelper("devtools/client/locales/netmonitor.properties"); // The cache used in the `nsIURL` function. const gNSURLStore = new Map(); @@ -620,6 +622,31 @@ var NetworkHelper = { // Cipher suite. info.cipherSuite = SSLStatus.cipherName; + // Key exchange group name. + info.keaGroupName = SSLStatus.keaGroupName; + // Localise two special values. + if (info.keaGroupName == "none") { + info.keaGroupName = L10N.getStr("netmonitor.security.keaGroup.none"); + } + if (info.keaGroupName == "custom") { + info.keaGroupName = L10N.getStr("netmonitor.security.keaGroup.custom"); + } + if (info.keaGroupName == "unknown group") { + info.keaGroupName = L10N.getStr("netmonitor.security.keaGroup.unknown"); + } + + // Certificate signature scheme. + info.signatureSchemeName = SSLStatus.signatureSchemeName; + // Localise two special values. + if (info.signatureSchemeName == "none") { + info.signatureSchemeName = + L10N.getStr("netmonitor.security.signatureScheme.none"); + } + if (info.signatureSchemeName == "unknown signature") { + info.signatureSchemeName = + L10N.getStr("netmonitor.security.signatureScheme.unknown"); + } + // Protocol version. info.protocolVersion = this.formatSecurityProtocol(SSLStatus.protocolVersion); diff --git a/devtools/shared/webconsole/network-monitor.js b/devtools/shared/webconsole/network-monitor.js index 084493432..a55162f52 100644 --- a/devtools/shared/webconsole/network-monitor.js +++ b/devtools/shared/webconsole/network-monitor.js @@ -732,7 +732,9 @@ NetworkMonitor.prototype = { 0x804b0004: "STATUS_CONNECTED_TO", 0x804b0005: "STATUS_SENDING_TO", 0x804b000a: "STATUS_WAITING_FOR", - 0x804b0006: "STATUS_RECEIVING_FROM" + 0x804b0006: "STATUS_RECEIVING_FROM", + 0x804b000c: "STATUS_TLS_STARTING", + 0x804b000d: "STATUS_TLS_ENDING" }, httpDownloadActivities: [ @@ -1327,8 +1329,24 @@ NetworkMonitor.prototype = { let response = {}; response.httpVersion = statusLineArray.shift(); - response.remoteAddress = httpActivity.channel.remoteAddress; - response.remotePort = httpActivity.channel.remotePort; + // XXX: + // Sometimes, when using a proxy server (manual proxy configuration), + // throws an error: + // 0x80040111 (NS_ERROR_NOT_AVAILABLE) + // [nsIHttpChannelInternal.remoteAddress] + // Bug 1337791 is the suspect. + response.remoteAddress = null; + try { + response.remoteAddress = httpActivity.channel.remoteAddress; + } catch (e) { + Cu.reportError(e); + } + response.remotePort = null; + try { + response.remotePort = httpActivity.channel.remotePort; + } catch (e) { + Cu.reportError(e); + } response.status = statusLineArray.shift(); response.statusText = statusLineArray.join(" "); response.headersSize = extraStringData.length; @@ -1390,6 +1408,7 @@ NetworkMonitor.prototype = { timings: { blocked: 0, dns: 0, + ssl: 0, connect: 0, send: 0, wait: 0, @@ -1424,6 +1443,36 @@ NetworkMonitor.prototype = { harTimings.connect = -1; } + if (timings.STATUS_TLS_STARTING && timings.STATUS_TLS_ENDING) { + harTimings.ssl = timings.STATUS_TLS_ENDING.last - + timings.STATUS_TLS_STARTING.first; + } else { + harTimings.ssl = -1; + } + + // sometimes the connection information events are attached to a speculative + // channel instead of this one, but necko might glue them back together in the + // nsITimedChannel interface used by Resource and Navigation Timing + let timedChannel = httpActivity.channel.QueryInterface(Ci.nsITimedChannel); + + if ((harTimings.connect <= 0) && timedChannel) { + if (timedChannel.secureConnectionStartTime > timedChannel.connectStartTime) { + harTimings.connect = + timedChannel.secureConnectionStartTime - timedChannel.connectStartTime; + harTimings.ssl = + timedChannel.connectEndTime - timedChannel.secureConnectionStartTime; + } else { + harTimings.connect = + timedChannel.connectEndTime - timedChannel.connectStartTime; + harTimings.ssl = -1; + } + } + + if ((harTimings.dns <= 0) && timedChannel) { + harTimings.dns = + timedChannel.domainLookupEndTime - timedChannel.domainLookupStartTime; + } + if (timings.STATUS_SENDING_TO) { harTimings.send = timings.STATUS_SENDING_TO.last - timings.STATUS_SENDING_TO.first; } else if (timings.REQUEST_HEADER && timings.REQUEST_BODY_SENT) { |