From 4115fa05a09b30f36566756d28e340600622225d Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Tue, 8 Sep 2015 11:32:08 +0200 Subject: [PATCH] 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) --- .../devtools/shared/widgets/TableWidget.js | 35 ++-------------- browser/devtools/storage/test/browser.ini | 2 - .../storage/test/browser_storage_overflow.js | 38 ------------------ .../storage/test/storage-overflow.html | 24 ----------- browser/devtools/storage/ui.js | 40 ++++--------------- 5 files changed, 10 insertions(+), 129 deletions(-) delete mode 100644 browser/devtools/storage/test/browser_storage_overflow.js delete mode 100644 browser/devtools/storage/test/storage-overflow.html diff --git a/browser/devtools/shared/widgets/TableWidget.js b/browser/devtools/shared/widgets/TableWidget.js index 97726d7b246..e3f6ea5493b 100644 --- a/browser/devtools/shared/widgets/TableWidget.js +++ b/browser/devtools/shared/widgets/TableWidget.js @@ -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"); - } } }; diff --git a/browser/devtools/storage/test/browser.ini b/browser/devtools/storage/test/browser.ini index 06922a30c6b..2c88599cad5 100644 --- a/browser/devtools/storage/test/browser.ini +++ b/browser/devtools/storage/test/browser.ini @@ -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] diff --git a/browser/devtools/storage/test/browser_storage_overflow.js b/browser/devtools/storage/test/browser_storage_overflow.js deleted file mode 100644 index 34d482ab050..00000000000 --- a/browser/devtools/storage/test/browser_storage_overflow.js +++ /dev/null @@ -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(); -}); diff --git a/browser/devtools/storage/test/storage-overflow.html b/browser/devtools/storage/test/storage-overflow.html deleted file mode 100644 index 4e31c32d7c0..00000000000 --- a/browser/devtools/storage/test/storage-overflow.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - Storage inspector endless scrolling test - - - - - diff --git a/browser/devtools/storage/ui.js b/browser/devtools/storage/ui.js index e14119f6b46..36660602d74 100644 --- a/browser/devtools/storage/ui.js +++ b/browser/devtools/storage/ui.js @@ -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); } };