Merge f-t to m-c, a=merge

This commit is contained in:
Phil Ringnalda 2014-08-31 18:38:50 -07:00
commit 63822cfe24
17 changed files with 237 additions and 223 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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());

View File

@ -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());

View File

@ -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();

View File

@ -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;

View File

@ -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");

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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();
});

View File

@ -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;

View File

@ -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();