diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index f090da2a0361..131835f00949 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -246,6 +246,7 @@ skip-if = os == "mac" # Intermittent failures, bug 925225 [browser_clearplugindata.js] [browser_contentAreaClick.js] [browser_contextSearchTabPosition.js] +skip-if = os == "mac" # bug 967013, bug 926729 [browser_ctrlTab.js] [browser_customize_popupNotification.js] [browser_datareporting_notification.js] @@ -305,6 +306,7 @@ skip-if = true # disabled until the tree view is added # it ever is (bug 480169) [browser_save_link-perwindowpb.js] [browser_save_private_link_perwindowpb.js] +skip-if = os == "linux" # bug 857427 [browser_save_video.js] [browser_scope.js] [browser_selectTabAtIndex.js] diff --git a/browser/components/customizableui/content/panelUI.inc.xul b/browser/components/customizableui/content/panelUI.inc.xul index d7b6622896e5..d86fb32f95ce 100644 --- a/browser/components/customizableui/content/panelUI.inc.xul +++ b/browser/components/customizableui/content/panelUI.inc.xul @@ -112,13 +112,13 @@ - + - + diff --git a/browser/devtools/netmonitor/netmonitor-controller.js b/browser/devtools/netmonitor/netmonitor-controller.js index 998c0331b9c9..806469262fc9 100644 --- a/browser/devtools/netmonitor/netmonitor-controller.js +++ b/browser/devtools/netmonitor/netmonitor-controller.js @@ -57,6 +57,9 @@ const EVENTS = { // When the response body is displayed in the UI. RESPONSE_BODY_DISPLAYED: "NetMonitor:ResponseBodyAvailable", + // When the html response preview is displayed in the UI. + RESPONSE_HTML_PREVIEW_DISPLAYED: "NetMonitor:ResponseHtmlPreviewAvailable", + // When `onTabSelect` is fired and subsequently rendered. TAB_UPDATED: "NetMonitor:TabUpdated", @@ -412,8 +415,7 @@ TargetEventsHandler.prototype = { case "will-navigate": { // Reset UI. NetMonitorView.RequestsMenu.reset(); - NetMonitorView.Sidebar.reset(); - NetMonitorView.NetworkDetails.reset(); + NetMonitorView.Sidebar.toggle(false); // Switch to the default network traffic inspector view. if (NetMonitorController.getCurrentActivity() == ACTIVITY_TYPE.NONE) { diff --git a/browser/devtools/netmonitor/netmonitor-view.js b/browser/devtools/netmonitor/netmonitor-view.js index e32ebfbb3a53..9e0c3b047dcb 100644 --- a/browser/devtools/netmonitor/netmonitor-view.js +++ b/browser/devtools/netmonitor/netmonitor-view.js @@ -55,8 +55,7 @@ const GENERIC_VARIABLES_VIEW_SETTINGS = { editableNameTooltip: "", preventDisableOnChange: true, preventDescriptorModifiers: true, - eval: () => {}, - switch: () => {} + eval: () => {} }; const NETWORK_ANALYSIS_PIE_CHART_DIAMETER = 200; // px @@ -1051,6 +1050,9 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, { this.filterContents(); this.refreshSummary(); this.refreshZebra(); + + // Rescale all the waterfalls so that everything is visible at once. + this._flushWaterfallViews(); }, /** @@ -1185,14 +1187,6 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, { timingsNode.insertBefore(timingBox, timingsTotal); } } - - // Don't paint things while the waterfall view isn't even visible. - if (NetMonitorView.currentFrontendMode != "network-inspector-view") { - return; - } - - // Rescale all the waterfalls so that everything is visible at once. - this._flushWaterfallViews(); }, /** @@ -1202,6 +1196,12 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, { * True if this container's width was changed. */ _flushWaterfallViews: function(aReset) { + // Don't paint things while the waterfall view isn't even visible, + // or there are no items added to this container. + if (NetMonitorView.currentFrontendMode != "network-inspector-view" || !this.itemCount) { + return; + } + // To avoid expensive operations like getBoundingClientRect() and // rebuilding the waterfall background each time a new request comes in, // stuff is cached. However, in certain scenarios like when the window @@ -1429,11 +1429,6 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, { * The resize listener for this container's window. */ _onResize: function(e) { - // Don't paint things while the waterfall view isn't even visible. - if (NetMonitorView.currentFrontendMode != "network-inspector-view") { - return; - } - // Allow requests to settle down first. setNamedTimeout( "resize-events", RESIZE_REFRESH_RATE, () => this._flushWaterfallViews(true)); @@ -1634,13 +1629,6 @@ SidebarView.prototype = { $("#details-pane").selectedIndex = isCustom ? 0 : 1 window.emit(EVENTS.SIDEBAR_POPULATED); }); - }, - - /** - * Hides this container. - */ - reset: function() { - this.toggle(false); } } @@ -1837,13 +1825,6 @@ NetworkDetailsView.prototype = { dumpn("Destroying the NetworkDetailsView"); }, - /** - * Resets this container (removes all the networking information). - */ - reset: function() { - this._dataSrc = null; - }, - /** * Populates this view with the specified data. * @@ -1861,6 +1842,18 @@ NetworkDetailsView.prototype = { $("#response-content-textarea-box").hidden = true; $("#response-content-image-box").hidden = true; + let isHtml = RequestsMenuView.prototype.isHtml({ attachment: aData }); + + // Show the "Preview" tabpanel only for plain HTML responses. + $("#preview-tab").hidden = !isHtml; + $("#preview-tabpanel").hidden = !isHtml; + + // Switch to the "Headers" tabpanel if the "Preview" previously selected + // and this is not an HTML response. + if (!isHtml && this.widget.selectedIndex == 5) { + this.widget.selectedIndex = 0; + } + this._headers.empty(); this._cookies.empty(); this._params.empty(); @@ -1907,6 +1900,9 @@ NetworkDetailsView.prototype = { case 4: // "Timings" yield view._setTimingsInformation(src.eventTimings); break; + case 5: // "Preview" + yield view._setHtmlPreview(src.responseContent); + break; } populated[tab] = true; window.emit(EVENTS.TAB_UPDATED); @@ -2104,32 +2100,45 @@ NetworkDetailsView.prototype = { if (!aHeadersResponse || !aPostDataResponse) { return promise.resolve(); } - return gNetwork.getString(aPostDataResponse.postData.text).then(aString => { - // Handle query strings (poor man's forms, e.g. "?foo=bar&baz=42"). - let cType = aHeadersResponse.headers.filter(({ name }) => name == "Content-Type")[0]; - let cString = cType ? cType.value : ""; - if (cString.contains("x-www-form-urlencoded") || - aString.contains("x-www-form-urlencoded")) { - let formDataGroups = aString.split(/\r\n|\n|\r/); - for (let group of formDataGroups) { - this._addParams(this._paramsFormData, group); - } - } - // Handle actual forms ("multipart/form-data" content type). - else { - // This is really awkward, but hey, it works. Let's show an empty - // scope in the params view and place the source editor containing - // the raw post data directly underneath. - $("#request-params-box").removeAttribute("flex"); - let paramsScope = this._params.addScope(this._paramsPostPayload); - paramsScope.expanded = true; - paramsScope.locked = true; + return gNetwork.getString(aPostDataResponse.postData.text).then(aPostData => { + let contentTypeHeader = aHeadersResponse.headers.filter(({ name }) => name == "Content-Type")[0]; + let contentTypeLongString = contentTypeHeader ? contentTypeHeader.value : ""; - $("#request-post-data-textarea-box").hidden = false; - return NetMonitorView.editor("#request-post-data-textarea").then(aEditor => { - aEditor.setText(aString); - }); - } + return gNetwork.getString(contentTypeLongString).then(aContentType => { + let urlencoded = "x-www-form-urlencoded"; + + // Handle query strings (poor man's forms, e.g. "?foo=bar&baz=42"). + if (aContentType.contains(urlencoded)) { + let formDataGroups = aPostData.split(/\r\n|\r|\n/); + for (let group of formDataGroups) { + this._addParams(this._paramsFormData, group); + } + } + // Handle actual forms ("multipart/form-data" content type). + else { + // This is really awkward, but hey, it works. Let's show an empty + // scope in the params view and place the source editor containing + // the raw post data directly underneath. + $("#request-params-box").removeAttribute("flex"); + let paramsScope = this._params.addScope(this._paramsPostPayload); + paramsScope.expanded = true; + paramsScope.locked = true; + + $("#request-post-data-textarea-box").hidden = false; + return NetMonitorView.editor("#request-post-data-textarea").then(aEditor => { + // Most POST bodies are usually JSON, so they can be neatly + // syntax highlighted as JS. Otheriwse, fall back to plain text. + try { + JSON.parse(aPostData); + aEditor.setMode(Editor.modes.js); + } catch (e) { + aEditor.setMode(Editor.modes.text); + } finally { + aEditor.setText(aPostData); + } + }); + } + }); }).then(() => window.emit(EVENTS.REQUEST_POST_PARAMS_DISPLAYED)); }, @@ -2150,8 +2159,8 @@ NetworkDetailsView.prototype = { paramsScope.expanded = true; for (let param of paramsArray) { - let headerVar = paramsScope.addItem(param.name, {}, true); - headerVar.setGrip(param.value); + let paramVar = paramsScope.addItem(param.name, {}, true); + paramVar.setGrip(param.value); } }, @@ -2345,6 +2354,30 @@ NetworkDetailsView.prototype = { .style.transform = "translateX(" + (scale * (blocked + dns + connect + send + wait)) + "px)"; }, + /** + * Sets the preview for HTML responses shown in this view. + * + * @param object aResponse + * The message received from the server. + * @return object + * A promise that is resolved when the response body is set + */ + _setHtmlPreview: function(aResponse) { + if (!aResponse) { + return promise.resolve(); + } + let { text } = aResponse.content; + let iframe = $("#response-preview"); + + return gNetwork.getString(text).then(aString => { + // Always disable JS when previewing HTML responses. + iframe.contentDocument.docShell.allowJavascript = false; + iframe.contentDocument.documentElement.innerHTML = aString; + + window.emit(EVENTS.RESPONSE_HTML_PREVIEW_DISPLAYED); + }); + }, + _dataSrc: null, _headers: null, _cookies: null, @@ -2570,14 +2603,16 @@ nsIURL.store = new Map(); */ function parseQueryString(aQueryString) { // Make sure there's at least one param available. - if (!aQueryString || !aQueryString.contains("=")) { + // Be careful here, params don't necessarily need to have values, so + // no need to verify the existence of a "=". + if (!aQueryString) { return; } // Turn the params string into an array containing { name: value } tuples. let paramsArray = aQueryString.replace(/^[?&]/, "").split("&").map(e => let (param = e.split("=")) { - name: NetworkHelper.convertToUnicode(unescape(param[0])), - value: NetworkHelper.convertToUnicode(unescape(param[1])) + name: param[0] ? NetworkHelper.convertToUnicode(unescape(param[0])) : "", + value: param[1] ? NetworkHelper.convertToUnicode(unescape(param[1])) : "" }); return paramsArray; } diff --git a/browser/devtools/netmonitor/netmonitor.xul b/browser/devtools/netmonitor/netmonitor.xul index 0c4feead7309..6303997d64bf 100644 --- a/browser/devtools/netmonitor/netmonitor.xul +++ b/browser/devtools/netmonitor/netmonitor.xul @@ -13,7 +13,8 @@ %netmonitorDTD; ]> - + + + + diff --git a/browser/devtools/netmonitor/test/html_post-raw-test-page.html b/browser/devtools/netmonitor/test/html_post-raw-test-page.html index f8dc65783960..cee76e0a8371 100644 --- a/browser/devtools/netmonitor/test/html_post-raw-test-page.html +++ b/browser/devtools/netmonitor/test/html_post-raw-test-page.html @@ -15,6 +15,7 @@ function post(aAddress, aMessage, aCallback) { var xhr = new XMLHttpRequest(); xhr.open("POST", aAddress, true); + xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if (this.readyState == this.DONE) { @@ -25,7 +26,7 @@ } function performRequests() { - var rawData = "Content-Type: application/x-www-form-urlencoded\r\n\r\nfoo=bar&baz=123"; + var rawData = "foo=bar&baz=123"; post("sjs_simple-test-server.sjs", rawData, function() { // Done. }); diff --git a/browser/devtools/sourceeditor/editor.js b/browser/devtools/sourceeditor/editor.js index 40fc18e1b2fa..30b08aeb849d 100644 --- a/browser/devtools/sourceeditor/editor.js +++ b/browser/devtools/sourceeditor/editor.js @@ -153,8 +153,8 @@ function Editor(config) { // Additional shortcuts. this.config.extraKeys[Editor.keyFor("jumpToLine")] = () => this.jumpToLine(); - this.config.extraKeys[Editor.keyFor("moveLineUp")] = () => this.moveLineUp(); - this.config.extraKeys[Editor.keyFor("moveLineDown")] = () => this.moveLineDown(); + this.config.extraKeys[Editor.keyFor("moveLineUp", { noaccel: true })] = () => this.moveLineUp(); + this.config.extraKeys[Editor.keyFor("moveLineDown", { noaccel: true })] = () => this.moveLineDown(); this.config.extraKeys[Editor.keyFor("toggleComment")] = "toggleComment"; // Disable ctrl-[ and ctrl-] because toolbox uses those shortcuts. @@ -844,12 +844,13 @@ Editor.accel = function (key, modifiers={}) { /** * Returns a string representation of a shortcut for a - * specified command 'cmd'. Cmd- for macs, Ctrl- for other - * platforms. Useful when overwriting or disabling default - * shortcuts. + * specified command 'cmd'. Append Cmd- for macs, Ctrl- for other + * platforms unless noaccel is specified in the options. Useful when overwriting + * or disabling default shortcuts. */ -Editor.keyFor = function (cmd) { - return Editor.accel(L10N.GetStringFromName(cmd + ".commandkey")); +Editor.keyFor = function (cmd, opts={ noaccel: false }) { + let key = L10N.GetStringFromName(cmd + ".commandkey"); + return opts.noaccel ? key : Editor.accel(key); }; // Since Gecko already provide complete and up to date list of CSS property diff --git a/browser/devtools/styleeditor/test/browser.ini b/browser/devtools/styleeditor/test/browser.ini index 248028c5d2c2..94c769415b78 100644 --- a/browser/devtools/styleeditor/test/browser.ini +++ b/browser/devtools/styleeditor/test/browser.ini @@ -31,6 +31,7 @@ support-files = [browser_styleeditor_autocomplete.js] [browser_styleeditor_bug_740541_iframes.js] +skip-if = os == "linux" || "mac" # bug 949355 [browser_styleeditor_bug_851132_middle_click.js] [browser_styleeditor_bug_870339.js] [browser_styleeditor_cmd_edit.js] diff --git a/browser/locales/en-US/chrome/browser/devtools/netmonitor.dtd b/browser/locales/en-US/chrome/browser/devtools/netmonitor.dtd index b213448292d4..79aa7149cb28 100644 --- a/browser/locales/en-US/chrome/browser/devtools/netmonitor.dtd +++ b/browser/locales/en-US/chrome/browser/devtools/netmonitor.dtd @@ -68,6 +68,10 @@ - in the network details pane identifying the timings tab. --> + + + diff --git a/browser/locales/en-US/chrome/browser/devtools/sourceeditor.properties b/browser/locales/en-US/chrome/browser/devtools/sourceeditor.properties index aa223a3effc4..170b9ba271b9 100644 --- a/browser/locales/en-US/chrome/browser/devtools/sourceeditor.properties +++ b/browser/locales/en-US/chrome/browser/devtools/sourceeditor.properties @@ -49,17 +49,17 @@ annotation.currentLine=Current line # user-defined lines. annotation.debugLocation.title=Current step: %S -# LOCALIZATION NOTE (jumpToLine.commandkey): This the key to use in +# LOCALIZATION NOTE (jumpToLine.commandkey): This is the key to use in # conjunction with accel (Command on Mac or Ctrl on other platforms) to jump to # a specific line in the editor. jumpToLine.commandkey=J -# LOCALIZATION NOTE (toggleComment.commandkey): This the key to use in +# LOCALIZATION NOTE (toggleComment.commandkey): This is the key to use in # conjunction with accel (Command on Mac or Ctrl on other platforms) to either # comment or uncomment selected lines in the editor. toggleComment.commandkey=/ -# LOCALIZATION NOTE (toolboxPrevTool.commandkey): This the key to use in +# LOCALIZATION NOTE (indentLess.commandkey): This is the key to use in # conjunction with accel (Command on Mac or Ctrl on other platforms) to reduce # indentation level in CodeMirror. However, its default value also used by # the Toolbox to switch between tools so we disable it. @@ -67,7 +67,7 @@ toggleComment.commandkey=/ # DO NOT translate this key without proper synchronization with toolbox.dtd. indentLess.commandkey=[ -# LOCALIZATION NOTE (toolboxPrevTool.commandkey): This the key to use in +# LOCALIZATION NOTE (indentMore.commandkey): This is the key to use in # conjunction with accel (Command on Mac or Ctrl on other platforms) to increase # indentation level in CodeMirror. However, its default value also used by # the Toolbox to switch between tools @@ -75,12 +75,10 @@ indentLess.commandkey=[ # DO NOT translate this key without proper synchronization with toolbox.dtd. indentMore.commandkey=] -# LOCALIZATION NOTE (moveLineUp.commandkey): This the key to use in -# conjunction with accel (Command on Mac or Ctrl on other platforms) to move +# LOCALIZATION NOTE (moveLineUp.commandkey): This is the key to use to move # the selected lines up. moveLineUp.commandkey=Alt-Up -# LOCALIZATION NOTE (moveLineDown.commandkey): This the key to use in -# conjunction with accel (Command on Mac or Ctrl on other platforms) to move +# LOCALIZATION NOTE (moveLineDown.commandkey): This is the key to use to move # the selected lines down. moveLineDown.commandkey=Alt-Down diff --git a/browser/metro/base/content/bindings/console.xml b/browser/metro/base/content/bindings/console.xml index 627da33a1ed0..33ddf91e85b7 100644 --- a/browser/metro/base/content/bindings/console.xml +++ b/browser/metro/base/content/bindings/console.xml @@ -3,7 +3,6 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - %browserDTD; @@ -13,7 +12,6 @@ xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - @@ -22,7 +20,6 @@ - @@ -32,20 +29,13 @@ - - - - - - - @@ -57,5 +47,4 @@ - diff --git a/browser/metro/base/content/browser.xul b/browser/metro/base/content/browser.xul index 14685f995966..a6dacf27e9c9 100644 --- a/browser/metro/base/content/browser.xul +++ b/browser/metro/base/content/browser.xul @@ -588,7 +588,9 @@ Desktop browser's sync prefs. - + + +