Backed out 2 changesets (bug 1171903) for browser_storage_overflow.js test failures

Backed out changeset eb7ef800ed12 (bug 1171903)
Backed out changeset 78a423ab972e (bug 1171903)
This commit is contained in:
Carsten "Tomcat" Book 2015-09-08 11:32:08 +02:00
parent 5940db9926
commit 4115fa05a0
5 changed files with 10 additions and 129 deletions

View File

@ -4,17 +4,12 @@
"use strict";
const {Cc, Ci, Cu} = require("chrome");
const EventEmitter = require("devtools/toolkit/event-emitter");
loader.lazyImporter(this, "setNamedTimeout",
"resource:///modules/devtools/ViewHelpers.jsm");
loader.lazyImporter(this, "clearNamedTimeout",
"resource:///modules/devtools/ViewHelpers.jsm");
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const HTML_NS = "http://www.w3.org/1999/xhtml";
const AFTER_SCROLL_DELAY = 100;
// Different types of events emitted by the Various components of the TableWidget
const EVENTS = {
TABLE_CLEARED: "table-cleared",
@ -23,8 +18,7 @@ const EVENTS = {
ROW_SELECTED: "row-selected",
ROW_UPDATED: "row-updated",
HEADER_CONTEXT_MENU: "header-context-menu",
ROW_CONTEXT_MENU: "row-context-menu",
SCROLL_END: "scroll-end"
ROW_CONTEXT_MENU: "row-context-menu"
};
// Maximum number of character visible in any cell in the table. This is to avoid
@ -68,8 +62,6 @@ function TableWidget(node, options={}) {
this.tbody.setAttribute("flex", "1");
this.tbody.setAttribute("tabindex", "0");
this._parent.appendChild(this.tbody);
this.afterScroll = this.afterScroll.bind(this);
this.tbody.addEventListener("scroll", this.onScroll.bind(this));
this.placeholder = this.document.createElementNS(XUL_NS, "label");
this.placeholder.className = "plain table-widget-empty-text";
@ -431,27 +423,6 @@ TableWidget.prototype = {
column.sort(sortedItems);
}
}
},
/**
* Calls the afterScroll function when the user has stopped scrolling
*/
onScroll: function() {
clearNamedTimeout("table-scroll");
setNamedTimeout("table-scroll", AFTER_SCROLL_DELAY, this.afterScroll);
},
/**
* Emits the "scroll-end" event when the whole table is scrolled
*/
afterScroll: function() {
let scrollHeight = this.tbody.getBoundingClientRect().height -
this.tbody.querySelector(".table-widget-column-header").clientHeight;
// Emit scroll-end event when 9/10 of the table is scrolled
if (this.tbody.scrollTop >= 0.9 * scrollHeight) {
this.emit("scroll-end");
}
}
};

View File

@ -4,7 +4,6 @@ subsuite = devtools
support-files =
storage-complex-values.html
storage-listings.html
storage-overflow.html
storage-secured-iframe.html
storage-unsecured-iframe.html
storage-updates.html
@ -12,6 +11,5 @@ support-files =
[browser_storage_basic.js]
[browser_storage_dynamic_updates.js]
[browser_storage_overflow.js]
[browser_storage_sidebar.js]
[browser_storage_values.js]

View File

@ -1,38 +0,0 @@
// Test endless scrolling when a lot of items are present in the storage
// inspector table.
"use strict";
add_task(function*() {
yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-overflow.html");
let $ = id => gPanelWindow.document.querySelector(id);
let $$ = sel => gPanelWindow.document.querySelectorAll(sel);
gUI.tree.expandAll();
yield selectTreeItem(["localStorage", "http://test1.example.org"]);
let table = $("#storage-table .table-widget-body");
let cellHeight = $(".table-widget-cell").getBoundingClientRect().height;
is($$("#value .table-widget-cell").length, 50,
"Table should initially display 50 items");
table.scrollTop += cellHeight * 50;
yield gUI.once("store-objects-updated");
is($$("#value .table-widget-cell").length, 100,
"Table should display 100 items after scrolling");
table.scrollTop += cellHeight * 50;
yield gUI.once("store-objects-updated");
is($$("#value .table-widget-cell").length, 150,
"Table should display 150 items after scrolling");
table.scrollTop += cellHeight * 50;
yield gUI.once("store-objects-updated");
is($$("#value .table-widget-cell").length, 200,
"Table should display all 200 items after scrolling");
yield finishTests();
});

