From 685be2bc64f13689a9a161e232b716abd29edeb1 Mon Sep 17 00:00:00 2001 From: Girish Sharma Date: Sun, 31 Aug 2014 21:00:34 +0530 Subject: [PATCH 1/2] Bug 1060835 - Fix storage.properties strings and add separate strings for web menu and panel items, r=paul --- browser/devtools/main.js | 8 ++-- .../browser/devtools/storage.properties | 48 ++++++++++++------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/browser/devtools/main.js b/browser/devtools/main.js index 84426af4494..795421d2096 100644 --- a/browser/devtools/main.js +++ b/browser/devtools/main.js @@ -321,16 +321,18 @@ Tools.netMonitor = { Tools.storage = { id: "storage", - key: l10n("open.commandkey", storageStrings), + key: l10n("storage.commandkey", storageStrings), ordinal: 9, - accesskey: l10n("open.accesskey", storageStrings), + accesskey: l10n("storage.accesskey", storageStrings), modifiers: "shift", visibilityswitch: "devtools.storage.enabled", icon: "chrome://browser/skin/devtools/tool-storage.svg", invertIconForLightTheme: true, url: "chrome://browser/content/devtools/storage.xul", label: l10n("storage.label", storageStrings), - tooltip: l10n("storage.tooltip", storageStrings), + menuLabel: l10n("storage.menuLabel", storageStrings), + panelLabel: l10n("storage.panelLabel", storageStrings), + tooltip: l10n("storage.tooltip2", storageStrings), inMenu: true, isTargetSupported: function(target) { diff --git a/browser/locales/en-US/chrome/browser/devtools/storage.properties b/browser/locales/en-US/chrome/browser/devtools/storage.properties index 5051bd14347..f57b243f5d2 100644 --- a/browser/locales/en-US/chrome/browser/devtools/storage.properties +++ b/browser/locales/en-US/chrome/browser/devtools/storage.properties @@ -9,29 +9,32 @@ # A good criteria is the language in which you'd find the best documentation # on web development on the web. -# LOCALIZATION NOTE (chromeWindowTitle): This is the title of the Storage -# 'chrome' window. That is, the main window with all the cookies, etc. -# The argument is either the content document's title or its href if no title -# is available. -chromeWindowTitle=Storage [%S] - -# LOCALIZATION NOTE (open.commandkey): This the key to use in +# LOCALIZATION NOTE (storage.commandkey): This the key to use in # conjunction with shift to open the storage editor -open.commandkey=VK_F9 +storage.commandkey=VK_F9 -# LOCALIZATION NOTE (open.accesskey): The access key used to open the storage +# LOCALIZATION NOTE (storage.accesskey): The access key used to open the storage # editor. -open.accesskey=d +storage.accesskey=a # LOCALIZATION NOTE (storage.label): -# This string is displayed in the title of the tab when the storage editor is -# displayed inside the developer tools window and in the Developer Tools Menu. +# This string is displayed as the label of the tab in the developer tools window storage.label=Storage +# LOCALIZATION NOTE (storage.menuLabel): +# This string is displayed in the Tools menu as a shortcut to open the devtools +# with the Storage Inspector tab selected. +storage.menuLabel=Storage Inspector + +# LOCALIZATION NOTE (storage.panelLabel): +# This string is used as the aria-label for the iframe of the Storage Inspector +# tool in developer tools toolbox. +storage.panelLabel=Storage Panel + # LOCALIZATION NOTE (storage.tooltip): # This string is displayed in the tooltip of the tab when the storage editor is # displayed inside the developer tools window. -storage.tooltip=Storage Inspector (Cookies, Local Storage ...) +storage.tooltip2=Storage Inspector (Cookies, Local Storage …) # LOCALIZATION NOTE (tree.emptyText): # This string is displayed when the Storage Tree is empty. This can happen when @@ -59,11 +62,20 @@ table.headers.cookies.path=Path table.headers.cookies.host=Domain table.headers.cookies.expires=Expires on table.headers.cookies.value=Value -table.headers.cookies.lastAccessed:Last accessed on -table.headers.cookies.creationTime:Created on -table.headers.cookies.isHttpOnly:isHttpOnly -table.headers.cookies.isSecure:isSecure -table.headers.cookies.isDomain:isDomain +table.headers.cookies.lastAccessed=Last accessed on +table.headers.cookies.creationTime=Created on +# LOCALIZATION NOTE (table.headers.cookies.isHttpOnly): +# This string is used in the header for the column which denotes whether a +# cookie is HTTP only or not. +table.headers.cookies.isHttpOnly=isHttpOnly +# LOCALIZATION NOTE (table.headers.cookies.isSecure): +# This string is used in the header for the column which denotes whether a +# cookie can be accessed via a secure channel only or not. +table.headers.cookies.isSecure=isSecure +# LOCALIZATION NOTE (table.headers.cookies.isDomain): +# This string is used in the header for the column which denotes whether a +# cookie is a domain cookie only or not. +table.headers.cookies.isDomain=isDomain table.headers.localStorage.name=Key table.headers.localStorage.value=Value From aece55314aa2d29062305d6a2a951cbddff5d6ea Mon Sep 17 00:00:00 2001 From: Michael Pruett Date: Sat, 30 Aug 2014 13:27:50 -0500 Subject: [PATCH 2/2] Bug 1060839 - Use template strings for multi-line SQL statements in tests. r=ttaubert --- .../places/tests/bookmarks/test_bookmarks.js | 6 +- .../places/tests/bookmarks/test_keywords.js | 12 +- .../places/tests/browser/browser_settitle.js | 4 +- .../places/tests/browser/browser_visituri.js | 8 +- .../components/places/tests/browser/head.js | 8 +- .../expiration/test_annos_expire_session.js | 6 +- .../components/places/tests/head_common.js | 18 +-- .../tests/migration/test_current_from_v10.js | 112 +++++++++--------- ...test_current_from_v10_migrated_from_v14.js | 32 ++--- .../tests/migration/test_current_from_v19.js | 8 +- .../tests/mochitest/bug_411966/redirect.js | 12 +- .../tests/unit/test_async_history_api.js | 74 ++++++------ .../tests/unit/test_history_removeAllPages.js | 24 ++-- .../places/tests/unit/test_hosts_triggers.js | 14 +-- .../tests/unit/test_preventive_maintenance.js | 66 +++++------ 15 files changed, 202 insertions(+), 202 deletions(-) diff --git a/toolkit/components/places/tests/bookmarks/test_bookmarks.js b/toolkit/components/places/tests/bookmarks/test_bookmarks.js index eeee7e40572..c70b9cb95cd 100644 --- a/toolkit/components/places/tests/bookmarks/test_bookmarks.js +++ b/toolkit/components/places/tests/bookmarks/test_bookmarks.js @@ -26,9 +26,9 @@ let bookmarksObserver = { // Ensure that we've created a guid for this item. let stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_bookmarks " - + "WHERE id = :item_id " + `SELECT guid + FROM moz_bookmarks + WHERE id = :item_id` ); stmt.params.item_id = id; do_check_true(stmt.executeStep()); diff --git a/toolkit/components/places/tests/bookmarks/test_keywords.js b/toolkit/components/places/tests/bookmarks/test_keywords.js index a6233e32ab5..b24f81ace7c 100644 --- a/toolkit/components/places/tests/bookmarks/test_keywords.js +++ b/toolkit/components/places/tests/bookmarks/test_keywords.js @@ -28,9 +28,9 @@ function check_uri_keyword(aURI, aKeyword) function check_orphans() { stmt = DBConn().createStatement( - "SELECT id FROM moz_keywords k WHERE NOT EXISTS (" - + "SELECT id FROM moz_bookmarks WHERE keyword_id = k.id " - + ")" + `SELECT id FROM moz_keywords k WHERE NOT EXISTS ( + SELECT id FROM moz_bookmarks WHERE keyword_id = k.id + )` ); try { do_check_false(stmt.executeStep()); @@ -40,9 +40,9 @@ function check_orphans() print("Check there are no orphan database entries"); let stmt = DBConn().createStatement( - "SELECT b.id FROM moz_bookmarks b " - + "LEFT JOIN moz_keywords k ON b.keyword_id = k.id " - + "WHERE keyword_id NOTNULL AND k.id ISNULL" + `SELECT b.id FROM moz_bookmarks b + LEFT JOIN moz_keywords k ON b.keyword_id = k.id + WHERE keyword_id NOTNULL AND k.id ISNULL` ); try { do_check_false(stmt.executeStep()); diff --git a/toolkit/components/places/tests/browser/browser_settitle.js b/toolkit/components/places/tests/browser/browser_settitle.js index cad5d60c790..6fe43652e1e 100644 --- a/toolkit/components/places/tests/browser/browser_settitle.js +++ b/toolkit/components/places/tests/browser/browser_settitle.js @@ -34,8 +34,8 @@ var conn = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase).DBConnectio function getColumn(table, column, fromColumnName, fromColumnValue) { var stmt = conn.createStatement( - "SELECT " + column + " FROM " + table + " WHERE " + fromColumnName + "=:val " + - "LIMIT 1"); + `SELECT ${column} FROM ${table} WHERE ${fromColumnName} = :val + LIMIT 1`); try { stmt.params.val = fromColumnValue; stmt.executeStep(); diff --git a/toolkit/components/places/tests/browser/browser_visituri.js b/toolkit/components/places/tests/browser/browser_visituri.js index 90ee6237d4c..47ad283219b 100644 --- a/toolkit/components/places/tests/browser/browser_visituri.js +++ b/toolkit/components/places/tests/browser/browser_visituri.js @@ -48,10 +48,10 @@ var conn = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase).DBConnectio */ function getColumn(table, column, fromColumnName, fromColumnValue) { - let sql = "SELECT " + column + " " + - "FROM " + table + " " + - "WHERE " + fromColumnName + " = :val " + - "LIMIT 1"; + let sql = `SELECT ${column} + FROM ${table} + WHERE ${fromColumnName} = :val + LIMIT 1`; let stmt = conn.createStatement(sql); try { stmt.params.val = fromColumnValue; diff --git a/toolkit/components/places/tests/browser/head.js b/toolkit/components/places/tests/browser/head.js index 1a429cf5ff5..618734beb76 100644 --- a/toolkit/components/places/tests/browser/head.js +++ b/toolkit/components/places/tests/browser/head.js @@ -102,7 +102,7 @@ function fieldForUrl(aURI, aFieldName, aCallback) let url = aURI instanceof Ci.nsIURI ? aURI.spec : aURI; let stmt = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase) .DBConnection.createAsyncStatement( - "SELECT " + aFieldName + " FROM moz_places WHERE url = :page_url" + `SELECT ${aFieldName} FROM moz_places WHERE url = :page_url` ); stmt.params.page_url = url; stmt.executeAsync({ @@ -351,9 +351,9 @@ function checkGuidForURI(aURI, aGUID) { */ function doGetGuidForURI(aURI) { let stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_places " - + "WHERE url = :url " + `SELECT guid + FROM moz_places + WHERE url = :url` ); stmt.params.url = aURI.spec; ok(stmt.executeStep(), "Check get guid for uri from moz_places"); diff --git a/toolkit/components/places/tests/expiration/test_annos_expire_session.js b/toolkit/components/places/tests/expiration/test_annos_expire_session.js index 1f84130ed71..c402c5724f4 100644 --- a/toolkit/components/places/tests/expiration/test_annos_expire_session.js +++ b/toolkit/components/places/tests/expiration/test_annos_expire_session.js @@ -54,9 +54,9 @@ add_task(function test_annos_expire_session() { let deferred = Promise.defer(); waitForConnectionClosed(function() { let stmt = DBConn(true).createAsyncStatement( - "SELECT id FROM moz_annos " - + "UNION ALL " - + "SELECT id FROM moz_items_annos " + `SELECT id FROM moz_annos + UNION ALL + SELECT id FROM moz_items_annos` ); stmt.executeAsync({ handleResult: function(aResultSet) { diff --git a/toolkit/components/places/tests/head_common.js b/toolkit/components/places/tests/head_common.js index d8d71ced7a4..b732bbe7525 100644 --- a/toolkit/components/places/tests/head_common.js +++ b/toolkit/components/places/tests/head_common.js @@ -312,9 +312,9 @@ function visits_in_database(aURI) { let url = aURI instanceof Ci.nsIURI ? aURI.spec : aURI; let stmt = DBConn().createStatement( - "SELECT count(*) FROM moz_historyvisits v " - + "JOIN moz_places h ON h.id = v.place_id " - + "WHERE url = :url" + `SELECT count(*) FROM moz_historyvisits v + JOIN moz_places h ON h.id = v.place_id + WHERE url = :url` ); stmt.params.url = url; try { @@ -689,9 +689,9 @@ function do_get_guid_for_uri(aURI, aStack = Components.stack.caller; } let stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_places " - + "WHERE url = :url " + `SELECT guid + FROM moz_places + WHERE url = :url` ); stmt.params.url = aURI.spec; do_check_true(stmt.executeStep(), aStack); @@ -736,9 +736,9 @@ function do_get_guid_for_bookmark(aId, aStack = Components.stack.caller; } let stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_bookmarks " - + "WHERE id = :item_id " + `SELECT guid + FROM moz_bookmarks + WHERE id = :item_id` ); stmt.params.item_id = aId; do_check_true(stmt.executeStep(), aStack); diff --git a/toolkit/components/places/tests/migration/test_current_from_v10.js b/toolkit/components/places/tests/migration/test_current_from_v10.js index 7063157e79f..76f12cac91e 100644 --- a/toolkit/components/places/tests/migration/test_current_from_v10.js +++ b/toolkit/components/places/tests/migration/test_current_from_v10.js @@ -57,13 +57,13 @@ function test_initial_state() // There should be five item annotations for a bookmark guid. stmt = db.createStatement( - "SELECT content AS guid, item_id " - + "FROM moz_items_annos " - + "WHERE anno_attribute_id = ( " - + "SELECT id " - + "FROM moz_anno_attributes " - + "WHERE name = :attr_name " - + ") " + `SELECT content AS guid, item_id + FROM moz_items_annos + WHERE anno_attribute_id = ( + SELECT id + FROM moz_anno_attributes + WHERE name = :attr_name + )` ); stmt.params.attr_name = kGuidAnnotationName; while (stmt.executeStep()) { @@ -76,13 +76,13 @@ function test_initial_state() // There should be five item annotations for a place guid. stmt = db.createStatement( - "SELECT content AS guid, place_id " - + "FROM moz_annos " - + "WHERE anno_attribute_id = ( " - + "SELECT id " - + "FROM moz_anno_attributes " - + "WHERE name = :attr_name " - + ") " + `SELECT content AS guid, place_id + FROM moz_annos + WHERE anno_attribute_id = ( + SELECT id + FROM moz_anno_attributes + WHERE name = :attr_name + )` ); stmt.params.attr_name = kGuidAnnotationName; while (stmt.executeStep()) { @@ -104,8 +104,8 @@ function test_moz_bookmarks_guid_exists() { // This will throw if the column does not exist let stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_bookmarks " + `SELECT guid + FROM moz_bookmarks` ); stmt.finalize(); @@ -116,8 +116,8 @@ function test_bookmark_guids_non_null() { // First, sanity check that we have a non-zero amount of bookmarks. let stmt = DBConn().createStatement( - "SELECT COUNT(1) " - + "FROM moz_bookmarks " + `SELECT COUNT(1) + FROM moz_bookmarks` ); do_check_true(stmt.executeStep()); do_check_neq(stmt.getInt32(0), 0); @@ -125,9 +125,9 @@ function test_bookmark_guids_non_null() // Now, make sure we have no NULL guid entry. stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_bookmarks " - + "WHERE guid IS NULL " + `SELECT guid + FROM moz_bookmarks + WHERE guid IS NULL` ); do_check_false(stmt.executeStep()); stmt.finalize(); @@ -138,10 +138,10 @@ function test_bookmark_guid_annotation_imported() { // Make sure we have the imported guid; not a newly generated one. let stmt = DBConn().createStatement( - "SELECT id " - + "FROM moz_bookmarks " - + "WHERE guid = :guid " - + "AND id = :item_id " + `SELECT id + FROM moz_bookmarks + WHERE guid = :guid + AND id = :item_id` ); let validGuids = 0; let seenGuids = []; @@ -173,13 +173,13 @@ function test_bookmark_guid_annotation_imported() function test_bookmark_guid_annotation_removed() { let stmt = DBConn().createStatement( - "SELECT COUNT(1) " - + "FROM moz_items_annos " - + "WHERE anno_attribute_id = ( " - + "SELECT id " - + "FROM moz_anno_attributes " - + "WHERE name = :attr_name " - + ") " + `SELECT COUNT(1) + FROM moz_items_annos + WHERE anno_attribute_id = ( + SELECT id + FROM moz_anno_attributes + WHERE name = :attr_name + )` ); stmt.params.attr_name = kGuidAnnotationName; do_check_true(stmt.executeStep()); @@ -193,8 +193,8 @@ function test_moz_places_guid_exists() { // This will throw if the column does not exist let stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_places " + `SELECT guid + FROM moz_places` ); stmt.finalize(); @@ -205,8 +205,8 @@ function test_place_guids_non_null() { // First, sanity check that we have a non-zero amount of places. let stmt = DBConn().createStatement( - "SELECT COUNT(1) " - + "FROM moz_places " + `SELECT COUNT(1) + FROM moz_places` ); do_check_true(stmt.executeStep()); do_check_neq(stmt.getInt32(0), 0); @@ -214,9 +214,9 @@ function test_place_guids_non_null() // Now, make sure we have no NULL guid entry. stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_places " - + "WHERE guid IS NULL " + `SELECT guid + FROM moz_places + WHERE guid IS NULL` ); do_check_false(stmt.executeStep()); stmt.finalize(); @@ -227,10 +227,10 @@ function test_place_guid_annotation_imported() { // Make sure we have the imported guid; not a newly generated one. let stmt = DBConn().createStatement( - "SELECT id " - + "FROM moz_places " - + "WHERE guid = :guid " - + "AND id = :item_id " + `SELECT id + FROM moz_places + WHERE guid = :guid + AND id = :item_id` ); let validGuids = 0; let seenGuids = []; @@ -262,13 +262,13 @@ function test_place_guid_annotation_imported() function test_place_guid_annotation_removed() { let stmt = DBConn().createStatement( - "SELECT COUNT(1) " - + "FROM moz_annos " - + "WHERE anno_attribute_id = ( " - + "SELECT id " - + "FROM moz_anno_attributes " - + "WHERE name = :attr_name " - + ") " + `SELECT COUNT(1) + FROM moz_annos + WHERE anno_attribute_id = ( + SELECT id + FROM moz_anno_attributes + WHERE name = :attr_name + )` ); stmt.params.attr_name = kGuidAnnotationName; do_check_true(stmt.executeStep()); @@ -282,8 +282,8 @@ function test_moz_hosts() { // This will throw if the column does not exist let stmt = DBConn().createStatement( - "SELECT host, frecency, typed, prefix " - + "FROM moz_hosts " + `SELECT host, frecency, typed, prefix + FROM moz_hosts` ); stmt.finalize(); @@ -292,10 +292,10 @@ function test_moz_hosts() // check the number of entries in moz_hosts equals the number of // unique rev_host in moz_places stmt = DBConn().createAsyncStatement( - "SELECT (SELECT COUNT(host) FROM moz_hosts), " + - "(SELECT COUNT(DISTINCT rev_host) " + - "FROM moz_places " + - "WHERE LENGTH(rev_host) > 1)"); + `SELECT (SELECT COUNT(host) FROM moz_hosts), + (SELECT COUNT(DISTINCT rev_host) + FROM moz_places + WHERE LENGTH(rev_host) > 1)`); try { stmt.executeAsync({ handleResult: function (aResult) { diff --git a/toolkit/components/places/tests/migration/test_current_from_v10_migrated_from_v14.js b/toolkit/components/places/tests/migration/test_current_from_v10_migrated_from_v14.js index 038a94a08f8..fb12d6533d7 100644 --- a/toolkit/components/places/tests/migration/test_current_from_v10_migrated_from_v14.js +++ b/toolkit/components/places/tests/migration/test_current_from_v10_migrated_from_v14.js @@ -30,9 +30,9 @@ function test_initial_state() // There should be a non-zero amount of bookmarks without a guid. stmt = db.createStatement( - "SELECT COUNT(1) " - + "FROM moz_bookmarks " - + "WHERE guid IS NULL " + `SELECT COUNT(1) + FROM moz_bookmarks + WHERE guid IS NULL` ); do_check_true(stmt.executeStep()); do_check_neq(stmt.getInt32(0), 0); @@ -40,9 +40,9 @@ function test_initial_state() // There should be a non-zero amount of places without a guid. stmt = db.createStatement( - "SELECT COUNT(1) " - + "FROM moz_places " - + "WHERE guid IS NULL " + `SELECT COUNT(1) + FROM moz_places + WHERE guid IS NULL` ); do_check_true(stmt.executeStep()); do_check_neq(stmt.getInt32(0), 0); @@ -60,8 +60,8 @@ function test_bookmark_guids_non_null() // First, sanity check that we have a non-zero amount of bookmarks. If // migration failed, we would have zero. let stmt = DBConn().createStatement( - "SELECT COUNT(1) " - + "FROM moz_bookmarks " + `SELECT COUNT(1) + FROM moz_bookmarks` ); do_check_true(stmt.executeStep()); do_check_neq(stmt.getInt32(0), 0); @@ -69,9 +69,9 @@ function test_bookmark_guids_non_null() // Now, make sure we have no NULL guid entries. stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_bookmarks " - + "WHERE guid IS NULL " + `SELECT guid + FROM moz_bookmarks + WHERE guid IS NULL` ); do_check_false(stmt.executeStep()); stmt.finalize(); @@ -83,8 +83,8 @@ function test_place_guids_non_null() // First, sanity check that we have a non-zero amount of places. If migration // failed, we would have zero. let stmt = DBConn().createStatement( - "SELECT COUNT(1) " - + "FROM moz_places " + `SELECT COUNT(1) + FROM moz_places` ); do_check_true(stmt.executeStep()); do_check_neq(stmt.getInt32(0), 0); @@ -92,9 +92,9 @@ function test_place_guids_non_null() // Now, make sure we have no NULL guid entry. stmt = DBConn().createStatement( - "SELECT guid " - + "FROM moz_places " - + "WHERE guid IS NULL " + `SELECT guid + FROM moz_places + WHERE guid IS NULL` ); do_check_false(stmt.executeStep()); stmt.finalize(); diff --git a/toolkit/components/places/tests/migration/test_current_from_v19.js b/toolkit/components/places/tests/migration/test_current_from_v19.js index 170d7c6e6b3..1b655a9f1d7 100644 --- a/toolkit/components/places/tests/migration/test_current_from_v19.js +++ b/toolkit/components/places/tests/migration/test_current_from_v19.js @@ -13,10 +13,10 @@ const kGuidAnnotationName = "placesInternal/GUID"; function getTotalGuidAnnotationsCount(aStorageConnection) { stmt = aStorageConnection.createStatement( - "SELECT count(*) " - + "FROM moz_items_annos a " - + "JOIN moz_anno_attributes b ON a.anno_attribute_id = b.id " - + "WHERE b.name = :attr_name" + `SELECT count(*) + FROM moz_items_annos a + JOIN moz_anno_attributes b ON a.anno_attribute_id = b.id + WHERE b.name = :attr_name` ); try { stmt.params.attr_name = kGuidAnnotationName; diff --git a/toolkit/components/places/tests/mochitest/bug_411966/redirect.js b/toolkit/components/places/tests/mochitest/bug_411966/redirect.js index 3f20fa6dbf0..b92c1f77e59 100644 --- a/toolkit/components/places/tests/mochitest/bug_411966/redirect.js +++ b/toolkit/components/places/tests/mochitest/bug_411966/redirect.js @@ -117,12 +117,12 @@ function checkDB(data){ referrer: referrer}, function() { // Get all pages visited from the original typed one - var sql = "SELECT url FROM moz_historyvisits " + - "JOIN moz_places h ON h.id = place_id " + - "WHERE from_visit IN " + - "(SELECT v.id FROM moz_historyvisits v " + - "JOIN moz_places p ON p.id = v.place_id " + - "WHERE p.url = ?1)"; + var sql = `SELECT url FROM moz_historyvisits + JOIN moz_places h ON h.id = place_id + WHERE from_visit IN + (SELECT v.id FROM moz_historyvisits v + JOIN moz_places p ON p.id = v.place_id + WHERE p.url = ?1)`; var stmt = mDBConn.createStatement(sql); stmt.bindByIndex(0, typedURI.spec); diff --git a/toolkit/components/places/tests/unit/test_async_history_api.js b/toolkit/components/places/tests/unit/test_async_history_api.js index 12825a1e51d..d776346c258 100644 --- a/toolkit/components/places/tests/unit/test_async_history_api.js +++ b/toolkit/components/places/tests/unit/test_async_history_api.js @@ -135,9 +135,9 @@ function do_check_title_for_uri(aURI, { let stack = Components.stack.caller; let stmt = DBConn().createStatement( - "SELECT title " + - "FROM moz_places " + - "WHERE url = :url " + `SELECT title + FROM moz_places + WHERE url = :url` ); stmt.params.url = aURI.spec; do_check_true(stmt.executeStep(), stack); @@ -470,9 +470,9 @@ function test_invalid_referrerURI_ignored() // Check to make sure from_visit is zero in database. let stmt = DBConn().createStatement( - "SELECT from_visit " + - "FROM moz_historyvisits " + - "WHERE id = :visit_id" + `SELECT from_visit + FROM moz_historyvisits + WHERE id = :visit_id` ); stmt.params.visit_id = placeInfo.visits[0].visitId; do_check_true(stmt.executeStep()); @@ -503,9 +503,9 @@ function test_nonnsIURI_referrerURI_ignored() // Check to make sure from_visit is zero in database. let stmt = DBConn().createStatement( - "SELECT from_visit " + - "FROM moz_historyvisits " + - "WHERE id = :visit_id" + `SELECT from_visit + FROM moz_historyvisits + WHERE id = :visit_id` ); stmt.params.visit_id = placeInfo.visits[0].visitId; do_check_true(stmt.executeStep()); @@ -562,10 +562,10 @@ function test_old_referrer_ignored() // database to be sure. do_check_eq(placeInfo.visits[0].referrerURI, null); let stmt = DBConn().createStatement( - "SELECT COUNT(1) AS count " + - "FROM moz_historyvisits " + - "WHERE place_id = (SELECT id FROM moz_places WHERE url = :page_url) " + - "AND from_visit = 0 " + `SELECT COUNT(1) AS count + FROM moz_historyvisits + WHERE place_id = (SELECT id FROM moz_places WHERE url = :page_url) + AND from_visit = 0` ); stmt.params.page_url = place.uri.spec; do_check_true(stmt.executeStep()); @@ -758,12 +758,12 @@ function test_properties_saved() // mozIVisitInfo::date let stmt = DBConn().createStatement( - "SELECT COUNT(1) AS count " + - "FROM moz_places h " + - "JOIN moz_historyvisits v " + - "ON h.id = v.place_id " + - "WHERE h.url = :page_url " + - "AND v.visit_date = :visit_date " + `SELECT COUNT(1) AS count + FROM moz_places h + JOIN moz_historyvisits v + ON h.id = v.place_id + WHERE h.url = :page_url + AND v.visit_date = :visit_date` ); stmt.params.page_url = uri.spec; stmt.params.visit_date = visit.visitDate; @@ -773,12 +773,12 @@ function test_properties_saved() // mozIVisitInfo::transitionType stmt = DBConn().createStatement( - "SELECT COUNT(1) AS count " + - "FROM moz_places h " + - "JOIN moz_historyvisits v " + - "ON h.id = v.place_id " + - "WHERE h.url = :page_url " + - "AND v.visit_type = :transition_type " + `SELECT COUNT(1) AS count + FROM moz_places h + JOIN moz_historyvisits v + ON h.id = v.place_id + WHERE h.url = :page_url + AND v.visit_type = :transition_type` ); stmt.params.page_url = uri.spec; stmt.params.transition_type = visit.transitionType; @@ -788,10 +788,10 @@ function test_properties_saved() // mozIPlaceInfo::title stmt = DBConn().createStatement( - "SELECT COUNT(1) AS count " + - "FROM moz_places h " + - "WHERE h.url = :page_url " + - "AND h.title = :title " + `SELECT COUNT(1) AS count + FROM moz_places h + WHERE h.url = :page_url + AND h.title = :title` ); stmt.params.page_url = uri.spec; stmt.params.title = placeInfo.title; @@ -863,14 +863,14 @@ function test_referrer_saved() do_check_true(places[0].uri.equals(visit.referrerURI)); let stmt = DBConn().createStatement( - "SELECT COUNT(1) AS count " + - "FROM moz_historyvisits " + - "WHERE place_id = (SELECT id FROM moz_places WHERE url = :page_url) " + - "AND from_visit = ( " + - "SELECT id " + - "FROM moz_historyvisits " + - "WHERE place_id = (SELECT id FROM moz_places WHERE url = :referrer) " + - ") " + `SELECT COUNT(1) AS count + FROM moz_historyvisits + WHERE place_id = (SELECT id FROM moz_places WHERE url = :page_url) + AND from_visit = ( + SELECT id + FROM moz_historyvisits + WHERE place_id = (SELECT id FROM moz_places WHERE url = :referrer) + )` ); stmt.params.page_url = uri.spec; stmt.params.referrer = visit.referrerURI.spec; diff --git a/toolkit/components/places/tests/unit/test_history_removeAllPages.js b/toolkit/components/places/tests/unit/test_history_removeAllPages.js index 390f0ae7a74..29b8b87de05 100644 --- a/toolkit/components/places/tests/unit/test_history_removeAllPages.js +++ b/toolkit/components/places/tests/unit/test_history_removeAllPages.js @@ -113,8 +113,8 @@ add_task(function test_history_removeAllPages() stmt.finalize(); stmt = mDBConn.createStatement( - "SELECT h.id FROM moz_places h WHERE h.frecency < 0 " + - "AND EXISTS (SELECT id FROM moz_bookmarks WHERE fk = h.id) LIMIT 1"); + `SELECT h.id FROM moz_places h WHERE h.frecency < 0 + AND EXISTS (SELECT id FROM moz_bookmarks WHERE fk = h.id) LIMIT 1`); do_check_true(stmt.executeStep()); stmt.finalize(); @@ -132,36 +132,36 @@ add_task(function test_history_removeAllPages() // Check that all moz_places entries except bookmarks and place: have been removed stmt = mDBConn.createStatement( - "SELECT h.id FROM moz_places h WHERE SUBSTR(h.url, 1, 6) <> 'place:' "+ - "AND NOT EXISTS (SELECT id FROM moz_bookmarks WHERE fk = h.id) LIMIT 1"); + `SELECT h.id FROM moz_places h WHERE SUBSTR(h.url, 1, 6) <> 'place:' + AND NOT EXISTS (SELECT id FROM moz_bookmarks WHERE fk = h.id) LIMIT 1`); do_check_false(stmt.executeStep()); stmt.finalize(); // Check that we only have favicons for retained places stmt = mDBConn.createStatement( - "SELECT f.id FROM moz_favicons f WHERE NOT EXISTS " + - "(SELECT id FROM moz_places WHERE favicon_id = f.id) LIMIT 1"); + `SELECT f.id FROM moz_favicons f WHERE NOT EXISTS + (SELECT id FROM moz_places WHERE favicon_id = f.id) LIMIT 1`); do_check_false(stmt.executeStep()); stmt.finalize(); // Check that we only have annotations for retained places stmt = mDBConn.createStatement( - "SELECT a.id FROM moz_annos a WHERE NOT EXISTS " + - "(SELECT id FROM moz_places WHERE id = a.place_id) LIMIT 1"); + `SELECT a.id FROM moz_annos a WHERE NOT EXISTS + (SELECT id FROM moz_places WHERE id = a.place_id) LIMIT 1`); do_check_false(stmt.executeStep()); stmt.finalize(); // Check that we only have inputhistory for retained places stmt = mDBConn.createStatement( - "SELECT i.place_id FROM moz_inputhistory i WHERE NOT EXISTS " + - "(SELECT id FROM moz_places WHERE id = i.place_id) LIMIT 1"); + `SELECT i.place_id FROM moz_inputhistory i WHERE NOT EXISTS + (SELECT id FROM moz_places WHERE id = i.place_id) LIMIT 1`); do_check_false(stmt.executeStep()); stmt.finalize(); // Check that place:uris have frecency 0 stmt = mDBConn.createStatement( - "SELECT h.id FROM moz_places h " + - "WHERE SUBSTR(h.url, 1, 6) = 'place:' AND h.frecency <> 0 LIMIT 1"); + `SELECT h.id FROM moz_places h + WHERE SUBSTR(h.url, 1, 6) = 'place:' AND h.frecency <> 0 LIMIT 1`); do_check_false(stmt.executeStep()); stmt.finalize(); }); diff --git a/toolkit/components/places/tests/unit/test_hosts_triggers.js b/toolkit/components/places/tests/unit/test_hosts_triggers.js index d983a37c7f3..e4a35aea76e 100644 --- a/toolkit/components/places/tests/unit/test_hosts_triggers.js +++ b/toolkit/components/places/tests/unit/test_hosts_triggers.js @@ -16,9 +16,9 @@ XPCOMUtils.defineLazyServiceGetter(this, "gHistory", function isHostInMozPlaces(aURI) { let stmt = DBConn().createStatement( - "SELECT url " - + "FROM moz_places " - + "WHERE url = :host" + `SELECT url + FROM moz_places + WHERE url = :host` ); let result = false; stmt.params.host = aURI.spec; @@ -35,10 +35,10 @@ function isHostInMozPlaces(aURI) function isHostInMozHosts(aURI, aTyped, aPrefix) { let stmt = DBConn().createStatement( - "SELECT host, typed, prefix " - + "FROM moz_hosts " - + "WHERE host = fixup_url(:host) " - + "AND frecency NOTNULL " + `SELECT host, typed, prefix + FROM moz_hosts + WHERE host = fixup_url(:host) + AND frecency NOTNULL` ); let result = false; stmt.params.host = aURI.host; diff --git a/toolkit/components/places/tests/unit/test_preventive_maintenance.js b/toolkit/components/places/tests/unit/test_preventive_maintenance.js index 19ce0ec19c9..d67d03b7748 100644 --- a/toolkit/components/places/tests/unit/test_preventive_maintenance.js +++ b/toolkit/components/places/tests/unit/test_preventive_maintenance.js @@ -52,10 +52,10 @@ function addPlace(aUrl, aFavicon) { function addBookmark(aPlaceId, aType, aParent, aKeywordId, aFolderType, aTitle) { let stmt = mDBConn.createStatement( - "INSERT INTO moz_bookmarks (fk, type, parent, keyword_id, folder_type, " - + "title, guid) " - + "VALUES (:place_id, :type, :parent, :keyword_id, :folder_type, :title, " - + "GENERATE_GUID())"); + `INSERT INTO moz_bookmarks (fk, type, parent, keyword_id, folder_type, + 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; @@ -92,10 +92,10 @@ tests.push({ 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)" - + ")" + `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._obsoleteWeaveAttribute; @@ -131,8 +131,8 @@ tests.push({ this._bookmarkId = addBookmark(this._placeId); // Add an obsolete attribute. let stmt = mDBConn.createStatement( - "INSERT INTO moz_anno_attributes (name) " - + "VALUES (:anno1), (:anno2), (:anno3)" + `INSERT INTO moz_anno_attributes (name) + VALUES (:anno1), (:anno2), (:anno3)` ); stmt.params['anno1'] = this._obsoleteSyncAttribute; stmt.params['anno2'] = this._obsoleteGuidAttribute; @@ -140,10 +140,10 @@ tests.push({ stmt.execute(); stmt.finalize(); stmt = mDBConn.createStatement( - "INSERT INTO moz_items_annos (item_id, anno_attribute_id) " - + "SELECT :item_id, id " - + "FROM moz_anno_attributes " - + "WHERE name IN (:anno1, :anno2, :anno3)" + `INSERT INTO moz_items_annos (item_id, anno_attribute_id) + SELECT :item_id, id + FROM moz_anno_attributes + WHERE name IN (:anno1, :anno2, :anno3)` ); stmt.params['item_id'] = this._bookmarkId; stmt.params['anno1'] = this._obsoleteSyncAttribute; @@ -156,8 +156,8 @@ tests.push({ check: function() { // Check that the obsolete annotations have been removed. let stmt = mDBConn.createStatement( - "SELECT id FROM moz_anno_attributes " - + "WHERE name IN (:anno1, :anno2, :anno3)" + `SELECT id FROM moz_anno_attributes + WHERE name IN (:anno1, :anno2, :anno3)` ); stmt.params['anno1'] = this._obsoleteSyncAttribute; stmt.params['anno2'] = this._obsoleteGuidAttribute; @@ -723,11 +723,11 @@ tests.push({ function randomize_positions(aParent, aResultArray) { let stmt = mDBConn.createStatement( - "UPDATE moz_bookmarks SET position = :rand " + - "WHERE id IN ( " + - "SELECT id FROM moz_bookmarks WHERE parent = :parent " + - "ORDER BY RANDOM() LIMIT 1 " + - ") " + `UPDATE moz_bookmarks SET position = :rand + WHERE id IN ( + SELECT id FROM moz_bookmarks WHERE parent = :parent + ORDER BY RANDOM() LIMIT 1 + )` ); for (let i = 0; i < (NUM_BOOKMARKS / 2); i++) { stmt.params["parent"] = aParent; @@ -739,9 +739,9 @@ tests.push({ // Build the expected ordered list of bookmarks. stmt = mDBConn.createStatement( - "SELECT id, position " + - "FROM moz_bookmarks WHERE parent = :parent " + - "ORDER BY position ASC, ROWID ASC " + `SELECT id, position + FROM moz_bookmarks WHERE parent = :parent + ORDER BY position ASC, ROWID ASC` ); stmt.params["parent"] = aParent; while (stmt.executeStep()) { @@ -762,8 +762,8 @@ tests.push({ function check_order(aParent, aResultArray) { // Build the expected ordered list of bookmarks. let stmt = mDBConn.createStatement( - "SELECT id, position FROM moz_bookmarks WHERE parent = :parent " + - "ORDER BY position ASC" + `SELECT id, position FROM moz_bookmarks WHERE parent = :parent + ORDER BY position ASC` ); stmt.params["parent"] = aParent; let pass = true; @@ -1189,13 +1189,13 @@ tests.push({ check: function() { let stmt = mDBConn.createStatement( - "SELECT h.id FROM moz_places h " + - "JOIN moz_historyvisits v ON v.place_id = h.id AND visit_type NOT IN (0,4,7,8) " + - "GROUP BY h.id HAVING h.visit_count <> count(*) " + - "UNION ALL " + - "SELECT h.id FROM moz_places h " + - "JOIN moz_historyvisits v ON v.place_id = h.id " + - "GROUP BY h.id HAVING h.last_visit_date <> MAX(v.visit_date) " + `SELECT h.id FROM moz_places h + JOIN moz_historyvisits v ON v.place_id = h.id AND visit_type NOT IN (0,4,7,8) + GROUP BY h.id HAVING h.visit_count <> count(*) + UNION ALL + SELECT h.id FROM moz_places h + JOIN moz_historyvisits v ON v.place_id = h.id + GROUP BY h.id HAVING h.last_visit_date <> MAX(v.visit_date)` ); do_check_false(stmt.executeStep()); stmt.finalize();