Bug 930643 - Sorting by column is broken in the Network Monitor, r=jryans

This commit is contained in:
Victor Porof 2013-10-25 10:15:53 +03:00
parent 48a867ad79
commit 8a430f311b
5 changed files with 12 additions and 4 deletions

View File

@ -2044,6 +2044,7 @@ NetworkDetailsView.prototype = {
* DOM query helper.
*/
function $(aSelector, aTarget = document) aTarget.querySelector(aSelector);
function $all(aSelector, aTarget = document) aTarget.querySelectorAll(aSelector);
/**
* Helper for getting an nsIURL instance out of a string.

View File

@ -9,7 +9,7 @@ function test() {
initNetMonitor(STATUS_CODES_URL).then(([aTab, aDebuggee, aMonitor]) => {
info("Starting test... ");
let { L10N, NetMonitorView } = aMonitor.panelWin;
let { $all, L10N, NetMonitorView } = aMonitor.panelWin;
let { RequestsMenu } = NetMonitorView;
RequestsMenu.lazyUpdate = false;
@ -182,6 +182,8 @@ function test() {
"There should be a total of 5 items in the requests menu.");
is(RequestsMenu.visibleItems.length, 5,
"There should be a total of 5 visbile items in the requests menu.");
is($all(".side-menu-widget-item").length, 5,
"The visible items in the requests menu are, in fact, visible!");
is(RequestsMenu.getItemAtIndex(0), RequestsMenu.items[0],
"The requests menu items aren't ordered correctly. First item is misplaced.");

View File

@ -13,7 +13,7 @@ function test() {
// of the heavy dom manipulation associated with sorting.
requestLongerTimeout(2);
let { $, L10N, NetMonitorView } = aMonitor.panelWin;
let { $, $all, L10N, NetMonitorView } = aMonitor.panelWin;
let { RequestsMenu } = NetMonitorView;
RequestsMenu.lazyUpdate = false;
@ -178,6 +178,8 @@ function test() {
"There should be a total of 5 items in the requests menu.");
is(RequestsMenu.visibleItems.length, 5,
"There should be a total of 5 visbile items in the requests menu.");
is($all(".side-menu-widget-item").length, 5,
"The visible items in the requests menu are, in fact, visible!");
is(RequestsMenu.getItemAtIndex(0), RequestsMenu.items[0],
"The requests menu items aren't ordered correctly. First item is misplaced.");

View File

@ -13,7 +13,7 @@ function test() {
// of the heavy dom manipulation associated with sorting.
requestLongerTimeout(2);
let { $, L10N, NetMonitorView } = aMonitor.panelWin;
let { $, $all, L10N, NetMonitorView } = aMonitor.panelWin;
let { RequestsMenu } = NetMonitorView;
RequestsMenu.lazyUpdate = false;
@ -114,6 +114,8 @@ function test() {
"There should be a specific number of items in the requests menu.");
is(RequestsMenu.visibleItems.length, aOrder.length,
"There should be a specific number of visbile items in the requests menu.");
is($all(".side-menu-widget-item").length, aOrder.length,
"The visible items in the requests menu are, in fact, visible!");
for (let i = 0; i < aOrder.length; i++) {
is(RequestsMenu.getItemAtIndex(i), RequestsMenu.items[i],

View File

@ -166,7 +166,8 @@ SideMenuWidget.prototype = {
* The element associated with the displayed item.
*/
removeChild: function(aChild) {
if (aChild.classList.contains("side-menu-widget-item-contents")) {
if (aChild.classList.contains("side-menu-widget-item-contents") &&
!aChild.classList.contains("side-menu-widget-item")) {
// Remove the item itself, not the contents.
aChild.parentNode.remove();
} else {