View File

@ -1,24 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
Bug 1171903 - Storage Inspector endless scrolling
-->
<head>
<meta charset="utf-8">
<title>Storage inspector endless scrolling test</title>
</head>
<body>
<script type="text/javascript;version=1.8">
"use strict";
window.clear = () => {
localStorage.clear();
};
let array = new Array(200);
for (let i = 0; i < array.length; i++) {
localStorage.setItem(`item-${i}`, `value-${i}`);
}
</script>
</body>
</html>

View File

@ -72,9 +72,6 @@ let StorageUI = this.StorageUI = function StorageUI(front, target, panelWin) {
this.displayObjectSidebar = this.displayObjectSidebar.bind(this);
this.table.on(TableWidget.EVENTS.ROW_SELECTED, this.displayObjectSidebar);
this.handleScrollEnd = this.handleScrollEnd.bind(this);
this.table.on(TableWidget.EVENTS.SCROLL_END, this.handleScrollEnd);
this.sidebar = this._panelDoc.getElementById("storage-sidebar");
this.sidebar.setAttribute("width", "300");
this.view = new VariablesView(this.sidebar.firstChild,
@ -102,7 +99,6 @@ StorageUI.prototype = {
storageTypes: null,
shouldResetColumns: true,
shouldLoadMoreItems: true,
destroy: function() {
this.front.off("stores-update", this.onUpdate);
@ -306,14 +302,11 @@ StorageUI.prototype = {
* @param {array} names
* Names of particular store objects. Empty if all are requested
* @param {number} reason
* 3 for loading next 50 items, 2 for update, 1 for new row in an
* existing table and 0 when populating a table for the first time
* for the given host/type
* 2 for update, 1 for new row in an existing table and 0 when
* populating a table for the first time for the given host/type
*/
fetchStorageObjects: function(type, host, names, reason) {
let fetchOpts = reason === 3 ? {offset: this.itemOffset}
: {};
this.storageTypes[type].getStoreObjects(host, names, fetchOpts).then(({data}) => {
this.storageTypes[type].getStoreObjects(host, names).then(({data}) => {
if (!data.length) {
this.emit("store-objects-updated");
return;
@ -544,7 +537,6 @@ StorageUI.prototype = {
}
this.shouldResetColumns = true;
this.fetchStorageObjects(type, host, names, 0);
this.itemOffset = 0;
},
/**
@ -577,9 +569,9 @@ StorageUI.prototype = {
* @param {array[object]} data
* Array of objects to be populated in the storage table
* @param {number} reason
* The reason of this populateTable call. 3 for loading next 50 items,
* 2 for update, 1 for new row in an existing table and 0 when
* populating a table for the first time for the given host/type
* The reason of this populateTable call. 2 for update, 1 for new row
* in an existing table and 0 when populating a table for the first
* time for the given host/type
*/
populateTable: function(data, reason) {
for (let item of data) {
@ -598,7 +590,7 @@ StorageUI.prototype = {
if (item.lastAccessed != null) {
item.lastAccessed = new Date(item.lastAccessed).toLocaleString();
}
if (reason < 2 || reason == 3) {
if (reason < 2) {
this.table.push(item, reason == 0);
} else {
this.table.update(item);
@ -606,7 +598,6 @@ StorageUI.prototype = {
this.displayObjectSidebar();
}
}
this.shouldLoadMoreItems = true;
}
},
@ -623,22 +614,5 @@ StorageUI.prototype = {
event.stopPropagation();
event.preventDefault();
}
},
/**
* Handles endless scrolling for the table
*/
handleScrollEnd: function() {
if (!this.shouldLoadMoreItems) return;
this.shouldLoadMoreItems = false;
this.itemOffset += 50;
let item = this.tree.selectedItem;
let [type, host, db, objectStore] = item;
let names = null;
if (item.length > 2) {
names = [JSON.stringify(item.slice(2))];
}
this.fetchStorageObjects(type, host, names, 3);
}
};