mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
Bug 1302989: Make storage inspector work with file:// when # is in the URL
Issue #31
This commit is contained in:
parent
fab2253b26
commit
b95939dd3c
16 changed files with 271 additions and 84 deletions
|
|
@ -9,6 +9,7 @@ support-files =
|
|||
storage-idb-delete-blocked.html
|
||||
storage-indexeddb-duplicate-names.html
|
||||
storage-listings.html
|
||||
storage-listings-with-fragment.html
|
||||
storage-localstorage.html
|
||||
storage-overflow.html
|
||||
storage-search.html
|
||||
|
|
@ -20,6 +21,7 @@ support-files =
|
|||
!/devtools/client/framework/test/shared-head.js
|
||||
|
||||
[browser_storage_basic.js]
|
||||
[browser_storage_basic_with_fragment.js]
|
||||
[browser_storage_cache_delete.js]
|
||||
[browser_storage_cache_error.js]
|
||||
[browser_storage_cookies_add.js]
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
const testCases = [
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c1", "test1.example.org", "/browser"),
|
||||
getCookieId("cs2", ".example.org", "/"),
|
||||
|
|
@ -35,7 +35,7 @@ const testCases = [
|
|||
]
|
||||
],
|
||||
[
|
||||
["cookies", "sectest1.example.org"],
|
||||
["cookies", "https://sectest1.example.org"],
|
||||
[
|
||||
getCookieId("uc1", ".example.org", "/"),
|
||||
getCookieId("uc2", ".example.org", "/"),
|
||||
|
|
@ -93,8 +93,8 @@ const testCases = [
|
|||
*/
|
||||
function testTree() {
|
||||
let doc = gPanelWindow.document;
|
||||
for (let item of testCases) {
|
||||
ok(doc.querySelector("[data-id='" + JSON.stringify(item[0]) + "']"),
|
||||
for (let [item] of testCases) {
|
||||
ok(doc.querySelector("[data-id='" + JSON.stringify(item) + "']"),
|
||||
"Tree item " + item[0] + " should be present in the storage tree");
|
||||
}
|
||||
}
|
||||
|
|
@ -108,8 +108,8 @@ function* testTables() {
|
|||
gUI.tree.expandAll();
|
||||
|
||||
// First tree item is already selected so no clicking and waiting for update
|
||||
for (let id of testCases[0][1]) {
|
||||
ok(doc.querySelector(".table-widget-cell[data-id='" + id + "']"),
|
||||
for (let [treeItem, items] of testCases.slice(1)) {
|
||||
yield selectTreeItem(treeItem);
|
||||
"Table item " + id + " should be present");
|
||||
}
|
||||
|
||||
|
|
@ -120,10 +120,10 @@ function* testTables() {
|
|||
// Check whether correct number of items are present in the table
|
||||
is(doc.querySelectorAll(
|
||||
".table-widget-wrapper:first-of-type .table-widget-cell"
|
||||
).length, item[1].length, "Number of items in table is correct");
|
||||
).length, items.length, "Number of items in table is correct");
|
||||
|
||||
// Check if all the desired items are present in the table
|
||||
for (let id of item[1]) {
|
||||
for (let id of items) {
|
||||
ok(doc.querySelector(".table-widget-cell[data-id='" + id + "']"),
|
||||
"Table item " + id + " should be present");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,139 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* import-globals-from head.js */
|
||||
|
||||
// A second basic test to assert that the storage tree and table corresponding
|
||||
// to each item in the storage tree is correctly displayed.
|
||||
|
||||
// This test differs from browser_storage_basic.js because the URLs we load
|
||||
// include fragments e.g. http://example.com/test.js#abcdefg
|
||||
// ^^^^^^^^
|
||||
// fragment
|
||||
|
||||
// Entries that should be present in the tree for this test
|
||||
// Format for each entry in the array :
|
||||
// [
|
||||
// ["path", "to", "tree", "item"], - The path to the tree item to click formed
|
||||
// by id of each item
|
||||
// ["key_value1", "key_value2", ...] - The value of the first (unique) column
|
||||
// for each row in the table corresponding
|
||||
// to the tree item selected.
|
||||
// ]
|
||||
// These entries are formed by the cookies, local storage, session storage and
|
||||
// indexedDB entries created in storage-listings.html,
|
||||
// storage-secured-iframe.html and storage-unsecured-iframe.html
|
||||
|
||||
"use strict";
|
||||
|
||||
const testCases = [
|
||||
[
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c1", "test1.example.org", "/browser"),
|
||||
getCookieId("cs2", ".example.org", "/"),
|
||||
getCookieId("c3", "test1.example.org", "/"),
|
||||
getCookieId("uc1", ".example.org", "/")
|
||||
]
|
||||
],
|
||||
[
|
||||
["cookies", "https://sectest1.example.org"],
|
||||
[
|
||||
getCookieId("uc1", ".example.org", "/"),
|
||||
getCookieId("cs2", ".example.org", "/"),
|
||||
getCookieId("sc1", "sectest1.example.org", "/browser/devtools/client/storage/test/")
|
||||
]
|
||||
],
|
||||
[["localStorage", "http://test1.example.org"],
|
||||
["ls1", "ls2"]],
|
||||
[["localStorage", "http://sectest1.example.org"],
|
||||
["iframe-u-ls1"]],
|
||||
[["localStorage", "https://sectest1.example.org"],
|
||||
["iframe-s-ls1"]],
|
||||
[["sessionStorage", "http://test1.example.org"],
|
||||
["ss1"]],
|
||||
[["sessionStorage", "http://sectest1.example.org"],
|
||||
["iframe-u-ss1", "iframe-u-ss2"]],
|
||||
[["sessionStorage", "https://sectest1.example.org"],
|
||||
["iframe-s-ss1"]],
|
||||
[["indexedDB", "http://test1.example.org"],
|
||||
["idb1 (default)", "idb2 (default)"]],
|
||||
[["indexedDB", "http://test1.example.org", "idb1 (default)"],
|
||||
["obj1", "obj2"]],
|
||||
[["indexedDB", "http://test1.example.org", "idb2 (default)"],
|
||||
["obj3"]],
|
||||
[["indexedDB", "http://test1.example.org", "idb1 (default)", "obj1"],
|
||||
[1, 2, 3]],
|
||||
[["indexedDB", "http://test1.example.org", "idb1 (default)", "obj2"],
|
||||
[1]],
|
||||
[["indexedDB", "http://test1.example.org", "idb2 (default)", "obj3"],
|
||||
[]],
|
||||
[["indexedDB", "http://sectest1.example.org"],
|
||||
[]],
|
||||
[["indexedDB", "https://sectest1.example.org"],
|
||||
["idb-s1 (default)", "idb-s2 (default)"]],
|
||||
[["indexedDB", "https://sectest1.example.org", "idb-s1 (default)"],
|
||||
["obj-s1"]],
|
||||
[["indexedDB", "https://sectest1.example.org", "idb-s2 (default)"],
|
||||
["obj-s2"]],
|
||||
[["indexedDB", "https://sectest1.example.org", "idb-s1 (default)", "obj-s1"],
|
||||
[6, 7]],
|
||||
[["indexedDB", "https://sectest1.example.org", "idb-s2 (default)", "obj-s2"],
|
||||
[16]],
|
||||
[["Cache", "http://test1.example.org", "plop"],
|
||||
[MAIN_DOMAIN + "404_cached_file.js",
|
||||
MAIN_DOMAIN + "browser_storage_basic.js"]],
|
||||
];
|
||||
|
||||
/**
|
||||
* Test that the desired number of tree items are present
|
||||
*/
|
||||
function testTree() {
|
||||
let doc = gPanelWindow.document;
|
||||
for (let [item] of testCases) {
|
||||
ok(doc.querySelector("[data-id='" + JSON.stringify(item) + "']"),
|
||||
"Tree item " + item[0] + " should be present in the storage tree");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that correct table entries are shown for each of the tree item
|
||||
*/
|
||||
function* testTables() {
|
||||
let doc = gPanelWindow.document;
|
||||
// Expand all nodes so that the synthesized click event actually works
|
||||
gUI.tree.expandAll();
|
||||
|
||||
// First tree item is already selected so no clicking and waiting for update
|
||||
for (let id of testCases[0][1]) {
|
||||
ok(doc.querySelector(".table-widget-cell[data-id='" + id + "']"),
|
||||
"Table item " + id + " should be present");
|
||||
}
|
||||
|
||||
// Click rest of the tree items and wait for the table to be updated
|
||||
for (let [treeItem, items] of testCases.slice(1)) {
|
||||
yield selectTreeItem(treeItem);
|
||||
|
||||
// Check whether correct number of items are present in the table
|
||||
is(doc.querySelectorAll(
|
||||
".table-widget-wrapper:first-of-type .table-widget-cell"
|
||||
).length, items.length, "Number of items in table is correct");
|
||||
|
||||
// Check if all the desired items are present in the table
|
||||
for (let id of items) {
|
||||
ok(doc.querySelector(".table-widget-cell[data-id='" + id + "']"),
|
||||
"Table item " + id + " should be present");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_task(function* () {
|
||||
yield openTabAndSetupStorage(
|
||||
MAIN_DOMAIN + "storage-listings-with-fragment.html#abc");
|
||||
|
||||
testTree();
|
||||
yield testTables();
|
||||
|
||||
yield finishTests();
|
||||
});
|
||||
|
|
@ -52,7 +52,7 @@ add_task(function* () {
|
|||
info("test state before delete");
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"], [
|
||||
["cookies", "http://test1.example.org"], [
|
||||
getCookieId("c1", "test1.example.org", "/browser"),
|
||||
getCookieId("c3", "test1.example.org", "/"),
|
||||
getCookieId("cs2", ".example.org", "/"),
|
||||
|
|
@ -62,7 +62,7 @@ add_task(function* () {
|
|||
]
|
||||
],
|
||||
[
|
||||
["cookies", "sectest1.example.org"], [
|
||||
["cookies", "https://sectest1.example.org"], [
|
||||
getCookieId("cs2", ".example.org", "/"),
|
||||
getCookieId("c4", ".example.org", "/"),
|
||||
getCookieId("sc1", "sectest1.example.org",
|
||||
|
|
@ -78,14 +78,13 @@ add_task(function* () {
|
|||
info("delete all from domain");
|
||||
// delete only cookies that match the host exactly
|
||||
let id = getCookieId("c1", "test1.example.org", "/browser");
|
||||
yield performDelete(["cookies", "test1.example.org"], id, "deleteAllFrom");
|
||||
yield performDelete(["cookies", "test1.example.org"], id, false);
|
||||
yield performDelete(["cookies", "http://test1.example.org"], id, "deleteAllFrom");
|
||||
|
||||
info("test state after delete all from domain");
|
||||
yield checkState([
|
||||
// Domain cookies (.example.org) must not be deleted.
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("cs2", ".example.org", "/"),
|
||||
getCookieId("c4", ".example.org", "/"),
|
||||
|
|
@ -94,7 +93,7 @@ add_task(function* () {
|
|||
]
|
||||
],
|
||||
[
|
||||
["cookies", "sectest1.example.org"],
|
||||
["cookies", "https://sectest1.example.org"],
|
||||
[
|
||||
getCookieId("cs2", ".example.org", "/"),
|
||||
getCookieId("c4", ".example.org", "/"),
|
||||
|
|
@ -138,14 +137,15 @@ add_task(function* () {
|
|||
info("delete all");
|
||||
// delete all cookies for host, including domain cookies
|
||||
id = getCookieId("uc2", ".example.org", "/");
|
||||
yield performDelete(["cookies", "sectest1.example.org"], id, "deleteAll");
|
||||
yield performDelete(["cookies", "http://sectest1.example.org"], id,
|
||||
"deleteAll");
|
||||
|
||||
info("test state after delete all");
|
||||
yield checkState([
|
||||
// Domain cookies (.example.org) are deleted too, so deleting in sectest1
|
||||
// also removes stuff from test1.
|
||||
[["cookies", "test1.example.org"], []],
|
||||
[["cookies", "sectest1.example.org"], []],
|
||||
[["cookies", "http://test1.example.org"], []],
|
||||
[["cookies", "https://sectest1.example.org"], []],
|
||||
]);
|
||||
|
||||
yield finishTests();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ add_task(function* () {
|
|||
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("test1", ".test1.example.org", "/browser"),
|
||||
getCookieId("test2", "test1.example.org", "/browser"),
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ const TEST_CASES = [
|
|||
[["sessionStorage", "http://test1.example.org"],
|
||||
"ss1", "name"],
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
getCookieId("c1", "test1.example.org", "/browser"), "name"
|
||||
],
|
||||
[["indexedDB", "http://test1.example.org", "idb1 (default)", "obj1"],
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ add_task(function* () {
|
|||
info("test state before delete");
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c1", "test1.example.org", "/browser"),
|
||||
getCookieId("cs2", ".example.org", "/"),
|
||||
|
|
@ -37,7 +37,7 @@ add_task(function* () {
|
|||
|
||||
info("do the delete");
|
||||
const deleteHosts = [
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
["localStorage", "http://test1.example.org"],
|
||||
["sessionStorage", "http://test1.example.org"],
|
||||
["indexedDB", "http://test1.example.org", "idb1 (default)", "obj1"],
|
||||
|
|
@ -66,7 +66,7 @@ add_task(function* () {
|
|||
|
||||
info("test state after delete");
|
||||
yield checkState([
|
||||
[["cookies", "test1.example.org"], []],
|
||||
[["cookies", "http://test1.example.org"], []],
|
||||
[["localStorage", "http://test1.example.org"], []],
|
||||
[["sessionStorage", "http://test1.example.org"], []],
|
||||
[["indexedDB", "http://test1.example.org", "idb1 (default)", "obj1"], []],
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ add_task(function* () {
|
|||
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c1", "test1.example.org", "/browser"),
|
||||
getCookieId("c2", "test1.example.org", "/browser")
|
||||
|
|
@ -60,7 +60,7 @@ add_task(function* () {
|
|||
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c1", "test1.example.org", "/browser"),
|
||||
getCookieId("c2", "test1.example.org", "/browser")
|
||||
|
|
@ -78,7 +78,7 @@ add_task(function* () {
|
|||
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c1", "test1.example.org", "/browser"),
|
||||
getCookieId("c2", "test1.example.org", "/browser"),
|
||||
|
|
@ -100,7 +100,7 @@ add_task(function* () {
|
|||
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c1", "test1.example.org", "/browser"),
|
||||
getCookieId("c2", "test1.example.org", "/browser"),
|
||||
|
|
@ -122,7 +122,7 @@ add_task(function* () {
|
|||
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c2", "test1.example.org", "/browser"),
|
||||
getCookieId("c3", "test1.example.org",
|
||||
|
|
@ -145,7 +145,7 @@ add_task(function* () {
|
|||
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c2", "test1.example.org", "/browser"),
|
||||
getCookieId("c4", "test1.example.org",
|
||||
|
|
@ -163,7 +163,7 @@ add_task(function* () {
|
|||
|
||||
yield checkState([
|
||||
[
|
||||
["cookies", "test1.example.org"],
|
||||
["cookies", "http://test1.example.org"],
|
||||
[
|
||||
getCookieId("c4", "test1.example.org",
|
||||
"/browser/devtools/client/storage/test/")
|
||||
|
|
@ -179,7 +179,7 @@ add_task(function* () {
|
|||
yield gUI.once("store-objects-updated");
|
||||
|
||||
yield checkState([
|
||||
[["cookies", "test1.example.org"], [ ]],
|
||||
[["cookies", "http://test1.example.org"], [ ]],
|
||||
]);
|
||||
|
||||
ok(gUI.sidebar.hidden, "Sidebar is hidden when no rows");
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
const testCases = [
|
||||
{
|
||||
location: ["cookies", "sectest1.example.org"],
|
||||
location: ["cookies", "https://sectest1.example.org"],
|
||||
sidebarHidden: true
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Bug 970517 - Storage inspector front end - tests
|
||||
Storage inspector front end - tests
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue