Bug 1175850 - ESLint fixes r=me

This commit is contained in:
Michael Ratcliffe 2015-08-18 11:48:22 +01:00
parent 8a589d81ee
commit fb37044ddc
21 changed files with 186 additions and 161 deletions

View File

@ -1,12 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
///////////////////
//
// Whitelisting this test.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
//
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created.");
"use strict";
/**
* Whitelisting this test.
* As part of bug 1077403, the leaking uncaught rejection should be fixed.
*/
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is " +
"still waiting for a WebGL context to be created.");
function performChecks(target) {
return Task.spawn(function*() {

View File

@ -1,12 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
///////////////////
//
// Whitelisting this test.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
//
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created.");
"use strict";
/**
* Whitelisting this test.
* As part of bug 1077403, the leaking uncaught rejection should be fixed.
*/
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is " +
"still waiting for a WebGL context to be created.");
const { DebuggerServer } = require("devtools/server/main");
const { DebuggerClient } = require("devtools/toolkit/client/main");
@ -86,7 +88,7 @@ function getClient() {
function getTarget(client) {
let deferred = promise.defer();
let tabList = client.listTabs(tabList => {
client.listTabs(tabList => {
let target = TargetFactory.forRemoteTab({
client: client,
form: tabList.tabs[tabList.selected],

View File

@ -1,6 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let {Toolbox} = require("devtools/framework/toolbox");
let toolbox, toolIDs, idIndex, modifiedPrefs = [];

View File

@ -4,7 +4,9 @@
* 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/. */
const {Cc, Ci, Cu, Cr} = require("chrome");
"use strict";
const {Cu} = require("chrome");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -26,7 +28,7 @@ this.StoragePanel = function StoragePanel(panelWin, toolbox) {
this._panelWin = panelWin;
this.destroy = this.destroy.bind(this);
}
};
exports.StoragePanel = StoragePanel;
@ -80,10 +82,10 @@ StoragePanel.prototype = {
return Promise.resolve(null);
},
}
};
XPCOMUtils.defineLazyGetter(StoragePanel.prototype, "strings",
function () {
function() {
return Services.strings.createBundle(
"chrome://browser/locale/devtools/storage.properties");
});

View File

@ -18,6 +18,9 @@
// indexedDB entries created in storage-listings.html,
// storage-secured-iframe.html and storage-unsecured-iframe.html
const storeItems = [
"use strict";
[["cookies", "test1.example.org"],
["c1", "cs2", "c3", "uc1"]],
[["cookies", "sectest1.example.org"],

View File

@ -3,6 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
let testUpdates = Task.async(function*() {
"use strict";
let $ = id => gPanelWindow.document.querySelector(id);
let $$ = sel => gPanelWindow.document.querySelectorAll(sel);
@ -17,7 +19,7 @@ let testUpdates = Task.async(function*() {
let initialValue = [[
{name: "c1", value: "1.2.3.4.5.6.7"},
{name: "c1.path", value: "/browser"}
],[
], [
{name: "c1", value: "Array"},
{name: "c1.0", value: "1"},
{name: "c1.6", value: "7"}
@ -27,7 +29,7 @@ let testUpdates = Task.async(function*() {
let finalValue = [[
{name: "c1", value: '{"foo": 4,"bar":6}'},
{name: "c1.path", value: "/browser"}
],[
], [
{name: "c1", value: "Object"},
{name: "c1.foo", value: "4"},
{name: "c1.bar", value: "6"}
@ -44,7 +46,8 @@ let testUpdates = Task.async(function*() {
yield findVariableViewProperties(finalValue[0], false);
yield findVariableViewProperties(finalValue[1], true);
ok($("#value [data-id='c1'].table-widget-cell"), "cell is present after update");
ok($("#value [data-id='c1'].table-widget-cell"),
"cell is present after update");
is($("#value [data-id='c1'].table-widget-cell").value, '{"foo": 4,"bar":6}',
"correct final value in table");

View File

@ -11,6 +11,9 @@
// <do we wait for the async "sidebar-updated" event>,
// <is the sidebar open>
// ]
"use strict";
const testCases = [
[["cookies", "sectest1.example.org"], 0, 0],
["cs2", 1, 1],

View File

@ -11,6 +11,9 @@
// which will be asserted to exist in the storage sidebar,
// true if the check is to be made in the parsed value section
// ]
"use strict";
const testCases = [
["cs2", [
{name: "cs2", value: "sessionCookie"},
@ -30,7 +33,7 @@ const testCases = [
{name: "c1.expires", value: new Date(2000000000000).toLocaleString()},
{name: "c1.isSecure", value: "false"},
]],
[/*"c1"*/, [
[null, [
{name: "c1", value: "Array"},
{name: "c1.0", value: "foo"},
{name: "c1.1", value: "Bar"},
@ -48,7 +51,7 @@ const testCases = [
nobody: "cares"
}]})}
]],
[/*ls1*/, [
[null, [
{name: "ls1", value: "Object"},
{name: "ls1.es6", value: "for"},
{name: "ls1.the", value: "win"},
@ -63,14 +66,14 @@ const testCases = [
["ls3", [
{name: "ls3", "value": "http://foobar.com/baz.php"}
]],
[/*ls3*/, [
[null, [
{name: "ls3", "value": "http://foobar.com/baz.php", dontMatch: true}
], true],
[["sessionStorage", "http://test1.example.org"]],
["ss1", [
{name: "ss1", value: "This#is#an#array"}
]],
[/*ss1*/, [
[null, [
{name: "ss1", value: "Array"},
{name: "ss1.0", value: "This"},
{name: "ss1.1", value: "is"},
@ -94,7 +97,7 @@ const testCases = [
[1, [
{name: 1, value: JSON.stringify({id: 1, name: "foo", email: "foo@bar.com"})}
]],
[/*1*/, [
[null, [
{name: "1.id", value: "1"},
{name: "1.name", value: "foo"},
{name: "1.email", value: "foo@bar.com"},
@ -105,7 +108,7 @@ const testCases = [
id2: 1, name: "foo", email: "foo@bar.com", extra: "baz"
})}
]],
[/*1*/, [
[null, [
{name: "1.id2", value: "1"},
{name: "1.name", value: "foo"},
{name: "1.email", value: "foo@bar.com"},

View File

@ -83,11 +83,9 @@ let openTabAndSetupStorage = Task.async(function*(url) {
if (w[i] && w[i].idbGenerator) {
w[i].setupIDB = w[i].idbGenerator(() => setupIDBInFrames(w, i + 1, c));
w[i].setupIDB.next();
}
else if (w[i] && w[i + 1]) {
} else if (w[i] && w[i + 1]) {
setupIDBInFrames(w, i + 1, c);
}
else {
} else {
c();
}
};
@ -138,12 +136,12 @@ let openStoragePanel = Task.async(function*(cb) {
info("Toolbox and storage already open");
if (cb) {
return cb(storage, toolbox);
} else {
return {
toolbox: toolbox,
storage: storage
};
}
return {
toolbox: toolbox,
storage: storage
};
}
}
@ -161,12 +159,12 @@ let openStoragePanel = Task.async(function*(cb) {
if (cb) {
return cb(storage, toolbox);
} else {
return {
toolbox: toolbox,
storage: storage
};
}
return {
toolbox: toolbox,
storage: storage
};
});
/**
@ -233,8 +231,6 @@ function click(node) {
executeSoon(() => EventUtils.synthesizeMouseAtCenter(node, {}, gPanelWindow));
}
/**
* Recursively expand the variables view up to a given property.
*
@ -264,18 +260,13 @@ function variablesViewExpandTo(aOptions) {
if (newProp && newProp.expand) {
newProp.expand();
getNext(newProp);
}
else {
lastDeferred.reject(aProp);
}
}
else {
if (newProp) {
lastDeferred.resolve(newProp);
}
else {
} else {
lastDeferred.reject(aProp);
}
} else if (newProp) {
lastDeferred.resolve(newProp);
} else {
lastDeferred.reject(aProp);
}
}
@ -286,9 +277,8 @@ function variablesViewExpandTo(aOptions) {
if (root && root.expand) {
root.expand();
getNext(root);
}
else {
lastDeferred.resolve(root)
} else {
lastDeferred.resolve(root);
}
return lastDeferred.promise;
@ -321,7 +311,7 @@ function findVariableViewProperties(aRules, aParsed) {
// Thus, adding a blank parent to each name
if (aParsed) {
aRules = aRules.map(({name, value, dontMatch}) => {
return {name: "." + name, value, dontMatch}
return {name: "." + name, value, dontMatch};
});
}
// Separate out the rules that require expanding properties throughout the
@ -357,10 +347,10 @@ function findVariableViewProperties(aRules, aParsed) {
}
}
function finder(aRules, aView, aPromises) {
function finder(rules, aView, aPromises) {
for (let scope of aView) {
for (let [id, prop] of scope) {
for (let rule of aRules) {
for (let [, prop] of scope) {
for (let rule of rules) {
let matcher = matchVariablesViewProperty(prop, rule);
aPromises.push(matcher.then(onMatch.bind(null, prop, rule)));
}
@ -368,15 +358,15 @@ function findVariableViewProperties(aRules, aParsed) {
}
}
function processExpandRules(aRules) {
let rule = aRules.shift();
function processExpandRules(rules) {
let rule = rules.shift();
if (!rule) {
return promise.resolve(null);
}
let deferred = promise.defer();
let expandOptions = {
rootVariable: gUI.view.getScopeAtIndex(aParsed ? 1: 0),
rootVariable: gUI.view.getScopeAtIndex(aParsed ? 1 : 0),
expandTo: rule.name
};
@ -391,28 +381,26 @@ function findVariableViewProperties(aRules, aParsed) {
});
}, function onFailure() {
return promise.resolve(null);
}).then(processExpandRules.bind(null, aRules)).then(function() {
}).then(processExpandRules.bind(null, rules)).then(function() {
deferred.resolve(null);
});
return deferred.promise;
}
function onAllRulesMatched(aRules) {
for (let rule of aRules) {
function onAllRulesMatched(rules) {
for (let rule of rules) {
let matched = rule.matchedProp;
if (matched && !rule.dontMatch) {
ok(true, "rule " + rule.name + " matched for property " + matched.name);
}
else if (matched && rule.dontMatch) {
} else if (matched && rule.dontMatch) {
ok(false, "rule " + rule.name + " should not match property " +
matched.name);
}
else {
} else {
ok(rule.dontMatch, "rule " + rule.name + " did not match any property");
}
}
return aRules;
return rules;
}
return init();
@ -461,7 +449,7 @@ function matchVariablesViewProperty(aProp, aRule) {
displayValue == aRule.value;
if (!match) {
info("rule " + aRule.name + " did not match value, expected '" +
aRule.value + "', found '" + displayValue + "'");
aRule.value + "', found '" + displayValue + "'");
return resolve(false);
}
}

View File

@ -9,7 +9,7 @@ Bug 970517 - Storage inspector front end - tests
</head>
<body>
<script type="application/javascript;version=1.7">
"use strict";
let partialHostname = location.hostname.match(/^[^.]+(\..*)$/)[1];
let cookieExpiresTime = 2000000000000;
// Setting up some cookies to eat.
@ -20,7 +20,7 @@ document.cookie = "c1=" + JSON.stringify([
"; path=/browser";
document.cookie = "cs2=sessionCookie; path=/; domain=" + partialHostname;
// ... and some local storage items ..
var es6 = "for";
const es6 = "for";
localStorage.setItem("ls1", JSON.stringify({
es6, the: "win", baz: [0, 2, 3, {
deep: "down",
@ -42,7 +42,7 @@ window.idbGenerator = function*(callback) {
let request = indexedDB.open("idb1", 1);
request.onupgradeneeded = success;
request.onsuccess = success;
request.onerror = function(e) {
request.onerror = function() {
throw new Error("error opening db connection");
};
let event = yield undefined;
@ -58,7 +58,11 @@ window.idbGenerator = function*(callback) {
yield undefined;
store1.add({id: 3, name: "foo2", email: "foo3@bar.com"}).onsuccess = success;
yield undefined;
store2.add({id2: 1, name: "foo", email: "foo@bar.com", extra: "baz"}).onsuccess = success;
store2.add({
id2: 1,
name: "foo",
email: "foo@bar.com",
extra: "baz"}).onsuccess = success;
yield undefined;
yield undefined;

View File

@ -11,7 +11,7 @@ Bug 970517 - Storage inspector front end - tests
<iframe src="http://sectest1.example.org/browser/browser/devtools/storage/test/storage-unsecured-iframe.html"></iframe>
<iframe src="https://sectest1.example.org:443/browser/browser/devtools/storage/test/storage-secured-iframe.html"></iframe>
<script type="application/javascript;version=1.7">
"use strict";
let partialHostname = location.hostname.match(/^[^.]+(\..*)$/)[1];
let cookieExpiresTime1 = 2000000000000;
let cookieExpiresTime2 = 2000000001000;
@ -36,7 +36,7 @@ window.idbGenerator = function*(callback) {
let request = indexedDB.open("idb1", 1);
request.onupgradeneeded = success;
request.onsuccess = success;
request.onerror = function(e) {
request.onerror = function() {
throw new Error("error opening db connection");
};
let event = yield undefined;
@ -52,7 +52,11 @@ window.idbGenerator = function*(callback) {
yield undefined;
store1.add({id: 3, name: "foo2", email: "foo3@bar.com"}).onsuccess = success;
yield undefined;
store2.add({id2: 1, name: "foo", email: "foo@bar.com", extra: "baz"}).onsuccess = success;
store2.add({
id2: 1,
name: "foo",
email: "foo@bar.com",
extra: "baz"}).onsuccess = success;
yield undefined;
yield undefined;

View File

@ -8,7 +8,7 @@ Iframe for testing multiple host detetion in storage actor
</head>
<body>
<script type="application/javascript;version=1.7">
"use strict";
document.cookie = "sc1=foobar;";
localStorage.setItem("iframe-s-ls1", "foobar");
sessionStorage.setItem("iframe-s-ss1", "foobar-2");
@ -21,7 +21,7 @@ window.idbGenerator = function*(callback) {
let request = indexedDB.open("idb-s1", 1);
request.onupgradeneeded = success;
request.onsuccess = success;
request.onerror = function(e) {
request.onerror = function() {
throw new Error("error opening db connection");
};
let event = yield undefined;
@ -42,7 +42,8 @@ window.idbGenerator = function*(callback) {
event = yield undefined;
let db2 = event.target.result;
let store3 = db2.createObjectStore("obj-s2", { keyPath: "id3", autoIncrement: true });
let store3 =
db2.createObjectStore("obj-s2", { keyPath: "id3", autoIncrement: true });
store3.createIndex("name2", "name2", { unique: true });
store3.add({id3: 16, name2: "foo", email: "foo@bar.com"}).onsuccess = success;
yield undefined;

View File

@ -8,7 +8,7 @@ Iframe for testing multiple host detetion in storage actor
</head>
<body>
<script>
"use strict";
document.cookie = "uc1=foobar; domain=.example.org; path=/; secure=true";
localStorage.setItem("iframe-u-ls1", "foobar");
sessionStorage.setItem("iframe-u-ss1", "foobar1");

View File

@ -8,10 +8,10 @@ Bug 965872 - Storage inspector actor with cookies, local storage and session sto
<title>Storage inspector blank html for tests</title>
</head>
<body>
<script>
<script type="application/javascript;version=1.7">
"use strict";
window.addCookie = function(name, value, path, domain, expires, secure) {
var cookieString = name + "=" + value + ";";
let cookieString = name + "=" + value + ";";
if (path) {
cookieString += "path=" + path + ";";
}
@ -28,12 +28,13 @@ window.addCookie = function(name, value, path, domain, expires, secure) {
};
window.removeCookie = function(name, path) {
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=" + path;
}
document.cookie =
name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=" + path;
};
window.clear = function*(callback) {
var cookies = document.cookie;
for (var cookie of cookies.split(";")) {
window.clear = function*() {
let cookies = document.cookie;
for (let cookie of cookies.split(";")) {
removeCookie(cookie.split("=")[0]);
removeCookie(cookie.split("=")[0], "/browser");
}
@ -57,7 +58,7 @@ window.onload = function() {
sessionStorage.setItem("ss1", "foobar");
sessionStorage.setItem("ss2", "foobar");
sessionStorage.setItem("ss3", "foobar");
}
};
</script>
</body>
</html>

View File

@ -30,7 +30,8 @@ let L10N = new ViewHelpers.L10N(STORAGE_STRINGS);
const GENERIC_VARIABLES_VIEW_SETTINGS = {
lazyEmpty: true,
lazyEmptyDelay: 10, // ms
// ms
lazyEmptyDelay: 10,
searchEnabled: true,
searchPlaceholder: L10N.getStr("storage.search.placeholder"),
preventDescriptorModifiers: true
@ -53,7 +54,7 @@ const HIDDEN_COLUMNS = [
* @param {Window} panelWin
* Window of the toolbox panel to populate UI in.
*/
this.StorageUI = function StorageUI(front, target, panelWin) {
let StorageUI = this.StorageUI = function StorageUI(front, target, panelWin) {
EventEmitter.decorate(this);
this._target = target;
@ -72,7 +73,7 @@ this.StorageUI = function StorageUI(front, target, panelWin) {
highlightUpdated: true,
});
this.displayObjectSidebar = this.displayObjectSidebar.bind(this);
this.table.on(TableWidget.EVENTS.ROW_SELECTED, this.displayObjectSidebar)
this.table.on(TableWidget.EVENTS.ROW_SELECTED, this.displayObjectSidebar);
this.sidebar = this._panelDoc.getElementById("storage-sidebar");
this.sidebar.setAttribute("width", "300");
@ -93,7 +94,7 @@ this.StorageUI = function StorageUI(front, target, panelWin) {
this._telemetry = new Telemetry();
this._telemetry.toolOpened("storage");
}
};
exports.StorageUI = StorageUI;
@ -126,15 +127,13 @@ StorageUI.prototype = {
removeItemFromTable: function(name) {
if (this.table.isSelected(name)) {
if (this.table.selectedIndex == 0) {
this.table.selectNextRow()
}
else {
this.table.selectNextRow();
} else {
this.table.selectPreviousRow();
}
this.table.remove(name);
this.displayObjectSidebar();
}
else {
} else {
this.table.remove(name);
}
},
@ -190,8 +189,7 @@ StorageUI.prototype = {
}
this.tree.remove([type, host]);
}
else if (this.tree.isSelected([type, host])) {
} else if (this.tree.isSelected([type, host])) {
for (let name of deleted[type][host]) {
try {
// trying to parse names in case its for indexedDB
@ -203,12 +201,11 @@ StorageUI.prototype = {
this.table.clear();
this.hideSidebar();
}
}
else if (this.tree.isSelected([type, host, names[0], names[1]])) {
} else if (this.tree.isSelected([ type, host,
names[0], names[1]])) {
this.removeItemFromTable(names[2]);
}
}
catch (ex) {
} catch (ex) {
this.removeItemFromTable(name);
}
}
@ -232,7 +229,9 @@ StorageUI.prototype = {
this.tree.selectedItem = [type, host, name[0], name[1]];
this.fetchStorageObjects(type, host, [JSON.stringify(name)], 1);
}
} catch(ex) {}
} catch(ex) {
// Do nothing
}
}
if (this.tree.isSelected([type, host])) {
@ -255,8 +254,7 @@ StorageUI.prototype = {
}
}
this.fetchStorageObjects(type, host, toUpdate, 2);
}
catch (ex) {
} catch (ex) {
this.fetchStorageObjects(type, host, changed[type][host], 2);
}
}
@ -314,7 +312,6 @@ StorageUI.prototype = {
for (let host in storageTypes[type].hosts) {
this.tree.add([type, {id: host, type: "url"}]);
for (let name of storageTypes[type].hosts[host]) {
try {
let names = JSON.parse(name);
this.tree.add([type, host, ...names]);
@ -322,7 +319,9 @@ StorageUI.prototype = {
this.tree.selectedItem = [type, host, names[0], names[1]];
this.fetchStorageObjects(type, host, [name], 0);
}
} catch(ex) {}
} catch(ex) {
// Do nothing
}
}
if (!this.tree.selectedItem) {
this.tree.selectedItem = [type, host];
@ -371,7 +370,9 @@ StorageUI.prototype = {
// which may be available.
let rawObject = Object.create(null);
let otherProps =
itemProps.filter(e => e != "name" && e != "value" && e != "valueActor");
itemProps.filter(e => e != "name" &&
e != "value" &&
e != "valueActor");
for (let prop of otherProps) {
rawObject[prop] = item[prop];
}
@ -402,11 +403,10 @@ StorageUI.prototype = {
* The string to be parsed into an object
*/
parseItemValue: function(name, value) {
let json = null
let json = null;
try {
json = JSON.parse(value);
}
catch (ex) {
} catch (ex) {
json = null;
}
@ -426,9 +426,10 @@ StorageUI.prototype = {
}
let jsonObject = Object.create(null);
let view = this.view;
jsonObject[name] = json;
let valueScope = this.view.getScopeAtIndex(1) ||
this.view.addScope(L10N.getStr("storage.parsedValue.label"));
let valueScope = view.getScopeAtIndex(1) ||
view.addScope(L10N.getStr("storage.parsedValue.label"));
valueScope.expanded = true;
let jsonVar = valueScope.addItem("", Object.create(null), true);
jsonVar.expanded = true;
@ -562,8 +563,7 @@ StorageUI.prototype = {
}
if (reason < 2) {
this.table.push(item, reason == 0);
}
else {
} else {
this.table.update(item);
if (item == this.table.selectedRow && !this.sidebar.hidden) {
this.displayObjectSidebar();
@ -586,4 +586,4 @@ StorageUI.prototype = {
event.preventDefault();
}
}
}
};

View File

@ -4,7 +4,7 @@
"use strict";
const {Cu, Cc, Ci} = require("chrome");
const {Cc, Ci} = require("chrome");
const events = require("sdk/event/core");
const protocol = require("devtools/server/protocol");
try {
@ -14,7 +14,7 @@ try {
// we don't use it there anyway.
}
const {async} = require("devtools/async-utils");
const {Arg, Option, method, RetVal, types} = protocol;
const {Arg, method, RetVal, types} = protocol;
const {LongStringActor} = require("devtools/server/actors/string");
const {DebuggerServer} = require("devtools/server/main");
const Services = require("Services");
@ -442,7 +442,7 @@ StorageActors.createActor = function(options = {}, overrides = {}) {
}
let actor = protocol.ActorClass(actorObject);
let front = protocol.FrontClass(actor, {
protocol.FrontClass(actor, {
form: function(form, detail) {
if (detail === "actorid") {
this.actorID = form;
@ -1272,7 +1272,7 @@ StorageActors.createActor({
unresolvedPromises.set(methodName, deferred);
let reply = sendSyncMessage("storage:storage-indexedDB-request-parent", {
sendSyncMessage("storage:storage-indexedDB-request-parent", {
method: methodName,
args: args
});

View File

@ -31,7 +31,8 @@ const beforeReload = {
};
function finishTests(client) {
// Cleanup so that indexed db created from this test do not interfere next ones
// Cleanup so that indexed db created from this test do not interfere next
// ones.
/**
* This method iterates over iframes in a window and clears the indexed db
@ -41,11 +42,9 @@ function finishTests(client) {
if (w[i] && w[i].clear) {
w[i].clearIterator = w[i].clear(() => clearIDB(w, i + 1, c));
w[i].clearIterator.next();
}
else if (w[i] && w[i + 1]) {
} else if (w[i] && w[i + 1]) {
clearIDB(w, i + 1, c);
}
else {
} else {
c();
}
};
@ -60,7 +59,7 @@ function finishTests(client) {
gFront = gWindow = null;
finish();
});
}
};
gWindow.clearIterator = gWindow.clear(() => {
clearIDB(gWindow, 0, closeConnection);
});
@ -89,7 +88,7 @@ function testWindowsBeforeReload(data) {
function markOutMatched(toBeEmptied, data, deleted) {
if (!Object.keys(toBeEmptied).length) {
info("Object empty")
info("Object empty");
return;
}
ok(Object.keys(data).length,
@ -112,8 +111,7 @@ function markOutMatched(toBeEmptied, data, deleted) {
if (!toBeEmptied[storageType][host].length) {
delete toBeEmptied[storageType][host];
}
}
else {
} else {
delete toBeEmptied[storageType][host];
}
}
@ -257,7 +255,8 @@ function testRemoveIframe() {
markOutMatched(shouldBeEmpty, data.deleted, true);
ok(!data.deleted.cookies || !data.deleted.cookies["sectest1.example.org"],
"Nothing got deleted for Cookies as the same hostname is still present");
"Nothing got deleted for Cookies as " +
"the same hostname is still present");
ok(!data.changed || !data.changed.cookies ||
!data.changed.cookies["http://sectest1.example.org"],
@ -321,11 +320,9 @@ function test() {
if (w[i] && w[i].idbGenerator) {
w[i].setupIDB = w[i].idbGenerator(() => setupIDBInFrames(w, i + 1, c));
w[i].setupIDB.next();
}
else if (w[i] && w[i + 1]) {
} else if (w[i] && w[i + 1]) {
setupIDBInFrames(w, i + 1, c);
}
else {
} else {
c();
}
};

View File

@ -29,7 +29,7 @@ function finishTests(client) {
function markOutMatched(toBeEmptied, data, deleted) {
if (!Object.keys(toBeEmptied).length) {
info("Object empty")
info("Object empty");
return;
}
ok(Object.keys(data).length,

View File

@ -10,10 +10,10 @@ Bug 965872 - Storage inspector actor with cookies, local storage and session sto
<body>
<iframe src="http://sectest1.example.org/browser/toolkit/devtools/server/tests/browser/storage-unsecured-iframe.html"></iframe>
<script type="application/javascript;version=1.7">
var partialHostname = location.hostname.match(/^[^.]+(\..*)$/)[1];
var cookieExpiresTime1 = 2000000000000;
var cookieExpiresTime2 = 2000000001000;
"use strict";
const partialHostname = location.hostname.match(/^[^.]+(\..*)$/)[1];
const cookieExpiresTime1 = 2000000000000;
const cookieExpiresTime2 = 2000000001000;
// Setting up some cookies to eat.
document.cookie = "c1=foobar; expires=" +
new Date(cookieExpiresTime1).toGMTString() + "; path=/browser";
@ -34,7 +34,7 @@ window.idbGenerator = function*(callback) {
let request = indexedDB.open("idb1", 1);
request.onupgradeneeded = success;
request.onsuccess = success;
request.onerror = function(e) {
request.onerror = function() {
throw new Error("error opening db connection");
};
let event = yield undefined;
@ -50,7 +50,11 @@ window.idbGenerator = function*(callback) {
yield undefined;
store1.add({id: 3, name: "foo2", email: "foo3@bar.com"}).onsuccess = success;
yield undefined;
store2.add({id2: 1, name: "foo", email: "foo@bar.com", extra: "baz"}).onsuccess = success;
store2.add({
id2: 1,
name: "foo",
email: "foo@bar.com",
extra: "baz"}).onsuccess = success;
yield undefined;
yield undefined;
@ -68,7 +72,7 @@ window.idbGenerator = function*(callback) {
db2.close();
console.log("added cookies and stuff from main page");
callback();
}
};
function successClear(event) {
clearIterator.next(event);
@ -85,7 +89,7 @@ window.clear = function*(callback) {
yield undefined;
console.log("removed cookies and stuff from main page");
callback();
}
};
</script>
</body>
</html>

View File

@ -11,10 +11,10 @@ Bug 965872 - Storage inspector actor with cookies, local storage and session sto
<iframe src="http://sectest1.example.org/browser/toolkit/devtools/server/tests/browser/storage-unsecured-iframe.html"></iframe>
<iframe src="https://sectest1.example.org:443/browser/toolkit/devtools/server/tests/browser/storage-secured-iframe.html"></iframe>
<script type="application/javascript;version=1.7">
let partialHostname = location.hostname.match(/^[^.]+(\..*)$/)[1];
let cookieExpiresTime1 = 2000000000000;
let cookieExpiresTime2 = 2000000001000;
"use strict";
const partialHostname = location.hostname.match(/^[^.]+(\..*)$/)[1];
const cookieExpiresTime1 = 2000000000000;
const cookieExpiresTime2 = 2000000001000;
// Setting up some cookies to eat.
document.cookie = "c1=foobar; expires=" +
new Date(cookieExpiresTime1).toGMTString() + "; path=/browser";
@ -36,7 +36,7 @@ window.idbGenerator = function*(callback) {
let request = indexedDB.open("idb1", 1);
request.onupgradeneeded = success;
request.onsuccess = success;
request.onerror = function(e) {
request.onerror = function() {
throw new Error("error opening db connection");
};
let event = yield undefined;
@ -52,7 +52,11 @@ window.idbGenerator = function*(callback) {
yield undefined;
store1.add({id: 3, name: "foo2", email: "foo3@bar.com"}).onsuccess = success;
yield undefined;
store2.add({id2: 1, name: "foo", email: "foo@bar.com", extra: "baz"}).onsuccess = success;
store2.add({
id2: 1,
name: "foo",
email: "foo@bar.com",
extra: "baz"}).onsuccess = success;
yield undefined;
yield undefined;
@ -70,7 +74,7 @@ window.idbGenerator = function*(callback) {
db2.close();
console.log("added cookies and stuff from main page");
callback();
}
};
function successClear(event) {
clearIterator.next(event);
@ -85,9 +89,11 @@ window.clear = function*(callback) {
yield undefined;
indexedDB.deleteDatabase("idb2").onsuccess = successClear;
yield undefined;
console.log("removed cookies and stuff from main page");
dump("removed cookies, localStorage, sessionStorage and indexedDB data " +
"from " + document.location + "\n");
callback();
}
};
</script>
</body>
</html>

View File

@ -8,10 +8,10 @@ Bug 965872 - Storage inspector actor with cookies, local storage and session sto
<title>Storage inspector blank html for tests</title>
</head>
<body>
<script>
<script type="application/javascript;version=1.7">
"use strict";
window.addCookie = function(name, value, path, domain, expires, secure) {
var cookieString = name + "=" + value + ";";
let cookieString = name + "=" + value + ";";
if (path) {
cookieString += "path=" + path + ";";
}
@ -29,7 +29,7 @@ window.addCookie = function(name, value, path, domain, expires, secure) {
window.removeCookie = function(name) {
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
};
window.clear = function() {
var cookies = document.cookie;
@ -38,7 +38,7 @@ window.clear = function() {
}
localStorage.clear();
sessionStorage.clear();
}
};
</script>
</body>
</html>