Backed out changeset 76d24a5414eb (bug 1429721) for devtools failure on browser_net_headers-alignment.js. on a CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2018-01-12 09:49:16 +02:00
Родитель df6947b409
Коммит bb1c0d3310
6 изменённых файлов: 55 добавлений и 71 удалений

Просмотреть файл

@ -329,6 +329,12 @@
width: 8%;
}
/* Domain column */
.requests-list-domain {
width: 13%;
}
/* Start Time column */
.requests-list-start-time {
@ -359,15 +365,7 @@
width: 8%;
}
/* Response header columns */
.requests-list-response-header {
width: 10%;
}
/* Domain column */
.requests-list-domain {
width: 13%;
}

Просмотреть файл

@ -250,7 +250,6 @@ const HEADERS = [
...RESPONSE_HEADERS
.map(header => ({
name: header,
boxName: "response-header",
canFilter: false,
subMenu: "responseHeaders",
noLocalization: true

Просмотреть файл

@ -45,7 +45,8 @@ add_task(function* () {
function* hideColumn(column) {
info(`Clicking context-menu item for ${column}`);
EventUtils.sendMouseEvent({ type: "contextmenu" },
document.querySelector(".devtools-toolbar.requests-list-headers"));
document.querySelector("#requests-list-status-button") ||
document.querySelector("#requests-list-waterfall-button"));
let onHeaderRemoved = waitForDOM(document, `#requests-list-${column}-button`, 0);
parent.document.querySelector(`#request-list-header-${column}-toggle`).click();
@ -58,7 +59,8 @@ add_task(function* () {
function* showColumn(column) {
info(`Clicking context-menu item for ${column}`);
EventUtils.sendMouseEvent({ type: "contextmenu" },
document.querySelector(".devtools-toolbar.requests-list-headers"));
document.querySelector("#requests-list-status-button") ||
document.querySelector("#requests-list-waterfall-button"));
let onHeaderAdded = waitForDOM(document, `#requests-list-${column}-button`, 1);
parent.document.querySelector(`#request-list-header-${column}-toggle`).click();

Просмотреть файл

@ -7,45 +7,35 @@
* Test showing/hiding columns.
*/
add_task(async function () {
let { monitor, tab } = await initNetMonitor(SIMPLE_URL);
add_task(function* () {
let { monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");
let { document, store, parent } = monitor.panelWin;
let wait = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.loadURI(SIMPLE_URL);
await wait;
let requestsContainer = document.querySelector(".requests-list-contents");
ok(requestsContainer, "Container element exists as expected.");
let headers = document.querySelector(".requests-list-headers");
let columns = store.getState().ui.columns;
for (let column in columns) {
if (columns[column]) {
await testVisibleColumnContextMenuItem(column, document, parent);
testColumnsAlignment(headers, requestsContainer);
await testHiddenColumnContextMenuItem(column, document, parent);
yield testVisibleColumnContextMenuItem(column, document, parent);
yield testHiddenColumnContextMenuItem(column, document, parent);
} else {
await testHiddenColumnContextMenuItem(column, document, parent);
testColumnsAlignment(headers, requestsContainer);
await testVisibleColumnContextMenuItem(column, document, parent);
yield testHiddenColumnContextMenuItem(column, document, parent);
yield testVisibleColumnContextMenuItem(column, document, parent);
}
}
columns = store.getState().ui.columns;
for (let column in columns) {
if (columns[column]) {
await testVisibleColumnContextMenuItem(column, document, parent);
yield testVisibleColumnContextMenuItem(column, document, parent);
// Right click on the white-space for the context menu to appear
// and toggle column visibility
await testWhiteSpaceContextMenuItem(column, document, parent);
yield testWhiteSpaceContextMenuItem(column, document, parent);
}
}
});
async function testWhiteSpaceContextMenuItem(column, document, parent) {
function* testWhiteSpaceContextMenuItem(column, document, parent) {
ok(!document.querySelector(`#requests-list-${column}-button`),
`Column ${column} should be hidden`);
@ -53,10 +43,10 @@ async function testWhiteSpaceContextMenuItem(column, document, parent) {
EventUtils.sendMouseEvent({ type: "contextmenu" },
document.querySelector(".devtools-toolbar.requests-list-headers"));
await toggleAndCheckColumnVisibility(column, document, parent);
yield toggleAndCheckColumnVisibility(column, document, parent);
}
async function testVisibleColumnContextMenuItem(column, document, parent) {
function* testVisibleColumnContextMenuItem(column, document, parent) {
ok(document.querySelector(`#requests-list-${column}-button`),
`Column ${column} should be visible`);
@ -76,13 +66,13 @@ async function testVisibleColumnContextMenuItem(column, document, parent) {
let onHeaderRemoved = waitForDOM(document, `#requests-list-${column}-button`, 0);
menuItem.click();
await onHeaderRemoved;
yield onHeaderRemoved;
ok(!document.querySelector(`#requests-list-${column}-button`),
`Column ${column} should be hidden`);
}
async function testHiddenColumnContextMenuItem(column, document, parent) {
function* testHiddenColumnContextMenuItem(column, document, parent) {
ok(!document.querySelector(`#requests-list-${column}-button`),
`Column ${column} should be hidden`);
@ -91,10 +81,10 @@ async function testHiddenColumnContextMenuItem(column, document, parent) {
document.querySelector("#requests-list-status-button") ||
document.querySelector("#requests-list-waterfall-button"));
await toggleAndCheckColumnVisibility(column, document, parent);
yield toggleAndCheckColumnVisibility(column, document, parent);
}
async function toggleAndCheckColumnVisibility(column, document, parent) {
function* toggleAndCheckColumnVisibility(column, document, parent) {
let menuItem = parent.document.querySelector(`#request-list-header-${column}-toggle`);
is(menuItem.getAttribute("type"), "checkbox",
@ -106,7 +96,7 @@ async function toggleAndCheckColumnVisibility(column, document, parent) {
let onHeaderAdded = waitForDOM(document, `#requests-list-${column}-button`, 1);
menuItem.click();
await onHeaderAdded;
yield onHeaderAdded;
ok(document.querySelector(`#requests-list-${column}-button`),
`Column ${column} should be visible`);

Просмотреть файл

@ -7,29 +7,41 @@
* Bug 1360457 - Mis-alignment between headers and columns on overflow
*/
add_task(async function () {
add_task(function* () {
requestLongerTimeout(4);
let { tab, monitor } = await initNetMonitor(INFINITE_GET_URL, true);
let { tab, monitor } = yield initNetMonitor(INFINITE_GET_URL, true);
let { document, windowRequire, store } = monitor.panelWin;
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
store.dispatch(Actions.batchEnable(false));
// Wait until the first request makes the empty notice disappear
await waitForRequestListToAppear();
yield waitForRequestListToAppear();
let requestsContainer = document.querySelector(".requests-list-contents");
ok(requestsContainer, "Container element exists as expected.");
let headers = document.querySelector(".requests-list-headers");
ok(headers, "Headers element exists as expected.");
await waitForRequestsToOverflowContainer();
yield waitForRequestsToOverflowContainer();
testColumnsAlignment(headers, requestsContainer);
// Get first request line, not child 0 as this is the headers
let firstRequestLine = requestsContainer.childNodes[1];
// Find number of columns
let numberOfColumns = headers.childElementCount;
for (let columnNumber = 0; columnNumber < numberOfColumns; columnNumber++) {
let aHeaderColumn = headers.childNodes[columnNumber];
let aRequestColumn = firstRequestLine.childNodes[columnNumber];
is(aHeaderColumn.getBoundingClientRect().left,
aRequestColumn.getBoundingClientRect().left,
"Headers for columns number " + columnNumber + " are aligned."
);
}
// Stop doing requests.
await ContentTask.spawn(tab.linkedBrowser, {}, function* () {
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.stopRequests();
});
@ -40,16 +52,16 @@ add_task(async function () {
info("Waiting until the empty notice disappears and is replaced with the list");
return waitUntil(() => !!document.querySelector(".requests-list-contents"));
}
});
async function waitForRequestsToOverflowContainer(monitor, requestList) {
info("Waiting for enough requests to overflow the container");
while (true) {
info("Waiting for one network request");
await waitForNetworkEvents(monitor, 1);
if (requestList.scrollHeight > requestList.clientHeight) {
info("The list is long enough, returning");
return;
function* waitForRequestsToOverflowContainer() {
info("Waiting for enough requests to overflow the container");
while (true) {
info("Waiting for one network request");
yield waitForNetworkEvents(monitor, 1);
if (requestsContainer.scrollHeight > requestsContainer.clientHeight) {
info("The list is long enough, returning");
return;
}
}
}
}
});

Просмотреть файл

@ -4,8 +4,7 @@
/* import-globals-from ../../framework/test/shared-head.js */
/* exported Toolbox, restartNetMonitor, teardown, waitForExplicitFinish,
verifyRequestItemTarget, waitFor, testFilterButtons, loadCommonFrameScript,
performRequestsInContent, waitForNetworkEvents, selectIndexAndWaitForSourceEditor,
testColumnsAlignment */
performRequestsInContent, waitForNetworkEvents, selectIndexAndWaitForSourceEditor */
"use strict";
@ -690,22 +689,6 @@ function waitForContentMessage(name) {
});
}
function testColumnsAlignment(headers, requestList) {
// Get first request line, not child 0 as this is the headers
let firstRequestLine = requestList.childNodes[1];
// Find number of columns
let numberOfColumns = headers.childElementCount;
for (let i = 0; i < numberOfColumns; i++) {
let headerColumn = headers.childNodes[i];
let requestColumn = firstRequestLine.childNodes[i];
is(headerColumn.getBoundingClientRect().left,
requestColumn.getBoundingClientRect().left,
"Headers for columns number " + i + " are aligned."
);
}
}
/**
* Select a request and switch to its response panel.
*