Backed out changeset f5922a7ed25a (bug 1374620) for failing eslint at telemetry/tests/unit/test_TelemetrySend.js:358: ["os"] is better written in dot notation. r=backout

This commit is contained in:
Sebastian Hengst 2017-07-31 14:44:34 +02:00
Родитель 6a2188b226
Коммит 804a36e668
131 изменённых файлов: 604 добавлений и 592 удалений

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

@ -18,7 +18,7 @@ module.exports = {
"curly": ["error", "multi-line"],
"default-case": "off",
"dot-location": ["error", "property"],
"dot-notation": "error",
"eqeqeq": "off",
"func-names": "off",
"func-style": "off",
@ -87,6 +87,7 @@ module.exports = {
"wrap-iife": "off",
"wrap-regex": "off",
"yoda": "error",
"guard-for-in": "off",
"newline-after-var": "off",
"no-alert": "off",

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

@ -446,8 +446,8 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree, aFlags)
case "extraStates":
case "absentStates":
case "absentExtraStates": {
testStates(acc, accTree.states, accTree.extraStates,
accTree.absentStates, accTree.absentExtraStates);
testStates(acc, accTree["states"], accTree["extraStates"],
accTree["absentStates"], accTree["absentExtraStates"]);
break;
}
@ -483,7 +483,7 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree, aFlags)
}
// Test children.
if ("children" in accTree && accTree.children instanceof Array) {
if ("children" in accTree && accTree["children"] instanceof Array) {
var children = acc.children;
var childCount = children.length;

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

@ -205,7 +205,7 @@
// area7
ID = "area7";
defAttrs = buildDefaultTextAttrs(ID, "12pt");
defAttrs.language = "en";
defAttrs["language"] = "en";
testDefaultTextAttrs(ID, defAttrs);
attrs = {"language": "ru"};

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

@ -467,7 +467,7 @@
for (var role of aRoleList) {
var ch = {};
ch[role] = [];
tree.SECTION.push(ch);
tree["SECTION"].push(ch);
}
testAccessibleTree(aContainer, tree);
}

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

@ -142,12 +142,12 @@ var gGestureSupport = {
offset += updateEvent.delta;
// Check if the cumulative deltas exceed the threshold
if (Math.abs(offset) > aPref.threshold) {
if (Math.abs(offset) > aPref["threshold"]) {
// Trigger the action if we don't care about latching; otherwise, make
// sure either we're not latched and going the same direction of the
// initial motion; or we're latched and going the opposite way
let sameDir = (latchDir ^ offset) >= 0;
if (!aPref.latched || (isLatched ^ sameDir)) {
if (!aPref["latched"] || (isLatched ^ sameDir)) {
this._doAction(updateEvent, [aGesture, offset > 0 ? aInc : aDec]);
// We must be getting latched or leaving it, so just toggle

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

@ -12,16 +12,16 @@ const fm = Services.focus;
function EventStore() {
this["main-window"] = [];
this.window1 = [];
this.window2 = [];
this["window1"] = [];
this["window2"] = [];
}
EventStore.prototype = {
"push": function(event) {
if (event.indexOf("1") > -1) {
this.window1.push(event);
this["window1"].push(event);
} else if (event.indexOf("2") > -1) {
this.window2.push(event);
this["window2"].push(event);
} else {
this["main-window"].push(event);
}
@ -543,7 +543,7 @@ function expectFocusShift(callback, expectedWindow, expectedElement, focusChange
callback();
// No events are expected, so resolve the promise immediately.
if (expectedEvents["main-window"].length + expectedEvents.window1.length + expectedEvents.window2.length == 0) {
if (expectedEvents["main-window"].length + expectedEvents["window1"].length + expectedEvents["window2"].length == 0) {
currentPromiseResolver();
currentPromiseResolver = null;
}

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

@ -732,13 +732,13 @@ function openPreferences(paneID, extraArgs) {
histogram.add("other");
}
function switchToAdvancedSubPane(doc) {
if (extraArgs && extraArgs.advancedTab) {
if (extraArgs && extraArgs["advancedTab"]) {
// After the Preferences reorg works in Bug 1335907, no more advancedPrefs element.
// The old Preference is pref-off behind `browser.preferences.useOldOrganization` on Nightly.
// During the transition between the old and new Preferences, should do checking before proceeding.
let advancedPaneTabs = doc.getElementById("advancedPrefs");
if (advancedPaneTabs) {
advancedPaneTabs.selectedTab = doc.getElementById(extraArgs.advancedTab);
advancedPaneTabs.selectedTab = doc.getElementById(extraArgs["advancedTab"]);
}
}
}
@ -751,9 +751,9 @@ function openPreferences(paneID, extraArgs) {
let win = Services.wm.getMostRecentWindow("navigator:browser");
let friendlyCategoryName = internalPrefCategoryNameToFriendlyName(paneID);
let params;
if (extraArgs && extraArgs.urlParams) {
if (extraArgs && extraArgs["urlParams"]) {
params = new URLSearchParams();
let urlParams = extraArgs.urlParams;
let urlParams = extraArgs["urlParams"];
for (let name in urlParams) {
if (urlParams[name] !== undefined) {
params.set(name, urlParams[name]);

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

@ -66,8 +66,8 @@ add_task(async function test_cookie_getCookiesWithOriginAttributes() {
ok(enumerator.hasMoreElements(), "Cookies available");
let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
is(foundCookie.name, cookieName, "Check cookie name");
is(foundCookie.value, USER_CONTEXTS[userContextId], "Check cookie value");
is(foundCookie["name"], cookieName, "Check cookie name");
is(foundCookie["value"], USER_CONTEXTS[userContextId], "Check cookie value");
}
// Using getCookiesWithOriginAttributes() to get all cookies for a certain

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

@ -145,8 +145,8 @@ async function test_cookie_cleared() {
ok(enumerator.hasMoreElements(), "Cookies available");
let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
Assert.equal(foundCookie.name, COOKIE_NAME, "Check cookie name");
Assert.equal(foundCookie.value, USER_CONTEXTS[userContextId], "Check cookie value");
Assert.equal(foundCookie["name"], COOKIE_NAME, "Check cookie name");
Assert.equal(foundCookie["value"], USER_CONTEXTS[userContextId], "Check cookie value");
}
// Forget the site.

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

@ -57,8 +57,8 @@ function checkCookies(ignoreContext = null) {
ok(enumerator.hasMoreElements(), "Cookies available");
let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
is(foundCookie.name, COOKIE_NAME, "Check cookie name");
is(foundCookie.value, USER_CONTEXTS[userContextId], "Check cookie value");
is(foundCookie["name"], COOKIE_NAME, "Check cookie name");
is(foundCookie["value"], USER_CONTEXTS[userContextId], "Check cookie value");
}
}
@ -95,8 +95,8 @@ add_task(async function test_cookie_getCookiesWithOriginAttributes() {
ok(enumerator.hasMoreElements(), "Cookies available");
let foundCookie = enumerator.getNext().QueryInterface(Ci.nsICookie2);
is(foundCookie.name, COOKIE_NAME, "Check cookie name");
is(foundCookie.value, USER_CONTEXTS[userContextId], "Check cookie value");
is(foundCookie["name"], COOKIE_NAME, "Check cookie name");
is(foundCookie["value"], USER_CONTEXTS[userContextId], "Check cookie value");
}
checkCookies();

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

@ -555,7 +555,7 @@ var CustomizableUIInternal = {
if (props.get("type") == CustomizableUI.TYPE_TOOLBAR) {
// Check aProperties instead of props because this check is only interested
// in the passed arguments, not the state of a potentially pre-existing area.
if (!aInternalCaller && aProperties.defaultCollapsed) {
if (!aInternalCaller && aProperties["defaultCollapsed"]) {
throw new Error("defaultCollapsed is only allowed for default toolbars.")
}
if (!props.has("defaultCollapsed")) {

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

@ -2552,7 +2552,7 @@ function __dumpDragData(aEvent, caller) {
return;
}
let str = "Dumping drag data (" + (caller ? caller + " in " : "") + "CustomizeMode.jsm) {\n";
str += " type: " + aEvent.type + "\n";
str += " type: " + aEvent["type"] + "\n";
for (let el of ["target", "currentTarget", "relatedTarget"]) {
if (aEvent[el]) {
str += " " + el + ": " + aEvent[el] + "(localName=" + aEvent[el].localName + "; id=" + aEvent[el].id + ")\n";

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

@ -117,7 +117,7 @@ DistributionCustomizer.prototype = {
items[itemIndex] = {};
items[itemIndex][iprop] = this._ini.getString(section, key);
if (iprop == "type" && items[itemIndex].type == "default")
if (iprop == "type" && items[itemIndex]["type"] == "default")
defaultIndex = itemIndex;
if (maxIndex < itemIndex)
@ -264,11 +264,11 @@ DistributionCustomizer.prototype = {
// The global section, and several of its fields, is required
// (we also check here to be consistent with applyPrefDefaults below)
if (!sections.Global)
if (!sections["Global"])
return;
let globalPrefs = enumToObject(this._ini.getKeys("Global"));
if (!(globalPrefs.id && globalPrefs.version && globalPrefs.about))
if (!(globalPrefs["id"] && globalPrefs["version"] && globalPrefs["about"]))
return;
let bmProcessedPref;
@ -283,10 +283,10 @@ DistributionCustomizer.prototype = {
let bmProcessed = this._prefs.getBoolPref(bmProcessedPref, false);
if (!bmProcessed) {
if (sections.BookmarksMenu)
if (sections["BookmarksMenu"])
await this._parseBookmarksSection(PlacesUtils.bookmarks.menuGuid,
"BookmarksMenu");
if (sections.BookmarksToolbar)
if (sections["BookmarksToolbar"])
await this._parseBookmarksSection(PlacesUtils.bookmarks.toolbarGuid,
"BookmarksToolbar");
this._prefs.setBoolPref(bmProcessedPref, true);
@ -302,10 +302,10 @@ DistributionCustomizer.prototype = {
let sections = enumToObject(this._ini.getSections());
// The global section, and several of its fields, is required
if (!sections.Global)
if (!sections["Global"])
return this._checkCustomizationComplete();
let globalPrefs = enumToObject(this._ini.getKeys("Global"));
if (!(globalPrefs.id && globalPrefs.version && globalPrefs.about))
if (!(globalPrefs["id"] && globalPrefs["version"] && globalPrefs["about"]))
return this._checkCustomizationComplete();
let defaults = new Preferences({defaultBranch: true});
@ -360,7 +360,7 @@ DistributionCustomizer.prototype = {
}
}
if (sections.Preferences) {
if (sections["Preferences"]) {
for (let key of enumerate(this._ini.getKeys("Preferences"))) {
if (usedPreferences.indexOf(key) > -1) {
continue;
@ -412,7 +412,7 @@ DistributionCustomizer.prototype = {
}
}
if (sections.LocalizablePreferences) {
if (sections["LocalizablePreferences"]) {
for (let key of enumerate(this._ini.getKeys("LocalizablePreferences"))) {
if (usedLocalizablePreferences.indexOf(key) > -1) {
continue;

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

@ -5,6 +5,7 @@ module.exports = {
"block-scoped-var": "error",
"comma-dangle": "off",
"complexity": ["error", {"max": 21}],
"dot-notation": "error",
"indent": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
"max-nested-callbacks": ["error", 3],
"new-parens": "error",

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

@ -1899,7 +1899,7 @@ BrowserGlue.prototype = {
// Typed behavior will be used only for results from history.
if (defaultBehavior != -1 &&
!!(defaultBehavior & Ci.mozIPlacesAutoComplete.BEHAVIOR_TYPED)) {
!!(defaultBehavior & Ci.mozIPlacesAutoComplete["BEHAVIOR_TYPED"])) {
Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", true);
}
}

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

@ -16,7 +16,7 @@
}
try {
let openerFrame = window.opener.frames.child;
let openerFrame = window.opener.frames["child"];
let result = openerFrame.document.cookie === cookieValue;
if (result && !openerRestriction) {
document.title = "pass";

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

@ -1360,7 +1360,7 @@ this.PlacesUIUtils = {
// ensure the left-pane root is initialized;
this.leftPaneFolderId;
delete this.allBookmarksFolderId;
return this.allBookmarksFolderId = this.leftPaneQueries.AllBookmarks;
return this.allBookmarksFolderId = this.leftPaneQueries["AllBookmarks"];
},
/**

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

@ -427,37 +427,37 @@ PlacesController.prototype = {
// property way too often
switch (nodeType) {
case Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY:
nodeData.query = true;
nodeData["query"] = true;
if (node.parent) {
switch (PlacesUtils.asQuery(node.parent).queryOptions.resultType) {
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
nodeData.host = true;
nodeData["host"] = true;
break;
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
nodeData.day = true;
nodeData["day"] = true;
break;
}
}
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER:
case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT:
nodeData.folder = true;
nodeData["folder"] = true;
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR:
nodeData.separator = true;
nodeData["separator"] = true;
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_URI:
nodeData.link = true;
nodeData["link"] = true;
uri = NetUtil.newURI(node.uri);
if (PlacesUtils.nodeIsBookmark(node)) {
nodeData.bookmark = true;
nodeData["bookmark"] = true;
var parentNode = node.parent;
if (parentNode) {
if (PlacesUtils.nodeIsTagQuery(parentNode))
nodeData.tagChild = true;
nodeData["tagChild"] = true;
else if (this.hasCachedLivemarkInfo(parentNode))
nodeData.livemarkChild = true;
nodeData["livemarkChild"] = true;
}
}
break;

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

@ -283,9 +283,9 @@ var PlacesOrganizer = {
let itemId = aNode.itemId;
if (PlacesUtils.nodeIsHistoryContainer(aNode) ||
itemId == PlacesUIUtils.leftPaneQueries.History) {
itemId == PlacesUIUtils.leftPaneQueries["History"]) {
PlacesQueryBuilder.setScope("history");
} else if (itemId == PlacesUIUtils.leftPaneQueries.Downloads) {
} else if (itemId == PlacesUIUtils.leftPaneQueries["Downloads"]) {
PlacesQueryBuilder.setScope("downloads");
} else {
// Default to All Bookmarks for all other nodes, per bug 469437.

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

@ -83,7 +83,7 @@ add_task(async function() {
// Check left pane is populated.
organizer.PlacesOrganizer.selectLeftPaneQuery("History");
is(organizer.PlacesOrganizer._places.selectedNode.itemId,
PlacesUIUtils.leftPaneQueries.History,
PlacesUIUtils.leftPaneQueries["History"],
"Library left pane is populated and working");
await promiseLibraryClosed(organizer);

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

@ -4,7 +4,7 @@ add_task(async function() {
info("Add a live bookmark editing its data");
await withSidebarTree("bookmarks", async function(tree) {
let itemId = PlacesUIUtils.leftPaneQueries.UnfiledBookmarks;
let itemId = PlacesUIUtils.leftPaneQueries["UnfiledBookmarks"];
tree.selectItems([itemId]);
await withBookmarksDialog(

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

@ -4,7 +4,7 @@ add_task(async function() {
info("Bug 479348 - Properties on a root should be read-only.");
await withSidebarTree("bookmarks", async function(tree) {
let itemId = PlacesUIUtils.leftPaneQueries.UnfiledBookmarks;
let itemId = PlacesUIUtils.leftPaneQueries["UnfiledBookmarks"];
tree.selectItems([itemId]);
ok(tree.controller.isCommandEnabled("placesCmd_show:info"),
"'placesCmd_show:info' on current selected node is enabled");

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

@ -37,13 +37,13 @@ var testCases = [
},
function historyScope() {
let defScope = getDefaultScope(PlacesUIUtils.leftPaneQueries.History);
search(PlacesUIUtils.leftPaneQueries.History, "dummy", defScope);
let defScope = getDefaultScope(PlacesUIUtils.leftPaneQueries["History"]);
search(PlacesUIUtils.leftPaneQueries["History"], "dummy", defScope);
},
function downloadsScope() {
let defScope = getDefaultScope(PlacesUIUtils.leftPaneQueries.Downloads);
search(PlacesUIUtils.leftPaneQueries.Downloads, "dummy", defScope);
let defScope = getDefaultScope(PlacesUIUtils.leftPaneQueries["Downloads"]);
search(PlacesUIUtils.leftPaneQueries["Downloads"], "dummy", defScope);
},
];
@ -56,9 +56,9 @@ var testCases = [
*/
function getDefaultScope(aFolderId) {
switch (aFolderId) {
case PlacesUIUtils.leftPaneQueries.History:
case PlacesUIUtils.leftPaneQueries["History"]:
return "scopeBarHistory"
case PlacesUIUtils.leftPaneQueries.Downloads:
case PlacesUIUtils.leftPaneQueries["Downloads"]:
return "scopeBarDownloads";
default:
return "scopeBarAll";
@ -116,8 +116,8 @@ function search(aFolderId, aSearchStr, aExpectedScopeButtonId) {
// getFolders() on a History query returns an empty array, so no use
// comparing against aFolderId in that case.
if (aFolderId !== PlacesUIUtils.leftPaneQueries.History &&
aFolderId !== PlacesUIUtils.leftPaneQueries.Downloads) {
if (aFolderId !== PlacesUIUtils.leftPaneQueries["History"] &&
aFolderId !== PlacesUIUtils.leftPaneQueries["Downloads"]) {
// contentTree.place should be equal to contentTree.result.root.uri,
// but it's not until bug 476952 is fixed.
let query = queryStringToQuery(contentTree.result.root.uri);

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

@ -214,8 +214,8 @@ var gCookiesWindow = {
var cacheIndex = Math.min(this._cacheValid, aIndex);
if (cacheIndex > 0) {
var cacheItem = this._cacheItems[cacheIndex];
start = cacheItem.start;
count = hostIndex = cacheItem.count;
start = cacheItem["start"];
count = hostIndex = cacheItem["count"];
}
for (let i = start; i < gCookiesWindow._hostOrder.length; ++i) { // var host in gCookiesWindow._hosts) {

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

@ -8,20 +8,20 @@
function collect() {
let result = {};
result.appCodeName = navigator.appCodeName;
result.appName = navigator.appName;
result.appVersion = navigator.appVersion;
result.platform = navigator.platform;
result.userAgent = navigator.userAgent;
result.product = navigator.product;
result.productSub = navigator.productSub;
result.vendor = navigator.vendor;
result.vendorSub = navigator.vendorSub;
result.mimeTypesLength = navigator.mimeTypes.length;
result.pluginsLength = navigator.plugins.length;
result.oscpu = navigator.oscpu;
result.buildID = navigator.buildID;
result.hardwareConcurrency = navigator.hardwareConcurrency;
result["appCodeName"] = navigator.appCodeName;
result["appName"] = navigator.appName;
result["appVersion"] = navigator.appVersion;
result["platform"] = navigator.platform;
result["userAgent"] = navigator.userAgent;
result["product"] = navigator.product;
result["productSub"] = navigator.productSub;
result["vendor"] = navigator.vendor;
result["vendorSub"] = navigator.vendorSub;
result["mimeTypesLength"] = navigator.mimeTypes.length;
result["pluginsLength"] = navigator.plugins.length;
result["oscpu"] = navigator.oscpu;
result["buildID"] = navigator.buildID;
result["hardwareConcurrency"] = navigator.hardwareConcurrency;
// eslint-disable-next-line no-unsanitized/property
document.getElementById("result").innerHTML = JSON.stringify(result);

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

@ -6,13 +6,13 @@ onconnect = function(e) {
let navigatorObj = self.navigator;
let result = {};
result.appCodeName = navigatorObj.appCodeName;
result.appName = navigatorObj.appName;
result.appVersion = navigatorObj.appVersion;
result.platform = navigatorObj.platform;
result.userAgent = navigatorObj.userAgent;
result.product = navigatorObj.product;
result.hardwareConcurrency = navigatorObj.hardwareConcurrency;
result["appCodeName"] = navigatorObj.appCodeName;
result["appName"] = navigatorObj.appName;
result["appVersion"] = navigatorObj.appVersion;
result["platform"] = navigatorObj.platform;
result["userAgent"] = navigatorObj.userAgent;
result["product"] = navigatorObj.product;
result["hardwareConcurrency"] = navigatorObj.hardwareConcurrency;
port.postMessage(JSON.stringify(result));
port.start();

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

@ -13,6 +13,6 @@ storageTestItem = <span id="storageTestItem">FAIL</span>
<script type="application/javascript">
document.getElementById("storageTestItem").textContent =
sessionStorage.storageTestItem || "PENDING";
sessionStorage.storageTestItem = "SUCCESS";
sessionStorage["storageTestItem"] || "PENDING";
sessionStorage["storageTestItem"] = "SUCCESS";
</script>

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

@ -57,15 +57,15 @@ async function checkState(prefix, tab) {
await TabStateFlusher.flush(tab.linkedBrowser);
let {formdata} = JSON.parse(ss.getTabState(tab));
ok(formdata.id.sessionData, prefix + ": we have form data for about:sessionrestore");
ok(formdata.id["sessionData"], prefix + ": we have form data for about:sessionrestore");
let sessionData_raw = JSON.stringify(formdata.id.sessionData);
let sessionData_raw = JSON.stringify(formdata.id["sessionData"]);
ok(!/\\/.test(sessionData_raw), prefix + ": #sessionData contains no backslashes");
info(sessionData_raw);
let gotError = false;
try {
JSON.parse(formdata.id.sessionData);
JSON.parse(formdata.id["sessionData"]);
} catch (e) {
info(prefix + ": got error: " + e);
gotError = true;

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

@ -13,7 +13,7 @@ function test() {
promiseBrowserLoaded(tab.linkedBrowser).then(() => {
ss.setTabValue(tab, "bug485563", uniqueValue);
let tabState = JSON.parse(ss.getTabState(tab));
is(tabState.extData.bug485563, uniqueValue,
is(tabState.extData["bug485563"], uniqueValue,
"unicode line separator wasn't over-encoded");
ss.deleteTabValue(tab, "bug485563");
ss.setTabState(tab, JSON.stringify(tabState));

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

@ -67,7 +67,7 @@ function test() {
for (let i = gBrowser.tabs.length - 1; i >= 0; i--) {
let tab = gBrowser.tabs[i];
let actualUniq = ss.getTabValue(tab, "uniq");
let expectedUniq = state.windows[0].tabs[i].extData.uniq;
let expectedUniq = state.windows[0].tabs[i].extData["uniq"];
if (wasLoaded[actualUniq]) {
info("tab " + i + ": already restored");

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

@ -27,7 +27,7 @@ add_task(async function() {
let tabState = state.windows[0].tabs[i];
let tabCurState = curState.windows[0].tabs[i];
if (tabState.extData) {
is(tabCurState.extData.uniq, tabState.extData.uniq,
is(tabCurState.extData["uniq"], tabState.extData["uniq"],
"sanity check that tab has correct extData");
} else {
// We aren't expecting there to be any data on extData, but panorama

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

@ -26,7 +26,7 @@ function test() {
is(browser.__SS_restoreState, TAB_STATE_NEEDS_RESTORE, "tab needs restoring");
let {formdata} = JSON.parse(ss.getTabState(tab));
is(formdata && formdata.id.foo, "bar", "tab state's formdata is valid");
is(formdata && formdata.id["foo"], "bar", "tab state's formdata is valid");
promiseTabRestored(tab).then(() => {
ContentTask.spawn(browser, null, function() {

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

@ -13,9 +13,9 @@ const OUTER_VALUE = "outer-value-" + RAND;
function getEstimateChars() {
let snap;
if (gMultiProcessBrowser) {
snap = Services.telemetry.histogramSnapshots.content.FX_SESSION_RESTORE_DOM_STORAGE_SIZE_ESTIMATE_CHARS;
snap = Services.telemetry.histogramSnapshots.content["FX_SESSION_RESTORE_DOM_STORAGE_SIZE_ESTIMATE_CHARS"];
} else {
snap = Services.telemetry.histogramSnapshots.parent.FX_SESSION_RESTORE_DOM_STORAGE_SIZE_ESTIMATE_CHARS;
snap = Services.telemetry.histogramSnapshots.parent["FX_SESSION_RESTORE_DOM_STORAGE_SIZE_ESTIMATE_CHARS"];
}
if (!snap) {
return 0;

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

@ -154,7 +154,7 @@ var gSetBackground = {
};
if (AppConstants.platform != "macosx") {
gSetBackground._initColor = function() {
gSetBackground["_initColor"] = function() {
var color = this._shell.desktopBackgroundColor;
const rMask = 4294901760;
@ -169,24 +169,24 @@ if (AppConstants.platform != "macosx") {
colorpicker.color = this._backgroundColor;
};
gSetBackground.updateColor = function(aColor) {
gSetBackground["updateColor"] = function(aColor) {
this._backgroundColor = aColor;
this._canvas.style.backgroundColor = aColor;
};
// Converts a color string in the format "#RRGGBB" to an integer.
gSetBackground._hexStringToLong = function(aString) {
gSetBackground["_hexStringToLong"] = function(aString) {
return parseInt(aString.substring(1, 3), 16) << 16 |
parseInt(aString.substring(3, 5), 16) << 8 |
parseInt(aString.substring(5, 7), 16);
};
gSetBackground._rgbToHex = function(aR, aG, aB) {
gSetBackground["_rgbToHex"] = function(aR, aG, aB) {
return "#" + [aR, aG, aB].map(aInt => aInt.toString(16).replace(/^(.)$/, "0$1"))
.join("").toUpperCase();
};
} else {
gSetBackground.observe = function(aSubject, aTopic, aData) {
gSetBackground["observe"] = function(aSubject, aTopic, aData) {
if (aTopic == "shell:desktop-background-changed") {
document.getElementById("setDesktopBackground").hidden = true;
document.getElementById("showDesktopPreferences").hidden = false;
@ -197,7 +197,7 @@ if (AppConstants.platform != "macosx") {
}
};
gSetBackground.showDesktopPrefs = function() {
gSetBackground["showDesktopPrefs"] = function() {
this._shell.openApplication(Ci.nsIMacShellService.APPLICATION_DESKTOP);
};
}

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

@ -1584,7 +1584,7 @@ this.UITour = {
// Services.appinfo.distributionID (value of MOZ_DISTRIBUTION_ID is set at build time).
let distribution =
Services.prefs.getDefaultBranch("distribution.").getCharPref("id", "default");
appinfo.distribution = distribution;
appinfo["distribution"] = distribution;
let isDefaultBrowser = null;
try {
@ -1593,7 +1593,7 @@ this.UITour = {
isDefaultBrowser = shell.isDefaultBrowser(false);
}
} catch (e) {}
appinfo.defaultBrowser = isDefaultBrowser;
appinfo["defaultBrowser"] = isDefaultBrowser;
let canSetDefaultBrowserInBackground = true;
if (AppConstants.isPlatformAndVersionAtLeast("win", "6.2") ||
@ -1608,7 +1608,7 @@ this.UITour = {
}
}
appinfo.canSetDefaultBrowserInBackground =
appinfo["canSetDefaultBrowserInBackground"] =
canSetDefaultBrowserInBackground;
// Expose Profile creation and last reset dates in weeks.
@ -1621,8 +1621,8 @@ this.UITour = {
if (resetDate) {
resetWeeksAgo = Math.floor((Date.now() - resetDate) / ONE_WEEK);
}
appinfo.profileCreatedWeeksAgo = createdWeeksAgo;
appinfo.profileResetWeeksAgo = resetWeeksAgo;
appinfo["profileCreatedWeeksAgo"] = createdWeeksAgo;
appinfo["profileResetWeeksAgo"] = resetWeeksAgo;
this.sendPageCallback(aMessageManager, aCallbackID, appinfo);
})().catch(err => {

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

@ -388,7 +388,7 @@ add_task(async function test_expiration() {
// Test that experiments that are cached locally but never ran are removed from cache
// when they are removed from the manifest (this is cached data, not really history).
gManifestObject.experiments = gManifestObject.experiments.slice(1, 1);
gManifestObject["experiments"] = gManifestObject["experiments"].slice(1, 1);
await experiments.updateManifest();
validateCache([...experiments._experiments.keys()], [EXPERIMENT2_ID]);

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

@ -70,6 +70,9 @@ module.exports = {
// Enforce dots on the next line with property name.
"dot-location": ["error", "property"],
// Encourage the use of dot notation whenever possible.
"dot-notation": "error",
// Maximum length of a line.
// This should be 100 but too many lines were longer than that so set a
// conservative upper bound for now.

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

@ -174,12 +174,12 @@ var pktApi = (function() {
var pocketCookies = getCookiesFromPocket();
// If no cookie was found just return undefined
if (typeof pocketCookies.ftv1 === "undefined") {
if (typeof pocketCookies["ftv1"] === "undefined") {
return undefined;
}
// Check if a new user logged in in the meantime and clearUserData if so
var sessionId = pocketCookies.fsv1;
var sessionId = pocketCookies["fsv1"];
var lastSessionId = getSetting("fsv1");
if (sessionId !== lastSessionId) {
clearUserData();
@ -187,7 +187,7 @@ var pktApi = (function() {
}
// Return access token
return pocketCookies.ftv1;
return pocketCookies["ftv1"];
}
/**
@ -199,7 +199,7 @@ var pktApi = (function() {
if (typeof premiumStatus === "undefined") {
// Premium status is not in settings try get it from cookie
var pocketCookies = getCookiesFromPocket();
premiumStatus = pocketCookies.ps;
premiumStatus = pocketCookies["ps"];
}
return premiumStatus;
}

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

@ -24,7 +24,7 @@ function experimentFactory(attrs) {
// clearAllExperimentStorage
add_task(withMockExperiments(async function(experiments) {
experiments.test = experimentFactory({name: "test"});
experiments["test"] = experimentFactory({name: "test"});
ok(await PreferenceExperiments.has("test"), "Mock experiment is detected.");
await PreferenceExperiments.clearAllExperimentStorage();
ok(
@ -35,7 +35,7 @@ add_task(withMockExperiments(async function(experiments) {
// start should throw if an experiment with the given name already exists
add_task(withMockExperiments(async function(experiments) {
experiments.test = experimentFactory({name: "test"});
experiments["test"] = experimentFactory({name: "test"});
await Assert.rejects(
PreferenceExperiments.start({
name: "test",
@ -51,7 +51,7 @@ add_task(withMockExperiments(async function(experiments) {
// start should throw if an experiment for the given preference is active
add_task(withMockExperiments(async function(experiments) {
experiments.test = experimentFactory({name: "test", preferenceName: "fake.preference"});
experiments["test"] = experimentFactory({name: "test", preferenceName: "fake.preference"});
await Assert.rejects(
PreferenceExperiments.start({
name: "different",
@ -308,10 +308,10 @@ add_task(withMockExperiments(async function() {
// markLastSeen should update the lastSeen date
add_task(withMockExperiments(async function(experiments) {
const oldDate = new Date(1988, 10, 1).toJSON();
experiments.test = experimentFactory({name: "test", lastSeen: oldDate});
experiments["test"] = experimentFactory({name: "test", lastSeen: oldDate});
await PreferenceExperiments.markLastSeen("test");
Assert.notEqual(
experiments.test.lastSeen,
experiments["test"].lastSeen,
oldDate,
"markLastSeen updated the experiment lastSeen date",
);
@ -327,7 +327,7 @@ add_task(withMockExperiments(async function() {
// stop should throw if the experiment is already expired
add_task(withMockExperiments(async function(experiments) {
experiments.test = experimentFactory({name: "test", expired: true});
experiments["test"] = experimentFactory({name: "test", expired: true});
await Assert.rejects(
PreferenceExperiments.stop("test"),
"stop threw an error because the experiment was already expired",
@ -340,7 +340,7 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments, moc
const stopObserver = sinon.spy(PreferenceExperiments, "stopObserver");
mockPreferences.set("fake.preference", "experimentvalue", "default");
experiments.test = experimentFactory({
experiments["test"] = experimentFactory({
name: "test",
expired: false,
preferenceName: "fake.preference",
@ -353,7 +353,7 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments, moc
await PreferenceExperiments.stop("test");
ok(stopObserver.calledWith("test"), "stop removed an observer");
is(experiments.test.expired, true, "stop marked the experiment as expired");
is(experiments["test"].expired, true, "stop marked the experiment as expired");
is(
DefaultPreferences.get("fake.preference"),
"oldvalue",
@ -368,7 +368,7 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments, moc
add_task(withMockExperiments(withMockPreferences(async function(experiments, mockPreferences) {
const stopObserver = sinon.stub(PreferenceExperiments, "stopObserver");
mockPreferences.set("fake.preference", "experimentvalue", "user");
experiments.test = experimentFactory({
experiments["test"] = experimentFactory({
name: "test",
expired: false,
preferenceName: "fake.preference",
@ -381,7 +381,7 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments, moc
await PreferenceExperiments.stop("test");
ok(stopObserver.calledWith("test"), "stop removed an observer");
is(experiments.test.expired, true, "stop marked the experiment as expired");
is(experiments["test"].expired, true, "stop marked the experiment as expired");
is(
Preferences.get("fake.preference"),
"oldvalue",
@ -394,7 +394,7 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments, moc
// stop should not call stopObserver if there is no observer registered.
add_task(withMockExperiments(withMockPreferences(async function(experiments) {
const stopObserver = sinon.spy(PreferenceExperiments, "stopObserver");
experiments.test = experimentFactory({name: "test", expired: false});
experiments["test"] = experimentFactory({name: "test", expired: false});
await PreferenceExperiments.stop("test");
ok(!stopObserver.called, "stop did not bother to stop an observer that wasn't active");
@ -407,7 +407,7 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments) {
add_task(withMockExperiments(withMockPreferences(async function(experiments, mockPreferences) {
const stopObserver = sinon.stub(PreferenceExperiments, "stopObserver");
mockPreferences.set("fake.preference", "experimentvalue", "user");
experiments.test = experimentFactory({
experiments["test"] = experimentFactory({
name: "test",
expired: false,
preferenceName: "fake.preference",
@ -430,7 +430,7 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments, moc
add_task(withMockExperiments(withMockPreferences(async function(experiments, mockPreferences) {
const stopObserver = sinon.stub(PreferenceExperiments, "stopObserver");
mockPreferences.set("fake.preference", "customvalue", "default");
experiments.test = experimentFactory({
experiments["test"] = experimentFactory({
name: "test",
expired: false,
preferenceName: "fake.preference",
@ -461,21 +461,21 @@ add_task(withMockExperiments(async function() {
// get
add_task(withMockExperiments(async function(experiments) {
const experiment = experimentFactory({name: "test"});
experiments.test = experiment;
experiments["test"] = experiment;
const fetchedExperiment = await PreferenceExperiments.get("test");
Assert.deepEqual(fetchedExperiment, experiment, "get fetches the correct experiment");
// Modifying the fetched experiment must not edit the data source.
fetchedExperiment.name = "othername";
is(experiments.test.name, "test", "get returns a copy of the experiment");
is(experiments["test"].name, "test", "get returns a copy of the experiment");
}));
add_task(withMockExperiments(async function testGetAll(experiments) {
const experiment1 = experimentFactory({name: "experiment1"});
const experiment2 = experimentFactory({name: "experiment2", disabled: true});
experiments.experiment1 = experiment1;
experiments.experiment2 = experiment2;
experiments["experiment1"] = experiment1;
experiments["experiment2"] = experiment2;
const fetchedExperiments = await PreferenceExperiments.getAll();
is(fetchedExperiments.length, 2, "getAll returns a list of all stored experiments");
@ -496,11 +496,11 @@ add_task(withMockExperiments(async function testGetAll(experiments) {
}));
add_task(withMockExperiments(withMockPreferences(async function testGetAllActive(experiments) {
experiments.active = experimentFactory({
experiments["active"] = experimentFactory({
name: "active",
expired: false,
});
experiments.inactive = experimentFactory({
experiments["inactive"] = experimentFactory({
name: "inactive",
expired: true,
});
@ -508,13 +508,13 @@ add_task(withMockExperiments(withMockPreferences(async function testGetAllActive
const activeExperiments = await PreferenceExperiments.getAllActive();
Assert.deepEqual(
activeExperiments,
[experiments.active],
[experiments["active"]],
"getAllActive only returns active experiments",
);
activeExperiments[0].name = "newfakename";
Assert.notEqual(
experiments.active.name,
experiments["active"].name,
"newfakename",
"getAllActive returns copies of stored experiments",
);
@ -522,14 +522,14 @@ add_task(withMockExperiments(withMockPreferences(async function testGetAllActive
// has
add_task(withMockExperiments(async function(experiments) {
experiments.test = experimentFactory({name: "test"});
experiments["test"] = experimentFactory({name: "test"});
ok(await PreferenceExperiments.has("test"), "has returned true for a stored experiment");
ok(!(await PreferenceExperiments.has("missing")), "has returned false for a missing experiment");
}));
// init should set the default preference value for active, default experiments
add_task(withMockExperiments(withMockPreferences(async function testInit(experiments, mockPreferences) {
experiments.user = experimentFactory({
experiments["user"] = experimentFactory({
name: "user",
preferenceName: "user",
preferenceValue: true,
@ -537,7 +537,7 @@ add_task(withMockExperiments(withMockPreferences(async function testInit(experim
expired: false,
preferenceBranchType: "user",
});
experiments.default = experimentFactory({
experiments["default"] = experimentFactory({
name: "default",
preferenceName: "default",
preferenceValue: true,
@ -545,7 +545,7 @@ add_task(withMockExperiments(withMockPreferences(async function testInit(experim
expired: false,
preferenceBranchType: "default",
});
experiments.expireddefault = experimentFactory({
experiments["expireddefault"] = experimentFactory({
name: "expireddefault",
preferenceName: "expireddefault",
preferenceValue: true,
@ -579,7 +579,7 @@ add_task(withMockExperiments(withMockPreferences(async function testInit(experim
const startObserverStub = sinon.stub(PreferenceExperiments, "startObserver");
mockPreferences.set("fake.pref", "experiment value");
experiments.test = experimentFactory({
experiments["test"] = experimentFactory({
name: "test",
branch: "branch",
preferenceName: "fake.pref",
@ -619,7 +619,7 @@ add_task(withMockExperiments(async function testInitTelemetry() {
// Experiments shouldn't be recorded by init() in telemetry if they are expired
add_task(withMockExperiments(async function testInitTelemetryExpired(experiments) {
const setActiveStub = sinon.stub(TelemetryEnvironment, "setExperimentActive");
experiments.experiment1 = experimentFactory({name: "expired", branch: "branch", expired: true});
experiments["experiment1"] = experimentFactory({name: "expired", branch: "branch", expired: true});
await PreferenceExperiments.init();
ok(!setActiveStub.called, "Expired experiment is not registered by init");
setActiveStub.restore();
@ -629,7 +629,7 @@ add_task(withMockExperiments(async function testInitTelemetryExpired(experiments
add_task(withMockExperiments(withMockPreferences(async function testInitChanges(experiments, mockPreferences) {
const stopStub = sinon.stub(PreferenceExperiments, "stop");
mockPreferences.set("fake.preference", "experiment value", "default");
experiments.test = experimentFactory({
experiments["test"] = experimentFactory({
name: "test",
preferenceName: "fake.preference",
preferenceValue: "experiment value",
@ -646,7 +646,7 @@ add_task(withMockExperiments(withMockPreferences(async function testInitChanges(
add_task(withMockExperiments(withMockPreferences(async function testInitRegistersObserver(experiments, mockPreferences) {
const startObserver = sinon.stub(PreferenceExperiments, "startObserver");
mockPreferences.set("fake.preference", "experiment value", "default");
experiments.test = experimentFactory({
experiments["test"] = experimentFactory({
name: "test",
preferenceName: "fake.preference",
preferenceValue: "experiment value",

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

@ -123,8 +123,8 @@ add_task(withMockNormandyApi(async function testRun(mockApi) {
mockApi.recipes = [matchRecipe, noMatchRecipe, missingRecipe];
await withMockActionSandboxManagers(mockApi.actions, async managers => {
const matchManager = managers.matchAction;
const noMatchManager = managers.noMatchAction;
const matchManager = managers["matchAction"];
const noMatchManager = managers["noMatchAction"];
await RecipeRunner.run();
@ -155,8 +155,8 @@ add_task(withMockNormandyApi(async function testRunPreExecutionFailure(mockApi)
mockApi.recipes = [passRecipe, failRecipe];
await withMockActionSandboxManagers(mockApi.actions, async managers => {
const passManager = managers.passAction;
const failManager = managers.failAction;
const passManager = managers["passAction"];
const failManager = managers["failAction"];
failManager.runAsyncCallback.returns(Promise.reject(new Error("oh no")));
await RecipeRunner.run();
@ -181,13 +181,13 @@ add_task(withMockNormandyApi(async function testLoadActionSandboxManagers(mockAp
{name: "normalAction"},
{name: "missingImpl"},
];
mockApi.implementations.normalAction = "window.scriptRan = true";
mockApi.implementations["normalAction"] = "window.scriptRan = true";
const managers = await RecipeRunner.loadActionSandboxManagers();
ok("normalAction" in managers, "Actions with implementations have managers");
ok(!("missingImpl" in managers), "Actions without implementations are skipped");
const normalManager = managers.normalAction;
const normalManager = managers["normalAction"];
ok(
await normalManager.evalInSandbox("window.scriptRan"),
"Implementations are run in the sandbox",

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

@ -408,7 +408,7 @@ this.TabCrashHandler = {
// default. In order to make sure we don't send it, we overwrite it
// with the empty string.
if (!includeURL) {
extraExtraKeyVals.URL = "";
extraExtraKeyVals["URL"] = "";
}
CrashSubmit.submit(dumpID, {

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

@ -72,8 +72,8 @@ var DirectoryLinksProvider = {
get _linksURL() {
if (!this.__linksURL) {
try {
this.__linksURL = Services.prefs.getCharPref(this._observedPrefs.linksURL);
this.__linksURLModified = Services.prefs.prefHasUserValue(this._observedPrefs.linksURL);
this.__linksURL = Services.prefs.getCharPref(this._observedPrefs["linksURL"]);
this.__linksURLModified = Services.prefs.prefHasUserValue(this._observedPrefs["linksURL"]);
} catch (e) {
Cu.reportError("Error fetching directory links url from prefs: " + e);
}

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

@ -254,7 +254,7 @@ this.OpenGraphBuilder = {
if (pageData.text)
body += pageData.text + "\n\n";
body += pageData.url;
query.body = body;
query["body"] = body;
}
});
// if the url template doesn't have title and no text was provided, add the title as the text.

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

@ -485,7 +485,7 @@ this.SocialService = {
if (type == "directory" || type == "internal") {
// directory provided manifests must have origin in manifest, use that
if (!data.origin) {
if (!data["origin"]) {
Cu.reportError("SocialService.manifestFromData directory service provided manifest without origin.");
return null;
}
@ -502,7 +502,7 @@ this.SocialService = {
Cu.reportError("SocialService.manifestFromData manifest missing required urls.");
return null;
}
if (!data.name || !data.iconURL) {
if (!data["name"] || !data["iconURL"]) {
Cu.reportError("SocialService.manifestFromData manifest missing name or iconURL.");
return null;
}

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

@ -99,8 +99,8 @@ function checkKeyedHistogram(h, key, expectedValue) {
*/
function getParentProcessScalars(aChannel, aKeyed = false, aClear = false) {
const scalars = aKeyed ?
Services.telemetry.snapshotKeyedScalars(aChannel, aClear).parent :
Services.telemetry.snapshotScalars(aChannel, aClear).parent;
Services.telemetry.snapshotKeyedScalars(aChannel, aClear)["parent"] :
Services.telemetry.snapshotScalars(aChannel, aClear)["parent"];
return scalars || {};
}

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

@ -437,8 +437,8 @@ add_task(async function test_DirectoryLinksProvider_getAllowedLinks() {
do_check_eq(links.length, 2);
// The only remaining url should be http and https
do_check_eq(links[0].url, data.directory[1].url);
do_check_eq(links[1].url, data.directory[3].url);
do_check_eq(links[0].url, data["directory"][1].url);
do_check_eq(links[1].url, data["directory"][3].url);
});
add_task(async function test_DirectoryLinksProvider_getAllowedImages() {
@ -458,8 +458,8 @@ add_task(async function test_DirectoryLinksProvider_getAllowedImages() {
do_check_eq(links.length, 2);
// The only remaining images should be https and data
do_check_eq(links[0].imageURI, data.directory[3].imageURI);
do_check_eq(links[1].imageURI, data.directory[5].imageURI);
do_check_eq(links[0].imageURI, data["directory"][3].imageURI);
do_check_eq(links[1].imageURI, data["directory"][5].imageURI);
});
add_task(async function test_DirectoryLinksProvider_getAllowedImages_base() {
@ -480,10 +480,10 @@ add_task(async function test_DirectoryLinksProvider_getAllowedImages_base() {
do_check_eq(links.length, 4);
// The only remaining images should be https with mozilla.net or data URI
do_check_eq(links[0].url, data.directory[1].url);
do_check_eq(links[1].url, data.directory[2].url);
do_check_eq(links[2].url, data.directory[3].url);
do_check_eq(links[3].url, data.directory[4].url);
do_check_eq(links[0].url, data["directory"][1].url);
do_check_eq(links[1].url, data["directory"][2].url);
do_check_eq(links[2].url, data["directory"][3].url);
do_check_eq(links[3].url, data["directory"][4].url);
});
add_task(async function test_DirectoryLinksProvider_getAllowedEnhancedImages() {
@ -503,8 +503,8 @@ add_task(async function test_DirectoryLinksProvider_getAllowedEnhancedImages() {
do_check_eq(links.length, 2);
// The only remaining enhancedImages should be http and https and data
do_check_eq(links[0].enhancedImageURI, data.directory[3].enhancedImageURI);
do_check_eq(links[1].enhancedImageURI, data.directory[5].enhancedImageURI);
do_check_eq(links[0].enhancedImageURI, data["directory"][3].enhancedImageURI);
do_check_eq(links[1].enhancedImageURI, data["directory"][5].enhancedImageURI);
});
add_task(function test_DirectoryLinksProvider_setDefaultEnhanced() {

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

@ -260,7 +260,7 @@ function run_test() {
let orig = ChromeUtils.createOriginAttributesFromOrigin(uri + t[0]);
checkValues(orig, t[1]);
let mod = orig;
mod.userContextId = 0;
mod["userContextId"] = 0;
checkValues(mod, t[2]);
do_check_eq(ChromeUtils.originAttributesToSuffix(mod), t[3]);
});
@ -281,7 +281,7 @@ function run_test() {
let orig = ChromeUtils.createOriginAttributesFromOrigin(uri + t[0]);
checkValues(orig, t[1]);
let mod = orig;
mod.firstPartyDomain = "";
mod["firstPartyDomain"] = "";
checkValues(mod, t[2]);
do_check_eq(ChromeUtils.originAttributesToSuffix(mod), t[3]);
});

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

@ -818,7 +818,7 @@ function addSpecialMissingLanguageTags(availableLocales) {
// Also forcibly provide the last-ditch locale.
var lastDitch = lastDitchLocale();
assert(lastDitch === "en-GB" && availableLocales.en,
assert(lastDitch === "en-GB" && availableLocales["en"],
"shouldn't be a need to add every locale implied by the last-" +
"ditch locale, merely just the last-ditch locale");
availableLocales[lastDitch] = true;

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

@ -38,7 +38,7 @@ var EmbedRT = {
}
);
sandbox.console = new ConsoleAPI({ consoleID: "script/" + scriptURL });
sandbox["console"] = new ConsoleAPI({ consoleID: "script/" + scriptURL });
// As we don't want our caller to control the JS version used for the
// script file, we run loadSubScript within the context of the
@ -55,7 +55,7 @@ var EmbedRT = {
};
try {
sandbox.load(params);
sandbox["load"](params);
} catch(e) {
dump("Exception calling 'load' method in script: " + scriptURL + "\n" + e);
}

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

@ -83,7 +83,7 @@ var PermissionsHelper = {
}
// Get the strings that correspond to the permission type
let typeStrings = this._permissionStrings[type];
let label = Strings.browser.GetStringFromName(typeStrings.label);
let label = Strings.browser.GetStringFromName(typeStrings["label"]);
// Get the key to look up the appropriate string entity
let valueKey = value == Services.perms.ALLOW_ACTION ?
@ -122,7 +122,7 @@ var PermissionsHelper = {
for (let i = 0; i < permissionsToClear.length; i++) {
let indexToClear = permissionsToClear[i];
let permissionType = this._currentPermissions[indexToClear].type;
let permissionType = this._currentPermissions[indexToClear]["type"];
this.clearPermission(uri, permissionType, privacyContext);
}
break;

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

@ -79,7 +79,7 @@ var modules = {
};
if (AppConstants.MOZ_SERVICES_HEALTHREPORT) {
modules.healthreport = {
modules['healthreport'] = {
uri: "chrome://browser/content/aboutHealthReport.xhtml",
privileged: true
};

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

@ -18,7 +18,7 @@ BrowserCLH.prototype = {
* Consumers can access Android assets using resource://android/assets/FILENAME.
*/
setResourceSubstitutions: function () {
let registry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry);
let registry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci["nsIChromeRegistry"]);
// Like jar:jar:file:///data/app/org.mozilla.fennec-2.apk!/assets/omni.ja!/chrome/chrome/content/aboutHome.xhtml
let url = registry.convertChromeURL(Services.io.newURI("chrome://browser/content/aboutHome.xhtml")).spec;
// Like jar:file:///data/app/org.mozilla.fennec-2.apk!/

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

@ -205,8 +205,8 @@ LoginManagerPrompter.prototype = {
label: this._getLocalizedString("rememberButton"),
callback: function(checked, response) {
if (response) {
aLogin.username = response.username || aLogin.username;
aLogin.password = response.password || aLogin.password;
aLogin.username = response["username"] || aLogin.username;
aLogin.password = response["password"] || aLogin.password;
}
pwmgr.addLogin(aLogin);
promptHistogram.add(PROMPT_ADD);
@ -265,7 +265,7 @@ LoginManagerPrompter.prototype = {
{
label: this._getLocalizedString("updateButton"),
callback: function(checked, response) {
let password = response ? response.password : aNewPassword;
let password = response ? response["password"] : aNewPassword;
self._updateLogin(aOldLogin, password);
promptHistogram.add(PROMPT_UPDATE);

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

@ -98,12 +98,12 @@ this.FxAccountsWebChannel = function(options) {
if (!options) {
throw new Error("Missing configuration options");
}
if (!options.content_uri) {
if (!options["content_uri"]) {
throw new Error("Missing 'content_uri' option");
}
this._contentUri = options.content_uri;
if (!options.channel_id) {
if (!options["channel_id"]) {
throw new Error("Missing 'channel_id' option");
}
this._webChannelId = options.channel_id;

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

@ -25,7 +25,7 @@ function resolveGeckoURI(aURI) {
throw "Can't resolve an empty uri";
if (aURI.startsWith("chrome://")) {
let registry = Cc['@mozilla.org/chrome/chrome-registry;1'].getService(Ci.nsIChromeRegistry);
let registry = Cc['@mozilla.org/chrome/chrome-registry;1'].getService(Ci["nsIChromeRegistry"]);
return registry.convertChromeURL(Services.io.newURI(aURI)).spec;
} else if (aURI.startsWith("resource://")) {
let handler = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);

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

@ -1020,7 +1020,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
rpp.setElements = function(start, vals) {
vals.forEach((v, i) => { this.set(start+i, v); });
};
r.new = function(length) {
r['new'] = function(length) {
return wrap(jenvpp().NewObjectArray(jenv, length, elemClass, null),
classSig);
};
@ -1042,7 +1042,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
j[setter].call(j, jenv, unwrap(this), start, vals.length,
ctype.array()(vals));
};
r.new = function(length) {
r['new'] = function(length) {
var j = jenvpp();
return wrap(j[constructor].call(j, jenv, length), classSig);
};
@ -1093,7 +1093,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s));
var returnSig = mtd.sig.substring(mtd.sig.indexOf(')')+1);
r.new = overloadFunc('new');
r['new'] = overloadFunc('new');
r['new'+mtd.sig] = r['new('+(argctypes.length-1)+')'] = function() {
var i, j = jenvpp();
var args = [jenv, jcls, jmtd];

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

@ -22,7 +22,7 @@ function resolveGeckoURI(aURI) {
throw "Can't resolve an empty uri";
if (aURI.startsWith("chrome://")) {
let registry = Cc['@mozilla.org/chrome/chrome-registry;1'].getService(Ci.nsIChromeRegistry);
let registry = Cc['@mozilla.org/chrome/chrome-registry;1'].getService(Ci["nsIChromeRegistry"]);
return registry.convertChromeURL(Services.io.newURI(aURI)).spec;
} else if (aURI.startsWith("resource://")) {
let handler = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);

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

@ -21,9 +21,9 @@ var WebsiteMetadata = {
parseAsynchronously: function(doc) {
Task.spawn(function() {
let metadata = getMetadata(doc, doc.location.href, {
image_url: metadataRules.image_url,
provider: metadataRules.provider,
description_length: metadataRules.description_length
image_url: metadataRules['image_url'],
provider: metadataRules['provider'],
description_length: metadataRules['description_length']
});
// No metadata was extracted, so don't bother sending it.

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

@ -17,6 +17,9 @@ module.exports = {
// Require default case in switch statements.
"default-case": "error",
// Require `foo.bar` dot notation instead of `foo["bar"]` notation.
"dot-notation": "error",
// Require function* name()
"generator-star-spacing": ["error", {"before": false, "after": true}],

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

@ -244,7 +244,7 @@ this.HawkClient.prototype = {
return;
}
self._updateClockOffset(restResponse.headers.date);
self._updateClockOffset(restResponse.headers["date"]);
if (status === 401 && retryOK && !("retry-after" in restResponse.headers)) {
// Retry once if we were rejected due to a bad timestamp.

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

@ -557,7 +557,7 @@ add_test(function test_get_storage_405() {
let error = doGetRequest(request);
do_check_eq(error, null);
do_check_eq(request.response.status, 405);
do_check_eq(request.response.headers.allow, "DELETE");
do_check_eq(request.response.headers["allow"], "DELETE");
server.stop(run_next_test);
});

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

@ -45,7 +45,7 @@ TokenServerClientError.prototype.toString = function() {
}
TokenServerClientError.prototype.toJSON = function() {
let result = this._toStringFields();
result.name = this.name;
result["name"] = this.name;
return result;
}

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

@ -173,7 +173,7 @@ this.FxAccountsProfileClient.prototype = {
if (request.response.success) {
resolve({
body,
etag: request.response.headers.etag
etag: request.response.headers["etag"]
});
return;
}

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

@ -82,12 +82,12 @@ this.FxAccountsWebChannel = function(options) {
if (!options) {
throw new Error("Missing configuration options");
}
if (!options.content_uri) {
if (!options["content_uri"]) {
throw new Error("Missing 'content_uri' option");
}
this._contentUri = options.content_uri;
if (!options.channel_id) {
if (!options["channel_id"]) {
throw new Error("Missing 'channel_id' option");
}
this._webChannelId = options.channel_id;

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

@ -48,13 +48,13 @@ function getEngineModules() {
ExtensionStorage: {module: "extension-storage.js", symbol: "ExtensionStorageEngine"},
}
if (Svc.Prefs.get("engine.addresses.available", false)) {
result.Addresses = {
result["Addresses"] = {
module: "resource://formautofill/FormAutofillSync.jsm",
symbol: "AddressesEngine",
};
}
if (Svc.Prefs.get("engine.creditcards.available", false)) {
result.CreditCards = {
result["CreditCards"] = {
module: "resource://formautofill/FormAutofillSync.jsm",
symbol: "CreditCardsEngine",
};

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

@ -445,7 +445,7 @@ class SyncTelemetryImpl {
getPingJSON(reason) {
return {
os: TelemetryEnvironment.currentEnvironment.system.os,
os: TelemetryEnvironment.currentEnvironment["system"]["os"],
why: reason,
discarded: this.discarded || undefined,
version: PING_FORMAT_VERSION,

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

@ -152,7 +152,7 @@ add_task(async function test_get_changed_ids() {
scope: 0,
foreignInstall: false
};
reconciler.addons.DUMMY = record;
reconciler.addons["DUMMY"] = record;
reconciler._addChange(record.modified, CHANGE_INSTALLED, record);
changes = await engine.getChangedIDs();

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

@ -61,10 +61,10 @@ add_task(async function testOldMeta() {
let engineSync = new EngineSynchronizer(Service);
await engineSync._updateEnabledFromMeta(meta, 3, manager);
Assert.ok(manager._engines.petrol.enabled, "'petrol' locally enabled.");
Assert.ok(manager._engines.diesel.enabled, "'diesel' locally enabled.");
Assert.ok(manager._engines["petrol"].enabled, "'petrol' locally enabled.");
Assert.ok(manager._engines["diesel"].enabled, "'diesel' locally enabled.");
Assert.ok(!("nonlocal" in manager._engines), "We don't know anything about the 'nonlocal' engine.");
Assert.ok(!manager._engines.actual.enabled, "'actual' not locally enabled.");
Assert.ok(!manager._engines["actual"].enabled, "'actual' not locally enabled.");
Assert.ok(!manager.isDeclined("actual"), "'actual' not declined, though.");
let declinedEngines = new DeclinedEngines(Service);
@ -107,10 +107,10 @@ add_task(async function testDeclinedMeta() {
_("Record: " + JSON.stringify(meta));
let manager = getEngineManager();
manager._engines.petrol.enabled = true;
manager._engines.diesel.enabled = true;
manager._engines.dummy.enabled = true;
manager._engines.actual.enabled = false; // Disabled but not declined.
manager._engines["petrol"].enabled = true;
manager._engines["diesel"].enabled = true;
manager._engines["dummy"].enabled = true;
manager._engines["actual"].enabled = false; // Disabled but not declined.
manager.decline(["localdecline"]); // Declined and not supported.

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

@ -210,7 +210,7 @@ add_task(async function test_disabled_no_track() {
do_check_empty(tracker.changedIDs);
tracker.addChangedID("abcdefghijkl");
do_check_true(0 < tracker.changedIDs.abcdefghijkl);
do_check_true(0 < tracker.changedIDs["abcdefghijkl"]);
Svc.Prefs.set("engine." + engine.prefName, false);
do_check_false(tracker._isTracking);
do_check_empty(tracker.changedIDs);

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

@ -824,7 +824,7 @@ add_task(async function test_sync_engine_generic_fail() {
let log = Log.repository.getLogger("Sync.ErrorHandler");
Svc.Prefs.set("log.appender.file.logOnError", true);
do_check_eq(Status.engines.catapult, undefined);
do_check_eq(Status.engines["catapult"], undefined);
let promiseObserved = new Promise(res => {
Svc.Obs.add("weave:engine:sync:finish", function onEngineFinish() {
@ -846,7 +846,7 @@ add_task(async function test_sync_engine_generic_fail() {
await promiseObserved;
_("Status.engines: " + JSON.stringify(Status.engines));
do_check_eq(Status.engines.catapult, ENGINE_UNKNOWN_FAIL);
do_check_eq(Status.engines["catapult"], ENGINE_UNKNOWN_FAIL);
do_check_eq(Status.service, SYNC_FAILED_PARTIAL);
// Test Error log was written on SYNC_FAILED_PARTIAL.
@ -935,12 +935,12 @@ add_task(async function test_engine_applyFailed() {
let promiseObserved = promiseOneObserver("weave:service:reset-file-log");
do_check_eq(Status.engines.catapult, undefined);
do_check_eq(Status.engines["catapult"], undefined);
do_check_true(await EHTestsCommon.setUp(server));
await Service.sync();
await promiseObserved;
do_check_eq(Status.engines.catapult, ENGINE_APPLY_FAIL);
do_check_eq(Status.engines["catapult"], ENGINE_APPLY_FAIL);
do_check_eq(Status.service, SYNC_FAILED_PARTIAL);
// Test Error log was written on SYNC_FAILED_PARTIAL.

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

@ -225,7 +225,7 @@ add_test(function test_storage_request() {
_("Modified is " + this.response.newModified);
let parsedBody = JSON.parse(this.response.body);
do_check_true(parsedBody >= now);
do_check_empty(server.users.john.collections);
do_check_empty(server.users["john"].collections);
Utils.nextTick(next);
});
}
@ -234,7 +234,7 @@ add_test(function test_storage_request() {
let req = localRequest(server, storageURL);
req.get(function(err) {
do_check_eq(this.response.status, 405);
do_check_eq(this.response.headers.allow, "DELETE");
do_check_eq(this.response.headers["allow"], "DELETE");
Utils.nextTick(next);
});
}

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

@ -215,9 +215,9 @@ add_task(async function test_ensureLoggedIn() {
*/
let info_collections = {};
do_check_true(collectionKeys.updateNeeded(info_collections));
info_collections.crypto = 5000;
info_collections["crypto"] = 5000;
do_check_false(collectionKeys.updateNeeded(info_collections));
info_collections.crypto = 1 + (Date.now() / 1000); // Add one in case computers are fast!
info_collections["crypto"] = 1 + (Date.now() / 1000); // Add one in case computers are fast!
do_check_true(collectionKeys.updateNeeded(info_collections));
collectionKeys.lastModified = null;

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

@ -293,8 +293,8 @@ add_test(function test_basicauth() {
_("Test that the BasicAuthenticator doesn't screw up header case.");
let res1 = new AsyncResource(server.baseURI + "/foo");
res1.setHeader("Authorization", "Basic foobar");
do_check_eq(res1._headers.authorization, "Basic foobar");
do_check_eq(res1.headers.authorization, "Basic foobar");
do_check_eq(res1._headers["authorization"], "Basic foobar");
do_check_eq(res1.headers["authorization"], "Basic foobar");
run_next_test();
});

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

@ -311,12 +311,12 @@ add_task(async function test_disabledRemotelyTwoClients() {
_("Disable engine by deleting from meta/global.");
let d = metaWBO.data;
delete d.engines.steam;
delete d.engines["steam"];
metaWBO.payload = JSON.stringify(d);
metaWBO.modified = Date.now() / 1000;
_("Add a second client and verify that the local pref is changed.");
Service.clientsEngine._store._remoteClients.foobar = {name: "foobar", type: "desktop"};
Service.clientsEngine._store._remoteClients["foobar"] = {name: "foobar", type: "desktop"};
await Service.sync();
_("Engine is disabled.");

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

@ -51,18 +51,18 @@ function run_test() {
// Check engine status
Status.engines = ["testEng1", ENGINE_SUCCEEDED];
do_check_eq(Status.engines.testEng1, ENGINE_SUCCEEDED);
do_check_eq(Status.engines["testEng1"], ENGINE_SUCCEEDED);
do_check_eq(Status.service, STATUS_OK);
Status.engines = ["testEng2", ENGINE_DOWNLOAD_FAIL];
do_check_eq(Status.engines.testEng1, ENGINE_SUCCEEDED);
do_check_eq(Status.engines.testEng2, ENGINE_DOWNLOAD_FAIL);
do_check_eq(Status.engines["testEng1"], ENGINE_SUCCEEDED);
do_check_eq(Status.engines["testEng2"], ENGINE_DOWNLOAD_FAIL);
do_check_eq(Status.service, SYNC_FAILED_PARTIAL);
Status.engines = ["testEng3", ENGINE_SUCCEEDED];
do_check_eq(Status.engines.testEng1, ENGINE_SUCCEEDED);
do_check_eq(Status.engines.testEng2, ENGINE_DOWNLOAD_FAIL);
do_check_eq(Status.engines.testEng3, ENGINE_SUCCEEDED);
do_check_eq(Status.engines["testEng1"], ENGINE_SUCCEEDED);
do_check_eq(Status.engines["testEng2"], ENGINE_DOWNLOAD_FAIL);
do_check_eq(Status.engines["testEng3"], ENGINE_SUCCEEDED);
do_check_eq(Status.service, SYNC_FAILED_PARTIAL);

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

@ -99,7 +99,7 @@ add_task(async function test_syncStartup_emptyOrOutdatedGlobalsResetsSync() {
try {
// Confirm initial environment
do_check_eq(engine._tracker.changedIDs.rekolok, undefined);
do_check_eq(engine._tracker.changedIDs["rekolok"], undefined);
let metaGlobal = await Service.recordManager.get(engine.metaURL);
do_check_eq(metaGlobal.payload.engines, undefined);
do_check_true(!!collection.payload("flying"));
@ -113,7 +113,7 @@ add_task(async function test_syncStartup_emptyOrOutdatedGlobalsResetsSync() {
await engine._syncStartup();
// The meta/global WBO has been filled with data about the engine
let engineData = metaGlobal.payload.engines.rotary;
let engineData = metaGlobal.payload.engines["rotary"];
do_check_eq(engineData.version, engine.version);
do_check_eq(engineData.syncID, engine.syncID);
@ -174,7 +174,7 @@ add_task(async function test_syncStartup_syncIDMismatchResetsClient() {
// Confirm initial environment
do_check_eq(engine.syncID, "fake-guid-00");
do_check_eq(engine._tracker.changedIDs.rekolok, undefined);
do_check_eq(engine._tracker.changedIDs["rekolok"], undefined);
engine.lastSync = Date.now() / 1000;
engine.lastSyncLocal = Date.now();
@ -349,7 +349,7 @@ add_task(async function test_processIncoming_reconcile() {
do_check_eq(engine._store.items.olderidentical, "Older but identical");
do_check_eq(engine._store.items.updateclient, "Got data?");
do_check_eq(engine._store.items.nukeme, "Nuke me!");
do_check_true(engine._tracker.changedIDs.olderidentical > 0);
do_check_true(engine._tracker.changedIDs["olderidentical"] > 0);
await engine._syncStartup();
await engine._processIncoming();
@ -367,7 +367,7 @@ add_task(async function test_processIncoming_reconcile() {
// The data for 'olderidentical' is identical on the server, so
// it's no longer marked as changed anymore.
do_check_eq(engine._store.items.olderidentical, "Older but identical");
do_check_eq(engine._tracker.changedIDs.olderidentical, undefined);
do_check_eq(engine._tracker.changedIDs["olderidentical"], undefined);
// Updated with server data.
do_check_eq(engine._store.items.updateclient, "Get this!");
@ -1195,7 +1195,7 @@ add_task(async function test_uploadOutgoing_toEmptyServer() {
do_check_true(!!collection.payload("scotsman"));
do_check_eq(JSON.parse(collection.wbo("scotsman").data.ciphertext).id,
"scotsman");
do_check_eq(engine._tracker.changedIDs.scotsman, undefined);
do_check_eq(engine._tracker.changedIDs["scotsman"], undefined);
// The 'flying' record wasn't marked so it wasn't uploaded
do_check_eq(collection.payload("flying"), undefined);
@ -1251,7 +1251,7 @@ async function test_uploadOutgoing_max_record_payload_bytes(allowSkippedRecord)
// Check we uploaded the other record to the server
do_check_true(collection.payload("scotsman"));
// And that we won't try to upload the huge record next time.
do_check_eq(engine._tracker.changedIDs.flying, undefined);
do_check_eq(engine._tracker.changedIDs["flying"], undefined);
} catch (e) {
if (allowSkippedRecord) {
@ -1261,7 +1261,7 @@ async function test_uploadOutgoing_max_record_payload_bytes(allowSkippedRecord)
await engine.trackRemainingChanges();
// Check that we will try to upload the huge record next time
do_check_eq(engine._tracker.changedIDs.flying, 1000);
do_check_eq(engine._tracker.changedIDs["flying"], 1000);
} finally {
// Check we didn't upload the oversized record to the server
do_check_eq(collection.payload("flying"), undefined);
@ -1317,9 +1317,9 @@ add_task(async function test_uploadOutgoing_failed() {
// Confirm initial environment
do_check_eq(engine.lastSyncLocal, 0);
do_check_eq(collection.payload("flying"), undefined);
do_check_eq(engine._tracker.changedIDs.flying, FLYING_CHANGED);
do_check_eq(engine._tracker.changedIDs.scotsman, SCOTSMAN_CHANGED);
do_check_eq(engine._tracker.changedIDs.peppercorn, PEPPERCORN_CHANGED);
do_check_eq(engine._tracker.changedIDs["flying"], FLYING_CHANGED);
do_check_eq(engine._tracker.changedIDs["scotsman"], SCOTSMAN_CHANGED);
do_check_eq(engine._tracker.changedIDs["peppercorn"], PEPPERCORN_CHANGED);
engine.enabled = true;
await sync_engine_and_validate_telem(engine, true);
@ -1329,12 +1329,12 @@ add_task(async function test_uploadOutgoing_failed() {
// Ensure the 'flying' record has been uploaded and is no longer marked.
do_check_true(!!collection.payload("flying"));
do_check_eq(engine._tracker.changedIDs.flying, undefined);
do_check_eq(engine._tracker.changedIDs["flying"], undefined);
// The 'scotsman' and 'peppercorn' records couldn't be uploaded so
// they weren't cleared from the tracker.
do_check_eq(engine._tracker.changedIDs.scotsman, SCOTSMAN_CHANGED);
do_check_eq(engine._tracker.changedIDs.peppercorn, PEPPERCORN_CHANGED);
do_check_eq(engine._tracker.changedIDs["scotsman"], SCOTSMAN_CHANGED);
do_check_eq(engine._tracker.changedIDs["peppercorn"], PEPPERCORN_CHANGED);
} finally {
await promiseClean(engine, server);
@ -1448,8 +1448,8 @@ async function createRecordFailTelemetry(allowSkippedRecord) {
// Confirm initial environment
do_check_eq(engine.lastSyncLocal, 0);
do_check_eq(collection.payload("flying"), undefined);
do_check_eq(engine._tracker.changedIDs.flying, FLYING_CHANGED);
do_check_eq(engine._tracker.changedIDs.scotsman, SCOTSMAN_CHANGED);
do_check_eq(engine._tracker.changedIDs["flying"], FLYING_CHANGED);
do_check_eq(engine._tracker.changedIDs["scotsman"], SCOTSMAN_CHANGED);
engine.enabled = true;
ping = await sync_engine_and_validate_telem(engine, true, onErrorPing => {
@ -1462,7 +1462,7 @@ async function createRecordFailTelemetry(allowSkippedRecord) {
// Ensure the 'flying' record has been uploaded and is no longer marked.
do_check_true(!!collection.payload("flying"));
do_check_eq(engine._tracker.changedIDs.flying, undefined);
do_check_eq(engine._tracker.changedIDs["flying"], undefined);
} catch (err) {
if (allowSkippedRecord) {
do_throw("should not get here");
@ -1470,7 +1470,7 @@ async function createRecordFailTelemetry(allowSkippedRecord) {
// Ensure the 'flying' record has not been uploaded and is still marked
do_check_false(collection.payload("flying"));
do_check_true(engine._tracker.changedIDs.flying);
do_check_true(engine._tracker.changedIDs["flying"]);
} finally {
// Local timestamp has been set.
do_check_true(engine.lastSyncLocal > 0);
@ -1481,7 +1481,7 @@ async function createRecordFailTelemetry(allowSkippedRecord) {
// In any case, the 'scotsman' record couldn't be created so it wasn't
// uploaded nor it was not cleared from the tracker.
do_check_false(collection.payload("scotsman"));
do_check_eq(engine._tracker.changedIDs.scotsman, SCOTSMAN_CHANGED);
do_check_eq(engine._tracker.changedIDs["scotsman"], SCOTSMAN_CHANGED);
engine._store.createRecord = oldCreateRecord;
await promiseClean(engine, server);

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

@ -26,7 +26,7 @@ add_task(async function test_create() {
cleartext: { "foo": "bar" },
modified: 1000};
await store.applyIncoming(rec);
deepEqual(store._remoteClients.id1, { lastModified: 1000, foo: "bar" });
deepEqual(store._remoteClients["id1"], { lastModified: 1000, foo: "bar" });
_("Create a second record");
rec = {id: "id2",
@ -34,7 +34,7 @@ add_task(async function test_create() {
cleartext: { "foo2": "bar2" },
modified: 2000};
await store.applyIncoming(rec);
deepEqual(store._remoteClients.id2, { lastModified: 2000, foo2: "bar2" });
deepEqual(store._remoteClients["id2"], { lastModified: 2000, foo2: "bar2" });
_("Create a third record");
rec = {id: "id3",
@ -42,7 +42,7 @@ add_task(async function test_create() {
cleartext: { "foo3": "bar3" },
modified: 3000};
await store.applyIncoming(rec);
deepEqual(store._remoteClients.id3, { lastModified: 3000, foo3: "bar3" });
deepEqual(store._remoteClients["id3"], { lastModified: 3000, foo3: "bar3" });
});
add_task(async function test_getAllTabs() {

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

@ -171,19 +171,19 @@ var Authentication = {
signIn: function signIn(account) {
let cb = Async.makeSpinningCallback();
Logger.AssertTrue(account.username, "Username has been found");
Logger.AssertTrue(account.password, "Password has been found");
Logger.AssertTrue(account["username"], "Username has been found");
Logger.AssertTrue(account["password"], "Password has been found");
Logger.logInfo("Login user: " + account.username);
Logger.logInfo("Login user: " + account["username"]);
// Required here since we don't go through the real login page
Async.promiseSpinningly(FxAccountsConfig.ensureConfigured());
let client = new FxAccountsClient();
client.signIn(account.username, account.password, true).then(credentials => {
client.signIn(account["username"], account["password"], true).then(credentials => {
return fxAccounts.setSignedInUser(credentials);
}).then(() => {
return this._completeVerification(account.username)
return this._completeVerification(account["username"])
}).then(() => {
cb(null, true);
}, error => {

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

@ -507,10 +507,10 @@ var TPS = {
for (let bookmark of bookmarks[folder]) {
Logger.clearPotentialError();
let placesItem;
bookmark.location = folder;
bookmark["location"] = folder;
if (last_item_pos != -1)
bookmark.last_item_pos = last_item_pos;
bookmark["last_item_pos"] = last_item_pos;
let item_id = -1;
if (action != ACTION_MODIFY && action != ACTION_DELETE)

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

@ -280,7 +280,7 @@ evaluate.toJSON = function(obj, seenEls) {
return element.makeWebElement(uuid);
// custom JSON representation
} else if (typeof obj.toJSON == "function") {
} else if (typeof obj["toJSON"] == "function") {
let unsafeJSON = obj.toJSON();
return evaluate.toJSON(unsafeJSON, seenEls);
}

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

@ -1370,10 +1370,10 @@ event.sendEvent = function(eventType, el, modifiers = {}, opts = {}) {
let doc = el.ownerDocument || el.document;
let ev = doc.createEvent("Event");
ev.shiftKey = modifiers.shift;
ev.metaKey = modifiers.meta;
ev.altKey = modifiers.alt;
ev.ctrlKey = modifiers.ctrl;
ev.shiftKey = modifiers["shift"];
ev.metaKey = modifiers["meta"];
ev.altKey = modifiers["alt"];
ev.ctrlKey = modifiers["ctrl"];
ev.initEvent(eventType, opts.canBubble, true);
el.dispatchEvent(ev);

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

@ -73,7 +73,7 @@ reftest.Runner = class {
this.parentWindow = assert.window(this.driver.getCurrentWindow());
this.screenshotMode = SCREENSHOT_MODE[screenshotMode] ||
SCREENSHOT_MODE.unexpected;
SCREENSHOT_MODE["unexpected"];
this.urlCount = Object.keys(urlCount || {})
.reduce((map, key) => map.set(key, urlCount[key]), new Map());

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

@ -21,7 +21,7 @@ async function painted() {
let startupInfo = await TalosPowersContent.getStartupInfo();
let startupTime = startupInfo.firstPaint - startupInfo.process;
let startupTime = startupInfo["firstPaint"] - startupInfo["process"];
document.body.textContent = "Startup time = " + startupTime + " ms";
if (window.dump) {

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

@ -244,7 +244,7 @@ TalosPowersService.prototype = {
let mm = message.target.messageManager;
let startupInfo = Services.startup.getStartupInfo();
if (!startupInfo.firstPaint) {
if (!startupInfo["firstPaint"]) {
// It's possible that we were called early enough that
// the firstPaint measurement hasn't been set yet. In
// that case, we set up an observer for the next time

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

@ -669,11 +669,11 @@ Tart.prototype = {
sequenceArray = [];
for (var i in this._config.subtests) {
for (var r = 0; r < this._config.repeat; r++) {
sequenceArray = sequenceArray.concat(subtests.init);
sequenceArray = sequenceArray.concat(subtests["init"]);
sequenceArray = sequenceArray.concat(subtests[this._config.subtests[i]]);
}
}
sequenceArray = sequenceArray.concat(subtests.restore);
sequenceArray = sequenceArray.concat(subtests["restore"]);
this._doSequence(sequenceArray, this._doneInternal);
},

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

@ -13,8 +13,8 @@
*/
function run_test() {
do_check_true(typeof(this.MODULE_IMPORTED) == "undefined");
do_check_true(typeof(this.MODULE_URI) == "undefined");
do_check_true(typeof(this["MODULE_IMPORTED"]) == "undefined");
do_check_true(typeof(this["MODULE_URI"]) == "undefined");
let uri = "resource://test/import_module.jsm";
Components.utils.import(uri);
do_check_true(MODULE_URI == uri);

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

@ -1029,8 +1029,8 @@ function appendAboutMemoryMain(aProcessReports, aHasMozMallocUsableSize) {
}
// Then sort by resident size.
let nodeA = pcollsByProcess[aProcessA]._degenerates.resident;
let nodeB = pcollsByProcess[aProcessB]._degenerates.resident;
let nodeA = pcollsByProcess[aProcessA]._degenerates["resident"];
let nodeB = pcollsByProcess[aProcessB]._degenerates["resident"];
let residentA = nodeA ? nodeA._amount : -1;
let residentB = nodeB ? nodeB._amount : -1;

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

@ -260,8 +260,8 @@ CaptivePortalDetector.prototype = {
let request = {interfaceName: aInterfaceName};
if (aCallback) {
let callback = aCallback.QueryInterface(Ci.nsICaptivePortalCallback);
request.callback = callback;
request.retryCount = 0;
request["callback"] = callback;
request["retryCount"] = 0;
}
this._addRequest(request);
},
@ -332,7 +332,7 @@ CaptivePortalDetector.prototype = {
}
};
this._runningRequest.urlFetcher = urlFetcher;
this._runningRequest["urlFetcher"] = urlFetcher;
},
_startLogin: function _startLogin() {
@ -343,7 +343,7 @@ CaptivePortalDetector.prototype = {
url: this._canonicalSiteURL,
};
this._loginObserver.attach();
this._runningRequest.eventId = id;
this._runningRequest["eventId"] = id;
this._sendEvent(kOpenCaptivePortalLoginEvent, details);
gSysMsgr.broadcastMessage(kCaptivePortalSystemMessage, {});
},
@ -369,13 +369,13 @@ CaptivePortalDetector.prototype = {
if (this._runningRequest.hasOwnProperty("eventId") && success) {
let details = {
type: kCaptivePortalLoginSuccessEvent,
id: this._runningRequest.eventId,
id: this._runningRequest["eventId"],
};
this._sendEvent(kCaptivePortalLoginSuccessEvent, details);
}
// Continue the following request
this._runningRequest.complete = true;
this._runningRequest["complete"] = true;
this._removeRequest(this._runningRequest.interfaceName);
}
},

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

@ -391,8 +391,8 @@ ContentPrefService.prototype = {
selectGroupsStmt.params.setting = settingID;
while (selectGroupsStmt.executeStep()) {
groupIDs.push(selectGroupsStmt.row.groupID);
groupNames.push(selectGroupsStmt.row.groupName);
groupIDs.push(selectGroupsStmt.row["groupID"]);
groupNames.push(selectGroupsStmt.row["groupName"]);
}
} finally {
selectGroupsStmt.reset();
@ -602,7 +602,7 @@ ContentPrefService.prototype = {
}});
} else {
if (this._stmtSelectPref.executeStep()) {
value = this._stmtSelectPref.row.value;
value = this._stmtSelectPref.row["value"];
}
this._cache.set(aGroup, aSetting, value);
}
@ -649,7 +649,7 @@ ContentPrefService.prototype = {
}});
} else {
if (this._stmtSelectGlobalPref.executeStep()) {
value = this._stmtSelectGlobalPref.row.value;
value = this._stmtSelectGlobalPref.row["value"];
}
this._cache.set(null, aName, value);
}
@ -679,7 +679,7 @@ ContentPrefService.prototype = {
this._stmtSelectGroupID.params.name = aName;
if (this._stmtSelectGroupID.executeStep())
id = this._stmtSelectGroupID.row.id;
id = this._stmtSelectGroupID.row["id"];
} finally {
this._stmtSelectGroupID.reset();
}
@ -720,7 +720,7 @@ ContentPrefService.prototype = {
this._stmtSelectSettingID.params.name = aName;
if (this._stmtSelectSettingID.executeStep())
id = this._stmtSelectSettingID.row.id;
id = this._stmtSelectSettingID.row["id"];
} finally {
this._stmtSelectSettingID.reset();
}
@ -762,7 +762,7 @@ ContentPrefService.prototype = {
this._stmtSelectPrefID.params.settingID = aSettingID;
if (this._stmtSelectPrefID.executeStep())
id = this._stmtSelectPrefID.row.id;
id = this._stmtSelectPrefID.row["id"];
} finally {
this._stmtSelectPrefID.reset();
}
@ -787,7 +787,7 @@ ContentPrefService.prototype = {
this._stmtSelectGlobalPrefID.params.settingID = aSettingID;
if (this._stmtSelectGlobalPrefID.executeStep())
id = this._stmtSelectGlobalPrefID.row.id;
id = this._stmtSelectGlobalPrefID.row["id"];
} finally {
this._stmtSelectGlobalPrefID.reset();
}
@ -899,8 +899,8 @@ ContentPrefService.prototype = {
this._stmtSelectPrefs.params.group = aGroup;
while (this._stmtSelectPrefs.executeStep())
prefs.setProperty(this._stmtSelectPrefs.row.name,
this._stmtSelectPrefs.row.value);
prefs.setProperty(this._stmtSelectPrefs.row["name"],
this._stmtSelectPrefs.row["value"]);
} finally {
this._stmtSelectPrefs.reset();
}
@ -927,8 +927,8 @@ ContentPrefService.prototype = {
try {
while (this._stmtSelectGlobalPrefs.executeStep())
prefs.setProperty(this._stmtSelectGlobalPrefs.row.name,
this._stmtSelectGlobalPrefs.row.value);
prefs.setProperty(this._stmtSelectGlobalPrefs.row["name"],
this._stmtSelectGlobalPrefs.row["value"]);
} finally {
this._stmtSelectGlobalPrefs.reset();
}
@ -958,8 +958,8 @@ ContentPrefService.prototype = {
this._stmtSelectPrefsByName.params.setting = aName;
while (this._stmtSelectPrefsByName.executeStep())
prefs.setProperty(this._stmtSelectPrefsByName.row.groupName,
this._stmtSelectPrefsByName.row.value);
prefs.setProperty(this._stmtSelectPrefsByName.row["groupName"],
this._stmtSelectPrefsByName.row["value"]);
} finally {
this._stmtSelectPrefsByName.reset();
}

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

@ -120,6 +120,9 @@ module.exports = {
// Enforce dots on the next line with property name.
"dot-location": ["error", "property"],
// Encourage the use of dot notation whenever possible.
"dot-notation": "error",
// Allow using == instead of ===, in the interest of landing something since
// the devtools codebase is split on convention here.
"eqeqeq": "off",

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

@ -11,6 +11,7 @@ module.exports = {
"complexity": ["error", {"max": 20}],
"curly": "error",
"dot-location": ["warn", "property"],
"dot-notation": "error",
"generator-star-spacing": ["warn", "after"],
"indent": ["warn", 2, {"SwitchCase": 1}],
"max-len": ["warn", 80, 2, {"ignoreUrls": true}],

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

@ -711,21 +711,21 @@ LoginManagerStorage_mozStorage.prototype = {
conditions.push("hostname isnull");
} else if (hostname != "") {
conditions.push("hostname = :hostname");
params.hostname = hostname;
params["hostname"] = hostname;
}
if (formSubmitURL == null) {
conditions.push("formSubmitURL isnull");
} else if (formSubmitURL != "") {
conditions.push("formSubmitURL = :formSubmitURL OR formSubmitURL = ''");
params.formSubmitURL = formSubmitURL;
params["formSubmitURL"] = formSubmitURL;
}
if (httpRealm == null) {
conditions.push("httpRealm isnull");
} else if (httpRealm != "") {
conditions.push("httpRealm = :httpRealm");
params.httpRealm = httpRealm;
params["httpRealm"] = httpRealm;
}
return [conditions, params];

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

@ -132,7 +132,7 @@ function checkLoginItems(logins, items) {
* Gets the list of expected logins for a hostname.
*/
function getExpectedLogins(hostname) {
return Services.logins.getAllLogins().filter(entry => entry.hostname === hostname);
return Services.logins.getAllLogins().filter(entry => entry["hostname"] === hostname);
}
function loginList() {

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

@ -14,6 +14,7 @@ module.exports = {
}],
curly: ["error", "all"],
"dot-location": ["error", "property"],
"dot-notation": "error",
"generator-star-spacing": ["error", "after"],
indent: ["error", 2, {
SwitchCase: 1,

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

@ -316,7 +316,7 @@ this.PlacesDBUtils = {
query: "SELECT id FROM moz_bookmarks WHERE id = :places_root",
params: {}
};
selectPlacesRoot.params.places_root = PlacesUtils.placesRootId;
selectPlacesRoot.params["places_root"] = PlacesUtils.placesRootId;
let db = await PlacesUtils.promiseDBConnection();
let rows = await db.execute(selectPlacesRoot.query, selectPlacesRoot.params);
if (rows.length === 0) {
@ -327,9 +327,9 @@ this.PlacesDBUtils = {
VALUES (:places_root, 2, NULL, 0, 0, :title, :guid)`,
params: {}
};
createPlacesRoot.params.places_root = PlacesUtils.placesRootId;
createPlacesRoot.params.title = "";
createPlacesRoot.params.guid = PlacesUtils.bookmarks.rootGuid;
createPlacesRoot.params["places_root"] = PlacesUtils.placesRootId;
createPlacesRoot.params["title"] = "";
createPlacesRoot.params["guid"] = PlacesUtils.bookmarks.rootGuid;
cleanupStatements.push(createPlacesRoot);
// Now ensure that other roots are children of Places root.
@ -339,11 +339,11 @@ this.PlacesDBUtils = {
( :menuGuid, :toolbarGuid, :unfiledGuid, :tagsGuid )`,
params: {}
};
fixPlacesRootChildren.params.places_root = PlacesUtils.placesRootId;
fixPlacesRootChildren.params.menuGuid = PlacesUtils.bookmarks.menuGuid;
fixPlacesRootChildren.params.toolbarGuid = PlacesUtils.bookmarks.toolbarGuid;
fixPlacesRootChildren.params.unfiledGuid = PlacesUtils.bookmarks.unfiledGuid;
fixPlacesRootChildren.params.tagsGuid = PlacesUtils.bookmarks.tagsGuid;
fixPlacesRootChildren.params["places_root"] = PlacesUtils.placesRootId;
fixPlacesRootChildren.params["menuGuid"] = PlacesUtils.bookmarks.menuGuid;
fixPlacesRootChildren.params["toolbarGuid"] = PlacesUtils.bookmarks.toolbarGuid;
fixPlacesRootChildren.params["unfiledGuid"] = PlacesUtils.bookmarks.unfiledGuid;
fixPlacesRootChildren.params["tagsGuid"] = PlacesUtils.bookmarks.tagsGuid;
cleanupStatements.push(fixPlacesRootChildren);
}
// C.2 fix roots titles
@ -356,16 +356,16 @@ this.PlacesDBUtils = {
query: updateRootTitleSql,
params: {}
};
fixPlacesRootTitle.params.root_id = PlacesUtils.placesRootId;
fixPlacesRootTitle.params.title = "";
fixPlacesRootTitle.params["root_id"] = PlacesUtils.placesRootId;
fixPlacesRootTitle.params["title"] = "";
cleanupStatements.push(fixPlacesRootTitle);
// bookmarks menu
let fixBookmarksMenuTitle = {
query: updateRootTitleSql,
params: {}
};
fixBookmarksMenuTitle.params.root_id = PlacesUtils.bookmarksMenuFolderId;
fixBookmarksMenuTitle.params.title =
fixBookmarksMenuTitle.params["root_id"] = PlacesUtils.bookmarksMenuFolderId;
fixBookmarksMenuTitle.params["title"] =
PlacesUtils.getString("BookmarksMenuFolderTitle");
cleanupStatements.push(fixBookmarksMenuTitle);
// bookmarks toolbar
@ -373,8 +373,8 @@ this.PlacesDBUtils = {
query: updateRootTitleSql,
params: {}
};
fixBookmarksToolbarTitle.params.root_id = PlacesUtils.toolbarFolderId;
fixBookmarksToolbarTitle.params.title =
fixBookmarksToolbarTitle.params["root_id"] = PlacesUtils.toolbarFolderId;
fixBookmarksToolbarTitle.params["title"] =
PlacesUtils.getString("BookmarksToolbarFolderTitle");
cleanupStatements.push(fixBookmarksToolbarTitle);
// unsorted bookmarks
@ -382,8 +382,8 @@ this.PlacesDBUtils = {
query: updateRootTitleSql,
params: {}
};
fixUnsortedBookmarksTitle.params.root_id = PlacesUtils.unfiledBookmarksFolderId;
fixUnsortedBookmarksTitle.params.title =
fixUnsortedBookmarksTitle.params["root_id"] = PlacesUtils.unfiledBookmarksFolderId;
fixUnsortedBookmarksTitle.params["title"] =
PlacesUtils.getString("OtherBookmarksFolderTitle");
cleanupStatements.push(fixUnsortedBookmarksTitle);
// tags
@ -391,8 +391,8 @@ this.PlacesDBUtils = {
query: updateRootTitleSql,
params: {}
};
fixTagsRootTitle.params.root_id = PlacesUtils.tagsFolderId;
fixTagsRootTitle.params.title =
fixTagsRootTitle.params["root_id"] = PlacesUtils.tagsFolderId;
fixTagsRootTitle.params["title"] =
PlacesUtils.getString("TagsFolderTitle");
cleanupStatements.push(fixTagsRootTitle);
@ -410,12 +410,12 @@ this.PlacesDBUtils = {
)`,
params: {}
};
deleteNoPlaceItems.params.bookmark_type = PlacesUtils.bookmarks.TYPE_BOOKMARK;
deleteNoPlaceItems.params.rootGuid = PlacesUtils.bookmarks.rootGuid;
deleteNoPlaceItems.params.menuGuid = PlacesUtils.bookmarks.menuGuid;
deleteNoPlaceItems.params.toolbarGuid = PlacesUtils.bookmarks.toolbarGuid;
deleteNoPlaceItems.params.unfiledGuid = PlacesUtils.bookmarks.unfiledGuid;
deleteNoPlaceItems.params.tagsGuid = PlacesUtils.bookmarks.tagsGuid;
deleteNoPlaceItems.params["bookmark_type"] = PlacesUtils.bookmarks.TYPE_BOOKMARK;
deleteNoPlaceItems.params["rootGuid"] = PlacesUtils.bookmarks.rootGuid;
deleteNoPlaceItems.params["menuGuid"] = PlacesUtils.bookmarks.menuGuid;
deleteNoPlaceItems.params["toolbarGuid"] = PlacesUtils.bookmarks.toolbarGuid;
deleteNoPlaceItems.params["unfiledGuid"] = PlacesUtils.bookmarks.unfiledGuid;
deleteNoPlaceItems.params["tagsGuid"] = PlacesUtils.bookmarks.tagsGuid;
cleanupStatements.push(deleteNoPlaceItems);
// D.2 remove items that are not uri bookmarks from tag containers
@ -431,13 +431,13 @@ this.PlacesDBUtils = {
)`,
params: {}
};
deleteBogusTagChildren.params.tags_folder = PlacesUtils.tagsFolderId;
deleteBogusTagChildren.params.bookmark_type = PlacesUtils.bookmarks.TYPE_BOOKMARK;
deleteBogusTagChildren.params.rootGuid = PlacesUtils.bookmarks.rootGuid;
deleteBogusTagChildren.params.menuGuid = PlacesUtils.bookmarks.menuGuid;
deleteBogusTagChildren.params.toolbarGuid = PlacesUtils.bookmarks.toolbarGuid;
deleteBogusTagChildren.params.unfiledGuid = PlacesUtils.bookmarks.unfiledGuid;
deleteBogusTagChildren.params.tagsGuid = PlacesUtils.bookmarks.tagsGuid;
deleteBogusTagChildren.params["tags_folder"] = PlacesUtils.tagsFolderId;
deleteBogusTagChildren.params["bookmark_type"] = PlacesUtils.bookmarks.TYPE_BOOKMARK;
deleteBogusTagChildren.params["rootGuid"] = PlacesUtils.bookmarks.rootGuid;
deleteBogusTagChildren.params["menuGuid"] = PlacesUtils.bookmarks.menuGuid;
deleteBogusTagChildren.params["toolbarGuid"] = PlacesUtils.bookmarks.toolbarGuid;
deleteBogusTagChildren.params["unfiledGuid"] = PlacesUtils.bookmarks.unfiledGuid;
deleteBogusTagChildren.params["tagsGuid"] = PlacesUtils.bookmarks.tagsGuid;
cleanupStatements.push(deleteBogusTagChildren);
// D.3 remove empty tags
@ -454,12 +454,12 @@ this.PlacesDBUtils = {
)`,
params: {}
};
deleteEmptyTags.params.tags_folder = PlacesUtils.tagsFolderId;
deleteEmptyTags.params.rootGuid = PlacesUtils.bookmarks.rootGuid;
deleteEmptyTags.params.menuGuid = PlacesUtils.bookmarks.menuGuid;
deleteEmptyTags.params.toolbarGuid = PlacesUtils.bookmarks.toolbarGuid;
deleteEmptyTags.params.unfiledGuid = PlacesUtils.bookmarks.unfiledGuid;
deleteEmptyTags.params.tagsGuid = PlacesUtils.bookmarks.tagsGuid;
deleteEmptyTags.params["tags_folder"] = PlacesUtils.tagsFolderId;
deleteEmptyTags.params["rootGuid"] = PlacesUtils.bookmarks.rootGuid;
deleteEmptyTags.params["menuGuid"] = PlacesUtils.bookmarks.menuGuid;
deleteEmptyTags.params["toolbarGuid"] = PlacesUtils.bookmarks.toolbarGuid;
deleteEmptyTags.params["unfiledGuid"] = PlacesUtils.bookmarks.unfiledGuid;
deleteEmptyTags.params["tagsGuid"] = PlacesUtils.bookmarks.tagsGuid;
cleanupStatements.push(deleteEmptyTags);
// D.4 move orphan items to unsorted folder
@ -474,12 +474,12 @@ this.PlacesDBUtils = {
)`,
params: {}
};
fixOrphanItems.params.unsorted_folder = PlacesUtils.unfiledBookmarksFolderId;
fixOrphanItems.params.rootGuid = PlacesUtils.bookmarks.rootGuid;
fixOrphanItems.params.menuGuid = PlacesUtils.bookmarks.menuGuid;
fixOrphanItems.params.toolbarGuid = PlacesUtils.bookmarks.toolbarGuid;
fixOrphanItems.params.unfiledGuid = PlacesUtils.bookmarks.unfiledGuid;
fixOrphanItems.params.tagsGuid = PlacesUtils.bookmarks.tagsGuid;
fixOrphanItems.params["unsorted_folder"] = PlacesUtils.unfiledBookmarksFolderId;
fixOrphanItems.params["rootGuid"] = PlacesUtils.bookmarks.rootGuid;
fixOrphanItems.params["menuGuid"] = PlacesUtils.bookmarks.menuGuid;
fixOrphanItems.params["toolbarGuid"] = PlacesUtils.bookmarks.toolbarGuid;
fixOrphanItems.params["unfiledGuid"] = PlacesUtils.bookmarks.unfiledGuid;
fixOrphanItems.params["tagsGuid"] = PlacesUtils.bookmarks.tagsGuid;
cleanupStatements.push(fixOrphanItems);
// D.6 fix wrong item types
@ -497,14 +497,14 @@ this.PlacesDBUtils = {
)`,
params: {}
};
fixBookmarksAsFolders.params.bookmark_type = PlacesUtils.bookmarks.TYPE_BOOKMARK;
fixBookmarksAsFolders.params.folder_type = PlacesUtils.bookmarks.TYPE_FOLDER;
fixBookmarksAsFolders.params.separator_type = PlacesUtils.bookmarks.TYPE_SEPARATOR;
fixBookmarksAsFolders.params.rootGuid = PlacesUtils.bookmarks.rootGuid;
fixBookmarksAsFolders.params.menuGuid = PlacesUtils.bookmarks.menuGuid;
fixBookmarksAsFolders.params.toolbarGuid = PlacesUtils.bookmarks.toolbarGuid;
fixBookmarksAsFolders.params.unfiledGuid = PlacesUtils.bookmarks.unfiledGuid;
fixBookmarksAsFolders.params.tagsGuid = PlacesUtils.bookmarks.tagsGuid;
fixBookmarksAsFolders.params["bookmark_type"] = PlacesUtils.bookmarks.TYPE_BOOKMARK;
fixBookmarksAsFolders.params["folder_type"] = PlacesUtils.bookmarks.TYPE_FOLDER;
fixBookmarksAsFolders.params["separator_type"] = PlacesUtils.bookmarks.TYPE_SEPARATOR;
fixBookmarksAsFolders.params["rootGuid"] = PlacesUtils.bookmarks.rootGuid;
fixBookmarksAsFolders.params["menuGuid"] = PlacesUtils.bookmarks.menuGuid;
fixBookmarksAsFolders.params["toolbarGuid"] = PlacesUtils.bookmarks.toolbarGuid;
fixBookmarksAsFolders.params["unfiledGuid"] = PlacesUtils.bookmarks.unfiledGuid;
fixBookmarksAsFolders.params["tagsGuid"] = PlacesUtils.bookmarks.tagsGuid;
cleanupStatements.push(fixBookmarksAsFolders);
// D.7 fix wrong item types
@ -521,13 +521,13 @@ this.PlacesDBUtils = {
)`,
params: {}
};
fixFoldersAsBookmarks.params.bookmark_type = PlacesUtils.bookmarks.TYPE_BOOKMARK;
fixFoldersAsBookmarks.params.folder_type = PlacesUtils.bookmarks.TYPE_FOLDER;
fixFoldersAsBookmarks.params.rootGuid = PlacesUtils.bookmarks.rootGuid;
fixFoldersAsBookmarks.params.menuGuid = PlacesUtils.bookmarks.menuGuid;
fixFoldersAsBookmarks.params.toolbarGuid = PlacesUtils.bookmarks.toolbarGuid;
fixFoldersAsBookmarks.params.unfiledGuid = PlacesUtils.bookmarks.unfiledGuid;
fixFoldersAsBookmarks.params.tagsGuid = PlacesUtils.bookmarks.tagsGuid;
fixFoldersAsBookmarks.params["bookmark_type"] = PlacesUtils.bookmarks.TYPE_BOOKMARK;
fixFoldersAsBookmarks.params["folder_type"] = PlacesUtils.bookmarks.TYPE_FOLDER;
fixFoldersAsBookmarks.params["rootGuid"] = PlacesUtils.bookmarks.rootGuid;
fixFoldersAsBookmarks.params["menuGuid"] = PlacesUtils.bookmarks.menuGuid;
fixFoldersAsBookmarks.params["toolbarGuid"] = PlacesUtils.bookmarks.toolbarGuid;
fixFoldersAsBookmarks.params["unfiledGuid"] = PlacesUtils.bookmarks.unfiledGuid;
fixFoldersAsBookmarks.params["tagsGuid"] = PlacesUtils.bookmarks.tagsGuid;
cleanupStatements.push(fixFoldersAsBookmarks);
// D.9 fix wrong parents
@ -546,14 +546,14 @@ this.PlacesDBUtils = {
)`,
params: {}
};
fixInvalidParents.params.unsorted_folder = PlacesUtils.unfiledBookmarksFolderId;
fixInvalidParents.params.bookmark_type = PlacesUtils.bookmarks.TYPE_BOOKMARK;
fixInvalidParents.params.separator_type = PlacesUtils.bookmarks.TYPE_SEPARATOR;
fixInvalidParents.params.rootGuid = PlacesUtils.bookmarks.rootGuid;
fixInvalidParents.params.menuGuid = PlacesUtils.bookmarks.menuGuid;
fixInvalidParents.params.toolbarGuid = PlacesUtils.bookmarks.toolbarGuid;
fixInvalidParents.params.unfiledGuid = PlacesUtils.bookmarks.unfiledGuid;
fixInvalidParents.params.tagsGuid = PlacesUtils.bookmarks.tagsGuid;
fixInvalidParents.params["unsorted_folder"] = PlacesUtils.unfiledBookmarksFolderId;
fixInvalidParents.params["bookmark_type"] = PlacesUtils.bookmarks.TYPE_BOOKMARK;
fixInvalidParents.params["separator_type"] = PlacesUtils.bookmarks.TYPE_SEPARATOR;
fixInvalidParents.params["rootGuid"] = PlacesUtils.bookmarks.rootGuid;
fixInvalidParents.params["menuGuid"] = PlacesUtils.bookmarks.menuGuid;
fixInvalidParents.params["toolbarGuid"] = PlacesUtils.bookmarks.toolbarGuid;
fixInvalidParents.params["unfiledGuid"] = PlacesUtils.bookmarks.unfiledGuid;
fixInvalidParents.params["tagsGuid"] = PlacesUtils.bookmarks.tagsGuid;
cleanupStatements.push(fixInvalidParents);
// D.10 recalculate positions
@ -627,9 +627,9 @@ this.PlacesDBUtils = {
AND parent = :tags_folder`,
params: {}
};
fixEmptyNamedTags.params.empty_title = "(notitle)";
fixEmptyNamedTags.params.folder_type = PlacesUtils.bookmarks.TYPE_FOLDER;
fixEmptyNamedTags.params.tags_folder = PlacesUtils.tagsFolderId;
fixEmptyNamedTags.params["empty_title"] = "(notitle)";
fixEmptyNamedTags.params["folder_type"] = PlacesUtils.bookmarks.TYPE_FOLDER;
fixEmptyNamedTags.params["tags_folder"] = PlacesUtils.tagsFolderId;
cleanupStatements.push(fixEmptyNamedTags);
// MOZ_ICONS

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

@ -802,12 +802,12 @@ nsPlacesExpiration.prototype = {
* invoked on success, function (aPagesCount).
*/
_getPagesStats: function PEX__getPagesStats(aCallback) {
if (!this._cachedStatements.LIMIT_COUNT) {
this._cachedStatements.LIMIT_COUNT = this._db.createAsyncStatement(
if (!this._cachedStatements["LIMIT_COUNT"]) {
this._cachedStatements["LIMIT_COUNT"] = this._db.createAsyncStatement(
`SELECT COUNT(*) FROM moz_places`
);
}
this._cachedStatements.LIMIT_COUNT.executeAsync({
this._cachedStatements["LIMIT_COUNT"].executeAsync({
_pagesCount: 0,
handleResult(aResults) {
let row = aResults.getNextRow();

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

@ -43,21 +43,21 @@ function addPlace(aUrl, aFavicon) {
let href = new URL(aUrl || "http://www.mozilla.org").href;
let stmt = mDBConn.createStatement(
"INSERT INTO moz_places (url, url_hash) VALUES (:url, hash(:url))");
stmt.params.url = href;
stmt.params["url"] = href;
stmt.execute();
stmt.finalize();
let id = mDBConn.lastInsertRowID;
if (aFavicon) {
stmt = mDBConn.createStatement(
"INSERT INTO moz_pages_w_icons (page_url, page_url_hash) VALUES (:url, hash(:url))");
stmt.params.url = href;
stmt.params["url"] = href;
stmt.execute();
stmt.finalize();
stmt = mDBConn.createStatement(
"INSERT INTO moz_icons_to_pages (page_id, icon_id) " +
"VALUES ((SELECT id FROM moz_pages_w_icons WHERE page_url_hash = hash(:url)), :favicon)");
stmt.params.url = href;
stmt.params.favicon = aFavicon;
stmt.params["url"] = href;
stmt.params["favicon"] = aFavicon;
stmt.execute();
stmt.finalize();
}
@ -70,12 +70,12 @@ function addBookmark(aPlaceId, aType, aParent, aKeywordId, aFolderType, aTitle)
title, guid)
VALUES (:place_id, :type, :parent, :keyword_id, :folder_type, :title,
GENERATE_GUID())`);
stmt.params.place_id = aPlaceId || null;
stmt.params.type = aType || bs.TYPE_BOOKMARK;
stmt.params.parent = aParent || bs.unfiledBookmarksFolder;
stmt.params.keyword_id = aKeywordId || null;
stmt.params.folder_type = aFolderType || null;
stmt.params.title = typeof(aTitle) == "string" ? aTitle : null;
stmt.params["place_id"] = aPlaceId || null;
stmt.params["type"] = aType || bs.TYPE_BOOKMARK;
stmt.params["parent"] = aParent || bs.unfiledBookmarksFolder;
stmt.params["keyword_id"] = aKeywordId || null;
stmt.params["folder_type"] = aFolderType || null;
stmt.params["title"] = typeof(aTitle) == "string" ? aTitle : null;
stmt.execute();
stmt.finalize();
return mDBConn.lastInsertRowID;
@ -102,7 +102,7 @@ tests.push({
let stmt = mDBConn.createStatement(
"INSERT INTO moz_anno_attributes (name) VALUES (:anno)"
);
stmt.params.anno = this._obsoleteWeaveAttribute;
stmt.params["anno"] = this._obsoleteWeaveAttribute;
stmt.execute();
stmt.finalize();
stmt = mDBConn.createStatement(
@ -111,8 +111,8 @@ tests.push({
(SELECT id FROM moz_anno_attributes WHERE name = :anno)
)`
);
stmt.params.place_id = this._placeId;
stmt.params.anno = this._obsoleteWeaveAttribute;
stmt.params["place_id"] = this._placeId;
stmt.params["anno"] = this._obsoleteWeaveAttribute;
stmt.execute();
stmt.finalize();
},
@ -122,7 +122,7 @@ tests.push({
let stmt = mDBConn.createStatement(
"SELECT id FROM moz_anno_attributes WHERE name = :anno"
);
stmt.params.anno = this._obsoleteWeaveAttribute;
stmt.params["anno"] = this._obsoleteWeaveAttribute;
do_check_false(stmt.executeStep());
stmt.finalize();
}
@ -148,9 +148,9 @@ tests.push({
`INSERT INTO moz_anno_attributes (name)
VALUES (:anno1), (:anno2), (:anno3)`
);
stmt.params.anno1 = this._obsoleteSyncAttribute;
stmt.params.anno2 = this._obsoleteGuidAttribute;
stmt.params.anno3 = this._obsoleteWeaveAttribute;
stmt.params["anno1"] = this._obsoleteSyncAttribute;
stmt.params["anno2"] = this._obsoleteGuidAttribute;
stmt.params["anno3"] = this._obsoleteWeaveAttribute;
stmt.execute();
stmt.finalize();
stmt = mDBConn.createStatement(
@ -159,10 +159,10 @@ tests.push({
FROM moz_anno_attributes
WHERE name IN (:anno1, :anno2, :anno3)`
);
stmt.params.item_id = this._bookmarkId;
stmt.params.anno1 = this._obsoleteSyncAttribute;
stmt.params.anno2 = this._obsoleteGuidAttribute;
stmt.params.anno3 = this._obsoleteWeaveAttribute;
stmt.params["item_id"] = this._bookmarkId;
stmt.params["anno1"] = this._obsoleteSyncAttribute;
stmt.params["anno2"] = this._obsoleteGuidAttribute;
stmt.params["anno3"] = this._obsoleteWeaveAttribute;
stmt.execute();
stmt.finalize();
},
@ -173,9 +173,9 @@ tests.push({
`SELECT id FROM moz_anno_attributes
WHERE name IN (:anno1, :anno2, :anno3)`
);
stmt.params.anno1 = this._obsoleteSyncAttribute;
stmt.params.anno2 = this._obsoleteGuidAttribute;
stmt.params.anno3 = this._obsoleteWeaveAttribute;
stmt.params["anno1"] = this._obsoleteSyncAttribute;
stmt.params["anno2"] = this._obsoleteGuidAttribute;
stmt.params["anno3"] = this._obsoleteWeaveAttribute;
do_check_false(stmt.executeStep());
stmt.finalize();
}
@ -198,24 +198,24 @@ tests.push({
this._bookmarkId = addBookmark(this._placeId);
// Add a used attribute and an unused one.
let stmt = mDBConn.createStatement("INSERT INTO moz_anno_attributes (name) VALUES (:anno)");
stmt.params.anno = this._usedPageAttribute;
stmt.params["anno"] = this._usedPageAttribute;
stmt.execute();
stmt.reset();
stmt.params.anno = this._usedItemAttribute;
stmt.params["anno"] = this._usedItemAttribute;
stmt.execute();
stmt.reset();
stmt.params.anno = this._unusedAttribute;
stmt.params["anno"] = this._unusedAttribute;
stmt.execute();
stmt.finalize();
stmt = mDBConn.createStatement("INSERT INTO moz_annos (place_id, anno_attribute_id) VALUES(:place_id, (SELECT id FROM moz_anno_attributes WHERE name = :anno))");
stmt.params.place_id = this._placeId;
stmt.params.anno = this._usedPageAttribute;
stmt.params["place_id"] = this._placeId;
stmt.params["anno"] = this._usedPageAttribute;
stmt.execute();
stmt.finalize();
stmt = mDBConn.createStatement("INSERT INTO moz_items_annos (item_id, anno_attribute_id) VALUES(:item_id, (SELECT id FROM moz_anno_attributes WHERE name = :anno))");
stmt.params.item_id = this._bookmarkId;
stmt.params.anno = this._usedItemAttribute;
stmt.params["item_id"] = this._bookmarkId;
stmt.params["anno"] = this._usedItemAttribute;
stmt.execute();
stmt.finalize();
},
@ -223,14 +223,14 @@ tests.push({
check() {
// Check that used attributes are still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_anno_attributes WHERE name = :anno");
stmt.params.anno = this._usedPageAttribute;
stmt.params["anno"] = this._usedPageAttribute;
do_check_true(stmt.executeStep());
stmt.reset();
stmt.params.anno = this._usedItemAttribute;
stmt.params["anno"] = this._usedItemAttribute;
do_check_true(stmt.executeStep());
stmt.reset();
// Check that unused attribute has been removed
stmt.params.anno = this._unusedAttribute;
stmt.params["anno"] = this._unusedAttribute;
do_check_false(stmt.executeStep());
stmt.finalize();
}
@ -250,17 +250,17 @@ tests.push({
this._placeId = addPlace();
// Add a used attribute.
let stmt = mDBConn.createStatement("INSERT INTO moz_anno_attributes (name) VALUES (:anno)");
stmt.params.anno = this._usedPageAttribute;
stmt.params["anno"] = this._usedPageAttribute;
stmt.execute();
stmt.finalize();
stmt = mDBConn.createStatement("INSERT INTO moz_annos (place_id, anno_attribute_id) VALUES(:place_id, (SELECT id FROM moz_anno_attributes WHERE name = :anno))");
stmt.params.place_id = this._placeId;
stmt.params.anno = this._usedPageAttribute;
stmt.params["place_id"] = this._placeId;
stmt.params["anno"] = this._usedPageAttribute;
stmt.execute();
stmt.finalize();
// Add an annotation with a nonexistent attribute
stmt = mDBConn.createStatement("INSERT INTO moz_annos (place_id, anno_attribute_id) VALUES(:place_id, 1337)");
stmt.params.place_id = this._placeId;
stmt.params["place_id"] = this._placeId;
stmt.execute();
stmt.finalize();
},
@ -268,12 +268,12 @@ tests.push({
check() {
// Check that used attribute is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_anno_attributes WHERE name = :anno");
stmt.params.anno = this._usedPageAttribute;
stmt.params["anno"] = this._usedPageAttribute;
do_check_true(stmt.executeStep());
stmt.finalize();
// check that annotation with valid attribute is still there
stmt = mDBConn.createStatement("SELECT id FROM moz_annos WHERE anno_attribute_id = (SELECT id FROM moz_anno_attributes WHERE name = :anno)");
stmt.params.anno = this._usedPageAttribute;
stmt.params["anno"] = this._usedPageAttribute;
do_check_true(stmt.executeStep());
stmt.finalize();
// Check that annotation with bogus attribute has been removed
@ -297,17 +297,17 @@ tests.push({
this._placeId = addPlace();
// Add a used attribute.
let stmt = mDBConn.createStatement("INSERT INTO moz_anno_attributes (name) VALUES (:anno)");
stmt.params.anno = this._usedPageAttribute;
stmt.params["anno"] = this._usedPageAttribute;
stmt.execute();
stmt.finalize();
stmt = mDBConn.createStatement("INSERT INTO moz_annos (place_id, anno_attribute_id) VALUES(:place_id, (SELECT id FROM moz_anno_attributes WHERE name = :anno))");
stmt.params.place_id = this._placeId;
stmt.params.anno = this._usedPageAttribute;
stmt.params["place_id"] = this._placeId;
stmt.params["anno"] = this._usedPageAttribute;
stmt.execute();
stmt.reset();
// Add an annotation to a nonexistent page
stmt.params.place_id = 1337;
stmt.params.anno = this._usedPageAttribute;
stmt.params["place_id"] = 1337;
stmt.params["anno"] = this._usedPageAttribute;
stmt.execute();
stmt.finalize();
},
@ -315,12 +315,12 @@ tests.push({
check() {
// Check that used attribute is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_anno_attributes WHERE name = :anno");
stmt.params.anno = this._usedPageAttribute;
stmt.params["anno"] = this._usedPageAttribute;
do_check_true(stmt.executeStep());
stmt.finalize();
// check that annotation with valid attribute is still there
stmt = mDBConn.createStatement("SELECT id FROM moz_annos WHERE anno_attribute_id = (SELECT id FROM moz_anno_attributes WHERE name = :anno)");
stmt.params.anno = this._usedPageAttribute;
stmt.params["anno"] = this._usedPageAttribute;
do_check_true(stmt.executeStep());
stmt.finalize();
// Check that an annotation to a nonexistent page has been removed
@ -411,11 +411,11 @@ tests.push({
check() {
// Check that valid bookmark is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_bookmarks WHERE id = :item_id");
stmt.params.item_id = this._validItemId;
stmt.params["item_id"] = this._validItemId;
do_check_true(stmt.executeStep());
stmt.reset();
// Check that invalid bookmark has been removed
stmt.params.item_id = this._invalidItemId;
stmt.params["item_id"] = this._invalidItemId;
do_check_false(stmt.executeStep());
stmt.finalize();
}
@ -449,18 +449,18 @@ tests.push({
check() {
// Check that valid bookmark is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_bookmarks WHERE type = :type AND parent = :parent");
stmt.params.type = bs.TYPE_BOOKMARK;
stmt.params.parent = this._tagId;
stmt.params["type"] = bs.TYPE_BOOKMARK;
stmt.params["parent"] = this._tagId;
do_check_true(stmt.executeStep());
stmt.reset();
// Check that separator is no more there
stmt.params.type = bs.TYPE_SEPARATOR;
stmt.params.parent = this._tagId;
stmt.params["type"] = bs.TYPE_SEPARATOR;
stmt.params["parent"] = this._tagId;
do_check_false(stmt.executeStep());
stmt.reset();
// Check that folder is no more there
stmt.params.type = bs.TYPE_FOLDER;
stmt.params.parent = this._tagId;
stmt.params["type"] = bs.TYPE_FOLDER;
stmt.params["parent"] = this._tagId;
do_check_false(stmt.executeStep());
stmt.finalize();
}
@ -491,19 +491,19 @@ tests.push({
check() {
// Check that valid bookmark is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_bookmarks WHERE id = :id AND type = :type AND parent = :parent");
stmt.params.id = this._bookmarkId;
stmt.params.type = bs.TYPE_BOOKMARK;
stmt.params.parent = this._tagId;
stmt.params["id"] = this._bookmarkId;
stmt.params["type"] = bs.TYPE_BOOKMARK;
stmt.params["parent"] = this._tagId;
do_check_true(stmt.executeStep());
stmt.reset();
stmt.params.id = this._tagId;
stmt.params.type = bs.TYPE_FOLDER;
stmt.params.parent = bs.tagsFolder;
stmt.params["id"] = this._tagId;
stmt.params["type"] = bs.TYPE_FOLDER;
stmt.params["parent"] = bs.tagsFolder;
do_check_true(stmt.executeStep());
stmt.reset();
stmt.params.id = this._emptyTagId;
stmt.params.type = bs.TYPE_FOLDER;
stmt.params.parent = bs.tagsFolder;
stmt.params["id"] = this._emptyTagId;
stmt.params["type"] = bs.TYPE_FOLDER;
stmt.params["parent"] = bs.tagsFolder;
do_check_false(stmt.executeStep());
stmt.finalize();
}
@ -537,20 +537,20 @@ tests.push({
check() {
// Check that bookmarks are now children of a real folder (unsorted)
let stmt = mDBConn.createStatement("SELECT id FROM moz_bookmarks WHERE id = :item_id AND parent = :parent");
stmt.params.item_id = this._orphanBookmarkId;
stmt.params.parent = bs.unfiledBookmarksFolder;
stmt.params["item_id"] = this._orphanBookmarkId;
stmt.params["parent"] = bs.unfiledBookmarksFolder;
do_check_true(stmt.executeStep());
stmt.reset();
stmt.params.item_id = this._orphanSeparatorId;
stmt.params.parent = bs.unfiledBookmarksFolder;
stmt.params["item_id"] = this._orphanSeparatorId;
stmt.params["parent"] = bs.unfiledBookmarksFolder;
do_check_true(stmt.executeStep());
stmt.reset();
stmt.params.item_id = this._orphanFolderId;
stmt.params.parent = bs.unfiledBookmarksFolder;
stmt.params["item_id"] = this._orphanFolderId;
stmt.params["parent"] = bs.unfiledBookmarksFolder;
do_check_true(stmt.executeStep());
stmt.reset();
stmt.params.item_id = this._bookmarkId;
stmt.params.parent = this._orphanFolderId;
stmt.params["item_id"] = this._bookmarkId;
stmt.params["parent"] = this._orphanFolderId;
do_check_true(stmt.executeStep());
stmt.finalize();
}
@ -578,12 +578,12 @@ tests.push({
check() {
// Check that items with an fk have been converted to bookmarks
let stmt = mDBConn.createStatement("SELECT id FROM moz_bookmarks WHERE id = :item_id AND type = :type");
stmt.params.item_id = this._separatorId;
stmt.params.type = bs.TYPE_BOOKMARK;
stmt.params["item_id"] = this._separatorId;
stmt.params["type"] = bs.TYPE_BOOKMARK;
do_check_true(stmt.executeStep());
stmt.reset();
stmt.params.item_id = this._folderId;
stmt.params.type = bs.TYPE_BOOKMARK;
stmt.params["item_id"] = this._folderId;
stmt.params["type"] = bs.TYPE_BOOKMARK;
do_check_true(stmt.executeStep());
stmt.finalize();
}
@ -611,13 +611,13 @@ tests.push({
check() {
// Check valid bookmark
let stmt = mDBConn.createStatement("SELECT id FROM moz_bookmarks WHERE id = :item_id AND type = :type");
stmt.params.item_id = this._validBookmarkId;
stmt.params.type = bs.TYPE_BOOKMARK;
stmt.params["item_id"] = this._validBookmarkId;
stmt.params["type"] = bs.TYPE_BOOKMARK;
do_check_true(stmt.executeStep());
stmt.reset();
// Check invalid bookmark has been converted to a folder
stmt.params.item_id = this._invalidBookmarkId;
stmt.params.type = bs.TYPE_FOLDER;
stmt.params["item_id"] = this._invalidBookmarkId;
stmt.params["type"] = bs.TYPE_FOLDER;
do_check_true(stmt.executeStep());
stmt.finalize();
}
@ -650,12 +650,12 @@ tests.push({
check() {
// Check that bookmarks are now children of a real folder (unsorted)
let stmt = mDBConn.createStatement("SELECT id FROM moz_bookmarks WHERE id = :item_id AND parent = :parent");
stmt.params.item_id = this._bookmarkId1;
stmt.params.parent = bs.unfiledBookmarksFolder;
stmt.params["item_id"] = this._bookmarkId1;
stmt.params["parent"] = bs.unfiledBookmarksFolder;
do_check_true(stmt.executeStep());
stmt.reset();
stmt.params.item_id = this._bookmarkId2;
stmt.params.parent = bs.unfiledBookmarksFolder;
stmt.params["item_id"] = this._bookmarkId2;
stmt.params["parent"] = bs.unfiledBookmarksFolder;
do_check_true(stmt.executeStep());
stmt.finalize();
}
@ -697,8 +697,8 @@ tests.push({
)`
);
for (let i = 0; i < (NUM_BOOKMARKS / 2); i++) {
stmt.params.parent = aParent;
stmt.params.rand = Math.round(Math.random() * (NUM_BOOKMARKS - 1));
stmt.params["parent"] = aParent;
stmt.params["rand"] = Math.round(Math.random() * (NUM_BOOKMARKS - 1));
stmt.execute();
stmt.reset();
}
@ -710,7 +710,7 @@ tests.push({
FROM moz_bookmarks WHERE parent = :parent
ORDER BY position ASC, ROWID ASC`
);
stmt.params.parent = aParent;
stmt.params["parent"] = aParent;
while (stmt.executeStep()) {
aResultArray.push(stmt.row.id);
print(stmt.row.id + "\t" + stmt.row.position + "\t" +
@ -732,7 +732,7 @@ tests.push({
`SELECT id, position FROM moz_bookmarks WHERE parent = :parent
ORDER BY position ASC`
);
stmt.params.parent = aParent;
stmt.params["parent"] = aParent;
let pass = true;
while (stmt.executeStep()) {
print(stmt.row.id + "\t" + stmt.row.position);
@ -780,19 +780,19 @@ tests.push({
let stmt = mDBConn.createStatement(
"SELECT title FROM moz_bookmarks WHERE id = :id"
);
stmt.params.id = this._untitledTagId;
stmt.params["id"] = this._untitledTagId;
do_check_true(stmt.executeStep());
do_check_eq(stmt.row.title, "(notitle)");
stmt.reset();
stmt.params.id = this._untitledFolderId;
stmt.params["id"] = this._untitledFolderId;
do_check_true(stmt.executeStep());
do_check_eq(stmt.row.title, "");
stmt.reset();
stmt.params.id = this._titledTagId;
stmt.params["id"] = this._titledTagId;
do_check_true(stmt.executeStep());
do_check_eq(stmt.row.title, "titledTag");
stmt.reset();
stmt.params.id = this._titledFolderId;
stmt.params["id"] = this._titledFolderId;
do_check_true(stmt.executeStep());
do_check_eq(stmt.row.title, "titledFolder");
stmt.finalize();
@ -810,18 +810,18 @@ tests.push({
setup() {
// Insert favicon entries
let stmt = mDBConn.createStatement("INSERT INTO moz_icons (id, icon_url, fixed_icon_url_hash) VALUES(:favicon_id, :url, hash(fixup_url(:url)))");
stmt.params.favicon_id = 1;
stmt.params.url = "http://www1.mozilla.org/favicon.ico";
stmt.params["favicon_id"] = 1;
stmt.params["url"] = "http://www1.mozilla.org/favicon.ico";
stmt.execute();
stmt.reset();
stmt.params.favicon_id = 2;
stmt.params.url = "http://www2.mozilla.org/favicon.ico";
stmt.params["favicon_id"] = 2;
stmt.params["url"] = "http://www2.mozilla.org/favicon.ico";
stmt.execute();
stmt.finalize();
// Insert orphan page.
stmt = mDBConn.createStatement("INSERT INTO moz_pages_w_icons (id, page_url, page_url_hash) VALUES(:page_id, :url, hash(:url))");
stmt.params.page_id = 99;
stmt.params.url = "http://w99.mozilla.org/";
stmt.params["page_id"] = 99;
stmt.params["url"] = "http://w99.mozilla.org/";
stmt.execute();
stmt.finalize();
@ -832,16 +832,16 @@ tests.push({
check() {
// Check that used icon is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_icons WHERE id = :favicon_id");
stmt.params.favicon_id = 1;
stmt.params["favicon_id"] = 1;
do_check_true(stmt.executeStep());
stmt.reset();
// Check that unused icon has been removed
stmt.params.favicon_id = 2;
stmt.params["favicon_id"] = 2;
do_check_false(stmt.executeStep());
stmt.finalize();
// Check that the orphan page is gone.
stmt = mDBConn.createStatement("SELECT id FROM moz_pages_w_icons WHERE id = :page_id");
stmt.params.page_id = 99;
stmt.params["page_id"] = 99;
do_check_false(stmt.executeStep());
stmt.finalize();
}
@ -861,10 +861,10 @@ tests.push({
this._placeId = addPlace();
// Add a valid visit and an invalid one
let stmt = mDBConn.createStatement("INSERT INTO moz_historyvisits(place_id) VALUES (:place_id)");
stmt.params.place_id = this._placeId;
stmt.params["place_id"] = this._placeId;
stmt.execute();
stmt.reset();
stmt.params.place_id = this._invalidPlaceId;
stmt.params["place_id"] = this._invalidPlaceId;
stmt.execute();
stmt.finalize();
},
@ -872,11 +872,11 @@ tests.push({
check() {
// Check that valid visit is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_historyvisits WHERE place_id = :place_id");
stmt.params.place_id = this._placeId;
stmt.params["place_id"] = this._placeId;
do_check_true(stmt.executeStep());
stmt.reset();
// Check that invalid visit has been removed
stmt.params.place_id = this._invalidPlaceId;
stmt.params["place_id"] = this._invalidPlaceId;
do_check_false(stmt.executeStep());
stmt.finalize();
}
@ -896,12 +896,12 @@ tests.push({
this._placeId = addPlace();
// Add input history entries
let stmt = mDBConn.createStatement("INSERT INTO moz_inputhistory (place_id, input) VALUES (:place_id, :input)");
stmt.params.place_id = this._placeId;
stmt.params.input = "moz";
stmt.params["place_id"] = this._placeId;
stmt.params["input"] = "moz";
stmt.execute();
stmt.reset();
stmt.params.place_id = this._invalidPlaceId;
stmt.params.input = "moz";
stmt.params["place_id"] = this._invalidPlaceId;
stmt.params["input"] = "moz";
stmt.execute();
stmt.finalize();
},
@ -909,11 +909,11 @@ tests.push({
check() {
// Check that inputhistory on valid place is still there
let stmt = mDBConn.createStatement("SELECT place_id FROM moz_inputhistory WHERE place_id = :place_id");
stmt.params.place_id = this._placeId;
stmt.params["place_id"] = this._placeId;
do_check_true(stmt.executeStep());
stmt.reset();
// Check that inputhistory on invalid place has gone
stmt.params.place_id = this._invalidPlaceId;
stmt.params["place_id"] = this._invalidPlaceId;
do_check_false(stmt.executeStep());
stmt.finalize();
}
@ -936,17 +936,17 @@ tests.push({
this._bookmarkId = addBookmark(this._placeId);
// Add a used attribute.
let stmt = mDBConn.createStatement("INSERT INTO moz_anno_attributes (name) VALUES (:anno)");
stmt.params.anno = this._usedItemAttribute;
stmt.params["anno"] = this._usedItemAttribute;
stmt.execute();
stmt.finalize();
stmt = mDBConn.createStatement("INSERT INTO moz_items_annos (item_id, anno_attribute_id) VALUES(:item_id, (SELECT id FROM moz_anno_attributes WHERE name = :anno))");
stmt.params.item_id = this._bookmarkId;
stmt.params.anno = this._usedItemAttribute;
stmt.params["item_id"] = this._bookmarkId;
stmt.params["anno"] = this._usedItemAttribute;
stmt.execute();
stmt.finalize();
// Add an annotation with a nonexistent attribute
stmt = mDBConn.createStatement("INSERT INTO moz_items_annos (item_id, anno_attribute_id) VALUES(:item_id, 1337)");
stmt.params.item_id = this._bookmarkId;
stmt.params["item_id"] = this._bookmarkId;
stmt.execute();
stmt.finalize();
},
@ -954,12 +954,12 @@ tests.push({
check() {
// Check that used attribute is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_anno_attributes WHERE name = :anno");
stmt.params.anno = this._usedItemAttribute;
stmt.params["anno"] = this._usedItemAttribute;
do_check_true(stmt.executeStep());
stmt.finalize();
// check that annotation with valid attribute is still there
stmt = mDBConn.createStatement("SELECT id FROM moz_items_annos WHERE anno_attribute_id = (SELECT id FROM moz_anno_attributes WHERE name = :anno)");
stmt.params.anno = this._usedItemAttribute;
stmt.params["anno"] = this._usedItemAttribute;
do_check_true(stmt.executeStep());
stmt.finalize();
// Check that annotation with bogus attribute has been removed
@ -987,17 +987,17 @@ tests.push({
this._bookmarkId = addBookmark(this._placeId);
// Add a used attribute.
let stmt = mDBConn.createStatement("INSERT INTO moz_anno_attributes (name) VALUES (:anno)");
stmt.params.anno = this._usedItemAttribute;
stmt.params["anno"] = this._usedItemAttribute;
stmt.execute();
stmt.finalize();
stmt = mDBConn.createStatement("INSERT INTO moz_items_annos (item_id, anno_attribute_id) VALUES (:item_id, (SELECT id FROM moz_anno_attributes WHERE name = :anno))");
stmt.params.item_id = this._bookmarkId;
stmt.params.anno = this._usedItemAttribute;
stmt.params["item_id"] = this._bookmarkId;
stmt.params["anno"] = this._usedItemAttribute;
stmt.execute();
stmt.reset();
// Add an annotation to a nonexistent item
stmt.params.item_id = this._invalidBookmarkId;
stmt.params.anno = this._usedItemAttribute;
stmt.params["item_id"] = this._invalidBookmarkId;
stmt.params["anno"] = this._usedItemAttribute;
stmt.execute();
stmt.finalize();
},
@ -1005,12 +1005,12 @@ tests.push({
check() {
// Check that used attribute is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_anno_attributes WHERE name = :anno");
stmt.params.anno = this._usedItemAttribute;
stmt.params["anno"] = this._usedItemAttribute;
do_check_true(stmt.executeStep());
stmt.finalize();
// check that annotation with valid attribute is still there
stmt = mDBConn.createStatement("SELECT id FROM moz_items_annos WHERE anno_attribute_id = (SELECT id FROM moz_anno_attributes WHERE name = :anno)");
stmt.params.anno = this._usedItemAttribute;
stmt.params["anno"] = this._usedItemAttribute;
do_check_true(stmt.executeStep());
stmt.finalize();
// Check that an annotation to a nonexistent page has been removed
@ -1033,9 +1033,9 @@ tests.push({
setup() {
// Insert 2 keywords
let stmt = mDBConn.createStatement("INSERT INTO moz_keywords (id, keyword, place_id) VALUES(:id, :keyword, :place_id)");
stmt.params.id = 1;
stmt.params.keyword = "unused";
stmt.params.place_id = 100;
stmt.params["id"] = 1;
stmt.params["keyword"] = "unused";
stmt.params["place_id"] = 100;
stmt.execute();
stmt.finalize();
},
@ -1044,7 +1044,7 @@ tests.push({
// Check that "used" keyword is still there
let stmt = mDBConn.createStatement("SELECT id FROM moz_keywords WHERE keyword = :keyword");
// Check that "unused" keyword has gone
stmt.params.keyword = "unused";
stmt.params["keyword"] = "unused";
do_check_false(stmt.executeStep());
stmt.finalize();
}

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

@ -34,7 +34,7 @@ XPCOMUtils.defineLazyGetter(this, "Readability", function() {
let scope = {};
scope.dump = this.dump;
Services.scriptloader.loadSubScript("resource://gre/modules/reader/Readability.js", scope);
return scope.Readability;
return scope["Readability"];
});
const gIsFirefoxDesktop = Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";

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

@ -14,6 +14,7 @@ module.exports = {
}],
curly: ["error", "all"],
"dot-location": ["error", "property"],
"dot-notation": "error",
"generator-star-spacing": ["error", "after"],
indent: ["error", 2, {
SwitchCase: 1,

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

@ -2196,7 +2196,7 @@ Engine.prototype = {
appPath = appPath.spec;
let spec = uri.spec;
if (spec.includes(appPath)) {
let appURI = Services.io.newFileURI(getDir(knownDirs.app));
let appURI = Services.io.newFileURI(getDir(knownDirs["app"]));
uri = Services.io.newURI(spec.replace(appPath, appURI.spec));
}
}
@ -3636,7 +3636,7 @@ SearchService.prototype = {
if (!("visibleDefaultEngines" in searchSettings[region])) {
continue;
}
for (let engine of searchSettings[region].visibleDefaultEngines) {
for (let engine of searchSettings[region]["visibleDefaultEngines"]) {
jarNames.add(engine);
}
}
@ -3667,7 +3667,7 @@ SearchService.prototype = {
if (!region || !(region in searchSettings)) {
region = "default";
}
engineNames = searchSettings[region].visibleDefaultEngines;
engineNames = searchSettings[region]["visibleDefaultEngines"];
}
// Remove any engine names that are supposed to be ignored.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше