merge mozilla-central to autoland. CLOSED TREE

This commit is contained in:
Sebastian Hengst 2018-03-13 02:09:59 +02:00
Родитель 0bd3547b12 2f1fb39eee
Коммит 38e337b2ec
12 изменённых файлов: 63 добавлений и 122 удалений

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

@ -272,25 +272,6 @@ TreeWidget.prototype = {
this.setPlaceholderText("");
},
/**
* Check if an item exists.
*
* @param {array} item
* The array of ids leading up to the item.
*/
exists: function(item) {
let bookmark = this.root;
for (let id of item) {
if (bookmark.items.has(id)) {
bookmark = bookmark.items.get(id);
} else {
return false;
}
}
return true;
},
/**
* Removes the specified item and all of its child items from the tree.
*

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

@ -22,7 +22,7 @@ function* performDelete(store, rowName, action) {
yield selectTreeItem(store);
let eventWait = gUI.once("store-objects-edit");
let eventWait = gUI.once("store-objects-updated");
let cells = getRowCells(rowName, true);
yield waitForContextMenu(contextMenu, cells.name, () => {

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

@ -38,7 +38,7 @@ add_task(function* () {
let row = getRowCells(rowName);
ok(gUI.table.items.has(rowName), `There is a row '${rowName}' in ${treeItemName}`);
let eventWait = gUI.once("store-objects-edit");
let eventWait = gUI.once("store-objects-updated");
yield waitForContextMenu(contextMenu, row[cellToClick], () => {
info(`Opened context menu in ${treeItemName}, row '${rowName}'`);

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

@ -50,7 +50,7 @@ add_task(function* () {
yield selectTreeItem(store);
let eventName = "store-objects-" +
(store[0] == "cookies" ? "edit" : "cleared");
(store[0] == "cookies" ? "updated" : "cleared");
let eventWait = gUI.once(eventName);
let selector = `[data-id='${JSON.stringify(store)}'] > .tree-widget-item`;

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

@ -154,7 +154,7 @@ add_task(function* () {
let row = getRowCells(rowName);
ok(gUI.table.items.has(rowName), `There is a row '${rowName}' in ${treeItemName}`);
let eventWait = gUI.once("store-objects-edit");
let eventWait = gUI.once("store-objects-updated");
yield waitForContextMenu(contextMenu, row[cellToClick], () => {
info(`Opened context menu in ${treeItemName}, row '${rowName}'`);

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

@ -52,8 +52,9 @@ add_task(function* () {
]);
checkCell(c1id, "value", "1.2.3.4.5.6.7");
yield addCookie("c1", '{"foo": 4,"bar":6}', "/browser");
yield gUI.once("store-objects-edit");
gWindow.addCookie("c1", '{"foo": 4,"bar":6}', "/browser");
yield gUI.once("sidebar-updated");
yield gUI.once("store-objects-updated");
yield findVariableViewProperties(finalValue[0], false);
yield findVariableViewProperties(finalValue[1], true);
@ -70,9 +71,9 @@ add_task(function* () {
checkCell(c1id, "value", '{"foo": 4,"bar":6}');
// Add a new entry
yield addCookie("c3", "booyeah");
gWindow.addCookie("c3", "booyeah");
yield gUI.once("store-objects-edit");
yield gUI.once("store-objects-updated");
yield checkState([
[
@ -90,9 +91,11 @@ add_task(function* () {
checkCell(c3id, "value", "booyeah");
// Add another
yield addCookie("c4", "booyeah");
gWindow.addCookie("c4", "booyeah");
yield gUI.once("store-objects-edit");
// Wait once for update and another time for value fetching
yield gUI.once("store-objects-updated");
yield gUI.once("store-objects-updated");
yield checkState([
[
@ -112,9 +115,10 @@ add_task(function* () {
checkCell(c4id, "value", "booyeah");
// Removing cookies
yield removeCookie("c1", "/browser");
gWindow.removeCookie("c1", "/browser");
yield gUI.once("store-objects-edit");
yield gUI.once("sidebar-updated");
yield gUI.once("store-objects-updated");
yield checkState([
[
@ -135,9 +139,9 @@ add_task(function* () {
yield findVariableViewProperties([{name: "c2", value: "foobar"}]);
// Keep deleting till no rows
yield removeCookie("c3");
gWindow.removeCookie("c3");
yield gUI.once("store-objects-edit");
yield gUI.once("store-objects-updated");
yield checkState([
[
@ -153,9 +157,10 @@ add_task(function* () {
// Check if next element's value is visible in sidebar
yield findVariableViewProperties([{name: "c2", value: "foobar"}]);
yield removeCookie("c2", "/browser");
gWindow.removeCookie("c2", "/browser");
yield gUI.once("store-objects-edit");
yield gUI.once("sidebar-updated");
yield gUI.once("store-objects-updated");
yield checkState([
[
@ -170,9 +175,9 @@ add_task(function* () {
// Check if next element's value is visible in sidebar
yield findVariableViewProperties([{name: "c4", value: "booyeah"}]);
yield removeCookie("c4");
gWindow.removeCookie("c4");
yield gUI.once("store-objects-edit");
yield gUI.once("store-objects-updated");
yield checkState([
[["cookies", "http://test1.example.org"], [ ]],
@ -182,19 +187,3 @@ add_task(function* () {
yield finishTests();
});
function* addCookie(name, value, path) {
yield ContentTask.spawn(gBrowser.selectedBrowser, [name, value, path],
([nam, valu, pat]) => {
content.wrappedJSObject.addCookie(nam, valu, pat);
}
);
}
function* removeCookie(name, path) {
yield ContentTask.spawn(gBrowser.selectedBrowser, [name, path],
([nam, pat]) => {
content.wrappedJSObject.removeCookie(nam, pat);
}
);
}

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

@ -20,9 +20,9 @@ add_task(function* () {
],
]);
yield removeLocalStorageItem("ls4");
gWindow.localStorage.removeItem("ls4");
yield gUI.once("store-objects-edit");
yield gUI.once("store-objects-updated");
yield checkState([
[
@ -31,9 +31,10 @@ add_task(function* () {
],
]);
yield setLocalStorageItem("ls4", "again");
gWindow.localStorage.setItem("ls4", "again");
yield gUI.once("store-objects-edit");
yield gUI.once("store-objects-updated");
yield gUI.once("store-objects-updated");
yield checkState([
[
@ -42,9 +43,10 @@ add_task(function* () {
],
]);
// Updating a row
yield setLocalStorageItem("ls2", "ls2-changed");
gWindow.localStorage.setItem("ls2", "ls2-changed");
yield gUI.once("store-objects-edit");
yield gUI.once("store-objects-updated");
yield gUI.once("store-objects-updated");
checkCell("ls2", "value", "ls2-changed");
@ -64,19 +66,3 @@ add_task(function* () {
yield finishTests();
});
function* setLocalStorageItem(key, value) {
yield ContentTask.spawn(gBrowser.selectedBrowser, [key, value],
([innerKey, innerValue]) => {
content.wrappedJSObject.localStorage.setItem(innerKey, innerValue);
}
);
}
function* removeLocalStorageItem(key) {
yield ContentTask.spawn(gBrowser.selectedBrowser, key,
innerKey => {
content.wrappedJSObject.localStorage.removeItem(innerKey);
}
);
}

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

@ -20,9 +20,10 @@ add_task(function* () {
],
]);
yield setSessionStorageItem("ss4", "new-item");
gWindow.sessionStorage.setItem("ss4", "new-item");
yield gUI.once("store-objects-edit");
yield gUI.once("store-objects-updated");
yield gUI.once("store-objects-updated");
yield checkState([
[
@ -33,13 +34,13 @@ add_task(function* () {
// deleting item
yield removeSessionStorageItem("ss3");
gWindow.sessionStorage.removeItem("ss3");
yield gUI.once("store-objects-edit");
yield gUI.once("store-objects-updated");
yield removeSessionStorageItem("ss1");
gWindow.sessionStorage.removeItem("ss1");
yield gUI.once("store-objects-edit");
yield gUI.once("store-objects-updated");
yield checkState([
[
@ -55,7 +56,7 @@ add_task(function* () {
// Checking for correct value in sidebar before update
yield findVariableViewProperties([{name: "ss2", value: "foobar"}]);
yield setSessionStorageItem("ss2", "changed=ss2");
gWindow.sessionStorage.setItem("ss2", "changed=ss2");
yield gUI.once("sidebar-updated");
@ -79,19 +80,3 @@ add_task(function* () {
yield finishTests();
});
function* setSessionStorageItem(key, value) {
yield ContentTask.spawn(gBrowser.selectedBrowser, [key, value],
([innerKey, innerValue]) => {
content.wrappedJSObject.sessionStorage.setItem(innerKey, innerValue);
}
);
}
function* removeSessionStorageItem(key) {
yield ContentTask.spawn(gBrowser.selectedBrowser, key,
innerKey => {
content.wrappedJSObject.sessionStorage.removeItem(innerKey);
}
);
}

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

@ -25,7 +25,8 @@ add_task(function* () {
yield selectTreeItem(deletedDb);
// Wait once for update and another time for value fetching
let eventWait = gUI.once("store-objects-updated");
let eventWait = gUI.once("store-objects-updated").then(
() => gUI.once("store-objects-updated"));
let selector = `[data-id='${JSON.stringify(deletedDb)}'] > .tree-widget-item`;
let target = gPanelWindow.document.querySelector(selector);

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

@ -28,7 +28,7 @@ add_task(function* () {
[["indexedDB", "http://test1.example.org"], ["idb (default)"]]
]);
let eventWait = gUI.once("store-objects-edit");
let eventWait = gUI.once("store-objects-updated");
info("telling content to close the db");
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
@ -36,7 +36,7 @@ add_task(function* () {
yield win.closeDb();
});
info("waiting for store edit events");
info("waiting for store update events");
yield eventWait;
info("test state after real delete");

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

@ -30,7 +30,7 @@ const ALT_DOMAIN_SECURED = "https://sectest1.example.org:443/" + PATH;
// devtools/client/storage/ui.js and devtools/server/tests/browser/head.js
const SEPARATOR_GUID = "{9d414cc5-8319-0a04-0586-c0a6ae01670a}";
var gToolbox, gPanelWindow, gUI;
var gToolbox, gPanelWindow, gWindow, gUI;
// Services.prefs.setBoolPref(DUMPEMIT_PREF, true);
// Services.prefs.setBoolPref(DEBUGGERLOG_PREF, true);
@ -38,7 +38,7 @@ var gToolbox, gPanelWindow, gUI;
Services.prefs.setBoolPref(STORAGE_PREF, true);
Services.prefs.setBoolPref(CACHES_ON_HTTP_PREF, true);
registerCleanupFunction(() => {
gToolbox = gPanelWindow = gUI = null;
gToolbox = gPanelWindow = gWindow = gUI = null;
Services.prefs.clearUserPref(CACHES_ON_HTTP_PREF);
Services.prefs.clearUserPref(DEBUGGERLOG_PREF);
Services.prefs.clearUserPref(DOM_CACHE);
@ -57,6 +57,9 @@ registerCleanupFunction(() => {
*/
function* openTab(url, options = {}) {
let tab = yield addTab(url, options);
let content = tab.linkedBrowser.contentWindowAsCPOW;
gWindow = content.wrappedJSObject;
// Setup the async storages in main window and for all its iframes
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
@ -216,6 +219,8 @@ function forceCollections() {
* Cleans up and finishes the test
*/
function* finishTests() {
// Bug 1233497 makes it so that we can no longer yield CPOWs from Tasks.
// We work around this by calling clear() via a ContentTask instead.
while (gBrowser.tabs.length > 1) {
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
/**
@ -507,17 +512,11 @@ function matchVariablesViewProperty(prop, rule) {
* The array id of the item in the tree
*/
function* selectTreeItem(ids) {
/* If this item is already selected, return */
if (gUI.tree.isSelected(ids)) {
info(`"${ids}" is already selected, returning.`);
return;
}
if (!gUI.tree.exists(ids)) {
info(`"${ids}" does not exist, returning.`);
return;
}
// The item exists but is not selected... select it.
info(`Selecting "${ids}".`);
let updated = gUI.once("store-objects-updated");
gUI.tree.selectedItem = ids;
yield updated;
@ -991,7 +990,7 @@ function* performAdd(store) {
}
let eventEdit = gUI.table.once("row-edit");
let eventWait = gUI.once("store-objects-edit");
let eventWait = gUI.once("store-objects-updated");
menuAdd.click();

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

@ -141,8 +141,8 @@ class StorageUI {
console.error(e);
});
this.onEdit = this.onEdit.bind(this);
this.front.on("stores-update", this.onEdit);
this.onUpdate = this.onUpdate.bind(this);
this.front.on("stores-update", this.onUpdate);
this.onCleared = this.onCleared.bind(this);
this.front.on("stores-cleared", this.onCleared);
@ -216,7 +216,7 @@ class StorageUI {
this.table.off(TableWidget.EVENTS.CELL_EDIT, this.editItem);
this.table.destroy();
this.front.off("stores-update", this.onEdit);
this.front.off("stores-update", this.onUpdate);
this.front.off("stores-cleared", this.onCleared);
this._panelDoc.removeEventListener("keypress", this.handleKeypress);
this.searchBox.removeEventListener("input", this.filterItems);
@ -401,7 +401,7 @@ class StorageUI {
* of the changed store objects. This array is empty for deleted object
* if the host was completely removed.
*/
async onEdit({ changed, added, deleted }) {
async onUpdate({ changed, added, deleted }) {
if (added) {
await this.handleAddedItems(added);
}
@ -421,14 +421,14 @@ class StorageUI {
}
if (added || deleted || changed) {
this.emit("store-objects-edit");
this.emit("store-objects-updated");
}
}
/**
* Handle added items received by onEdit
* Handle added items received by onUpdate
*
* @param {object} See onEdit docs
* @param {object} See onUpdate docs
*/
async handleAddedItems(added) {
for (let type in added) {
@ -460,9 +460,9 @@ class StorageUI {
}
/**
* Handle deleted items received by onEdit
* Handle deleted items received by onUpdate
*
* @param {object} See onEdit docs
* @param {object} See onUpdate docs
*/
async handleDeletedItems(deleted) {
for (let type in deleted) {
@ -512,9 +512,9 @@ class StorageUI {
}
/**
* Handle changed items received by onEdit
* Handle changed items received by onUpdate
*
* @param {object} See onEdit docs
* @param {object} See onUpdate docs
*/
async handleChangedItems(changed) {
let [type, host, db, objectStore] = this.tree.selectedItem;