Bug 737841 - Part 3: remove no more useful redirectsMode query option.

r=dietrich rs=gavin

--HG--
rename : toolkit/components/places/tests/queries/test_redirectsMode.js => toolkit/components/places/tests/queries/test_redirects.js
This commit is contained in:
Marco Bonardo 2012-04-07 01:17:53 +02:00
parent 8087b03ca3
commit 13f1c8ba2e
18 changed files with 118 additions and 214 deletions

View File

@ -507,7 +507,7 @@ function HistoryMenu(aPopupShowingEvent) {
"@mozilla.org/browser/sessionstore;1",
"nsISessionStore");
PlacesMenu.call(this, aPopupShowingEvent,
"place:redirectsMode=2&sort=4&maxResults=15");
"place:sort=4&maxResults=15");
}
HistoryMenu.prototype = {

View File

@ -1352,7 +1352,7 @@ BrowserGlue.prototype = {
// be set to the version it has been added in, we will compare its value
// to users' smartBookmarksVersion and add new smart bookmarks without
// recreating old deleted ones.
const SMART_BOOKMARKS_VERSION = 3;
const SMART_BOOKMARKS_VERSION = 4;
const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark";
const SMART_BOOKMARKS_PREF = "browser.places.smartBookmarksVersion";
@ -1380,9 +1380,7 @@ BrowserGlue.prototype = {
let smartBookmarks = {
MostVisited: {
title: bundle.GetStringFromName("mostVisitedTitle"),
uri: NetUtil.newURI("place:redirectsMode=" +
Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET +
"&sort=" +
uri: NetUtil.newURI("place:sort=" +
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
"&maxResults=" + MAX_RESULTS),
parent: PlacesUtils.toolbarFolderId,

View File

@ -102,7 +102,7 @@ let (backup_date = new Date().toLocaleFormat("%Y-%m-%d")) {
}
// Smart bookmarks constants.
const SMART_BOOKMARKS_VERSION = 3;
const SMART_BOOKMARKS_VERSION = 4;
const SMART_BOOKMARKS_ON_TOOLBAR = 1;
const SMART_BOOKMARKS_ON_MENU = 3; // Takes in count the additional separator.

View File

@ -432,9 +432,6 @@ let PlacesProvider = {
// Sort by frecency, descending.
options.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_FRECENCY_DESCENDING
// We don't want source redirects for this query.
options.redirectsMode = Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET;
let links = [];
let callback = {

View File

@ -477,8 +477,6 @@ var WinTaskbarJumpList =
var options = PlacesUtils.history.getNewQueryOptions();
options.maxResults = aLimit;
options.sortingMode = aSortingMode;
// We don't want source redirects for these queries.
options.redirectsMode = Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET;
var query = PlacesUtils.history.getNewQuery();
// Return the pending statement to the caller, to allow cancelation.

View File

@ -229,10 +229,10 @@ var gTests = [
path: "123456",
ref: "",
nsIURL: false, nsINestedURI: false, immutable: true },
{ spec: "place:redirectsMode=2&sort=8&maxResults=10",
{ spec: "place:sort=8&maxResults=10",
scheme: "place",
prePath: "place:",
path: "redirectsMode=2&sort=8&maxResults=10",
path: "sort=8&maxResults=10",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "resource://gre/",

View File

@ -73,9 +73,7 @@ add_test(function test_annotation_uploaded() {
_("Create a smart bookmark in the toolbar.");
let parent = PlacesUtils.toolbarFolderId;
let uri =
Utils.makeURI("place:redirectsMode=" +
Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET +
"&sort=" +
Utils.makeURI("place:sort=" +
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
"&maxResults=10");
let title = "Most Visited";
@ -180,9 +178,7 @@ add_test(function test_smart_bookmarks_duped() {
let parent = PlacesUtils.toolbarFolderId;
let uri =
Utils.makeURI("place:redirectsMode=" +
Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET +
"&sort=" +
Utils.makeURI("place:sort=" +
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
"&maxResults=10");
let title = "Most Visited";

View File

@ -711,6 +711,19 @@ let PlacesDBUtils = {
")");
cleanupStatements.push(fixVisitStats);
// L.3 recalculate hidden for redirects.
let fixRedirectsHidden = DBConn.createAsyncStatement(
"UPDATE moz_places " +
"SET hidden = 1 " +
"WHERE id IN ( " +
"SELECT h.id FROM moz_places h " +
"JOIN moz_historyvisits src ON src.place_id = h.id " +
"JOIN moz_historyvisits dst ON dst.from_visit = src.id AND dst.visit_type IN (5,6) " +
"LEFT JOIN moz_bookmarks on fk = h.id AND fk ISNULL " +
"GROUP BY src.place_id HAVING count(*) = visit_count " +
")");
cleanupStatements.push(fixRedirectsHidden);
// MAINTENANCE STATEMENTS SHOULD GO ABOVE THIS POINT!
return cleanupStatements;

View File

@ -1040,7 +1040,7 @@ interface nsINavHistoryQuery : nsISupports
/**
* This object represents the global options for executing a query.
*/
[scriptable, uuid(d46a1ae7-aef8-47a2-9a5c-e6347253f9b2)]
[scriptable, uuid(8198dfa7-8061-4766-95cb-fa86b3c00a47)]
interface nsINavHistoryQueryOptions : nsISupports
{
/**
@ -1201,37 +1201,13 @@ interface nsINavHistoryQueryOptions : nsISupports
attribute boolean expandQueries;
/**
* Most items in history are marked "hidden." Only toplevel pages that the
* user sees in the URL bar are not hidden. Hidden things include the content
* of iframes and all images on web pages. Normally, you don't want these
* things. If you do, set this flag and you'll get all items, even hidden
* ones. Does nothing for bookmark queries. Defaults to false.
* Some pages in history are marked "hidden" and thus don't appear by default
* in queries. These include automatic framed visits and redirects. Setting
* this attribute will return all pages, even hidden ones. Does nothing for
* bookmark queries. Defaults to false.
*/
attribute boolean includeHidden;
/**
* Include both redirected-from and redirected-to pages into results.
*/
const unsigned short REDIRECTS_MODE_ALL = 0;
/**
* Query results will not include redirected-to pages, but will include
* redirected-from pages.
*/
const unsigned short REDIRECTS_MODE_SOURCE = 1;
/**
* Query results will not include redirected-from pages but will include
* redirected-to pages.
*/
const unsigned short REDIRECTS_MODE_TARGET = 2;
/**
* Defines how redirects should be handled, see REDIRECTS_MODE_* constants
* above.
* Defaults to REDIRECTS_MODE_ALL.
* Note: this option is effective only on QUERY_TYPE_HISTORY.
*/
attribute unsigned short redirectsMode;
/**
* This is the maximum number of results that you want. The query is exeucted,
* the results are sorted, and then the top 'maxResults' results are taken

View File

@ -1632,10 +1632,10 @@ nsNavHistory::ExecuteQueries(nsINavHistoryQuery** aQueries, PRUint32 aQueryCount
// determine from our nsNavHistoryQuery array and nsNavHistoryQueryOptions
// if this is the place query from the history menu.
// from browser-menubar.inc, our history menu query is:
// place:redirectsMode=2&sort=4&maxResults=10
// place:sort=4&maxResults=10
// note, any maxResult > 0 will still be considered a history menu query
// or if this is the place query from the "Most Visited" item in the "Smart Bookmarks" folder:
// place:redirectsMode=2&sort=8&maxResults=10
// or if this is the place query from the "Most Visited" item in the
// "Smart Bookmarks" folder: place:sort=8&maxResults=10
// note, any maxResult > 0 will still be considered a Most Visited menu query
static
bool IsOptimizableHistoryQuery(const nsCOMArray<nsNavHistoryQuery>& aQueries,
@ -1749,7 +1749,6 @@ private:
PRUint16 mResultType;
PRUint16 mQueryType;
bool mIncludeHidden;
PRUint16 mRedirectsMode;
PRUint16 mSortingMode;
PRUint32 mMaxResults;
@ -1772,7 +1771,6 @@ PlacesSQLQueryBuilder::PlacesSQLQueryBuilder(
, mResultType(aOptions->ResultType())
, mQueryType(aOptions->QueryType())
, mIncludeHidden(aOptions->IncludeHidden())
, mRedirectsMode(aOptions->RedirectsMode())
, mSortingMode(aOptions->SortingMode())
, mMaxResults(aOptions->MaxResults())
, mSkipOrderBy(false)
@ -2249,27 +2247,6 @@ PlacesSQLQueryBuilder::Where()
nsCAutoString additionalVisitsConditions;
nsCAutoString additionalPlacesConditions;
if (mRedirectsMode == nsINavHistoryQueryOptions::REDIRECTS_MODE_SOURCE) {
// At least one visit that is not a redirect target should exist.
additionalVisitsConditions += NS_LITERAL_CSTRING(
"AND visit_type NOT IN ") +
nsPrintfCString("(%d,%d) ", nsINavHistoryService::TRANSITION_REDIRECT_PERMANENT,
nsINavHistoryService::TRANSITION_REDIRECT_TEMPORARY);
}
else if (mRedirectsMode == nsINavHistoryQueryOptions::REDIRECTS_MODE_TARGET) {
// At least one visit that is not a redirect source should exist.
additionalPlacesConditions += nsPrintfCString(1024,
"AND EXISTS ( "
"SELECT id "
"FROM moz_historyvisits v "
"WHERE place_id = h.id "
"AND NOT EXISTS(SELECT id FROM moz_historyvisits "
"WHERE from_visit = v.id AND visit_type IN (%d,%d)) "
") ",
nsINavHistoryService::TRANSITION_REDIRECT_PERMANENT,
nsINavHistoryService::TRANSITION_REDIRECT_TEMPORARY);
}
if (!mIncludeHidden) {
additionalPlacesConditions += NS_LITERAL_CSTRING("AND hidden = 0 ");
}
@ -2508,33 +2485,7 @@ nsNavHistory::ConstructQueryString(
queryString.AppendInt(aOptions->MaxResults());
nsCAutoString additionalQueryOptions;
if (aOptions->RedirectsMode() ==
nsINavHistoryQueryOptions::REDIRECTS_MODE_SOURCE) {
// At least one visit that is not a redirect target should exist.
additionalQueryOptions += nsPrintfCString(256,
"AND EXISTS ( "
"SELECT id "
"FROM moz_historyvisits "
"WHERE place_id = h.id "
"AND visit_type NOT IN (%d,%d)"
") ",
TRANSITION_REDIRECT_PERMANENT,
TRANSITION_REDIRECT_TEMPORARY);
}
else if (aOptions->RedirectsMode() ==
nsINavHistoryQueryOptions::REDIRECTS_MODE_TARGET) {
// At least one visit that is not a redirect source should exist.
additionalQueryOptions += nsPrintfCString(1024,
"AND EXISTS ( "
"SELECT id "
"FROM moz_historyvisits v "
"WHERE place_id = h.id "
"AND NOT EXISTS(SELECT id FROM moz_historyvisits "
"WHERE from_visit = v.id AND visit_type IN (%d,%d)) "
") ",
TRANSITION_REDIRECT_PERMANENT,
TRANSITION_REDIRECT_TEMPORARY);
}
queryString.ReplaceSubstring("{QUERY_OPTIONS}",
additionalQueryOptions.get());
return NS_OK;

View File

@ -171,7 +171,6 @@ static void SetOptionsKeyUint32(const nsCString& aValue,
#define QUERYKEY_EXPAND_QUERIES "expandQueries"
#define QUERYKEY_FORCE_ORIGINAL_TITLE "originalTitle"
#define QUERYKEY_INCLUDE_HIDDEN "includeHidden"
#define QUERYKEY_REDIRECTS_MODE "redirectsMode"
#define QUERYKEY_MAX_RESULTS "maxResults"
#define QUERYKEY_QUERY_TYPE "queryType"
#define QUERYKEY_TAG "tag"
@ -594,13 +593,6 @@ nsNavHistory::QueriesToQueryString(nsINavHistoryQuery **aQueries,
queryString += NS_LITERAL_CSTRING(QUERYKEY_INCLUDE_HIDDEN "=1");
}
// redirects mode
if (options->RedirectsMode() != nsINavHistoryQueryOptions::REDIRECTS_MODE_ALL) {
AppendAmpersandIfNonempty(queryString);
queryString += NS_LITERAL_CSTRING(QUERYKEY_REDIRECTS_MODE "=");
AppendInt16(queryString, options->RedirectsMode());
}
// max results
if (options->MaxResults()) {
AppendAmpersandIfNonempty(queryString);
@ -876,10 +868,6 @@ nsNavHistory::TokensToQueries(const nsTArray<QueryKeyValuePair>& aTokens,
} else if (kvp.key.EqualsLiteral(QUERYKEY_INCLUDE_HIDDEN)) {
SetOptionsKeyBool(kvp.value, aOptions,
&nsINavHistoryQueryOptions::SetIncludeHidden);
// query type
} else if (kvp.key.EqualsLiteral(QUERYKEY_REDIRECTS_MODE)) {
SetOptionsKeyUint16(kvp.value, aOptions,
&nsINavHistoryQueryOptions::SetRedirectsMode);
// max results
} else if (kvp.key.EqualsLiteral(QUERYKEY_MAX_RESULTS)) {
SetOptionsKeyUint32(kvp.value, aOptions,
@ -1521,20 +1509,6 @@ nsNavHistoryQueryOptions::SetIncludeHidden(bool aIncludeHidden)
return NS_OK;
}
// redirectsMode
NS_IMETHODIMP
nsNavHistoryQueryOptions::GetRedirectsMode(PRUint16* _retval)
{
*_retval = mRedirectsMode;
return NS_OK;
}
NS_IMETHODIMP
nsNavHistoryQueryOptions::SetRedirectsMode(PRUint16 aRedirectsMode)
{
mRedirectsMode = aRedirectsMode;
return NS_OK;
}
// maxResults
NS_IMETHODIMP
nsNavHistoryQueryOptions::GetMaxResults(PRUint32* aMaxResults)

View File

@ -141,7 +141,6 @@ public:
, mExcludeReadOnlyFolders(false)
, mExpandQueries(true)
, mIncludeHidden(false)
, mRedirectsMode(nsINavHistoryQueryOptions::REDIRECTS_MODE_ALL)
, mMaxResults(0)
, mQueryType(nsINavHistoryQueryOptions::QUERY_TYPE_HISTORY)
, mAsyncEnabled(false)
@ -159,7 +158,6 @@ public:
bool ExcludeReadOnlyFolders() const { return mExcludeReadOnlyFolders; }
bool ExpandQueries() const { return mExpandQueries; }
bool IncludeHidden() const { return mIncludeHidden; }
PRUint16 RedirectsMode() const { return mRedirectsMode; }
PRUint32 MaxResults() const { return mMaxResults; }
PRUint16 QueryType() const { return mQueryType; }
bool AsyncEnabled() const { return mAsyncEnabled; }
@ -184,7 +182,6 @@ private:
bool mExcludeReadOnlyFolders;
bool mExpandQueries;
bool mIncludeHidden;
PRUint16 mRedirectsMode;
PRUint32 mMaxResults;
PRUint16 mQueryType;
bool mAsyncEnabled;

View File

@ -882,6 +882,7 @@ NavHistoryResultObserver.prototype = {
* transition: one of the TRANSITION_* from nsINavHistoryService,
* [optional] title: title of the page,
* [optional] visitDate: visit date in microseconds from the epoch
* [optional] referrer: nsIURI of the referrer for this visit
* }
* @param [optional] aCallback
* Function to be invoked on completion.
@ -910,7 +911,8 @@ function addVisits(aPlaceInfo, aCallback, aStack)
places[i].visits = [{
transitionType: places[i].transition === undefined ? TRANSITION_LINK
: places[i].transition,
visitDate: places[i].visitDate || (now++) * 1000
visitDate: places[i].visitDate || (now++) * 1000,
referrerURI: places[i].referrer
}];
}

View File

@ -107,6 +107,25 @@ function populateDB(aArray) {
}
}
if (qdata.isRedirect) {
// Redirect sources added through the docshell are properly marked
// as redirects and get hidden state, the API doesn't have that
// power (And actually doesn't make much sense to add redirects
// through the API).
let stmt = DBConn().createStatement(
"UPDATE moz_places SET hidden = 1 WHERE url = :url");
stmt.params.url = qdata.uri;
try {
stmt.execute();
}
catch (ex) {
print("Error while setting visit_count.");
}
finally {
stmt.finalize();
}
}
if (qdata.isDetails) {
// Then we add extraneous page details for testing
PlacesUtils.history.addPageWithDetails(uri(qdata.uri),

View File

@ -505,23 +505,6 @@ const queryOptionSwitches = [
}
]
},
// redirectsMode
{
property: "redirectsMode",
desc: "nsINavHistoryQueryOptions.redirectsMode",
matches: simplePropertyMatches,
runs: [
function (aQuery, aQueryOptions) {
aQueryOptions.redirectsMode = aQueryOptions.REDIRECTS_MODE_ALL;
},
function (aQuery, aQueryOptions) {
aQueryOptions.redirectsMode = aQueryOptions.REDIRECTS_MODE_TARGET;
},
function (aQuery, aQueryOptions) {
aQueryOptions.redirectsMode = aQueryOptions.REDIRECTS_MODE_SOURCE;
}
]
},
];
///////////////////////////////////////////////////////////////////////////////

View File

@ -1,40 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Places Test Code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Marco Bonardo <mak77@bonardo.net> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// Array of visits we will add to the database, will be populated later
// in the test.
@ -47,49 +13,37 @@ let visits = [];
*
* @param aSequence
* an array that contains query options in the form:
* [includeHidden, redirectsMode, maxResults, sortingMode]
* [includeHidden, maxResults, sortingMode]
*/
function check_results_callback(aSequence) {
// Sanity check: we should receive 3 parameters.
do_check_eq(aSequence.length, 4);
do_check_eq(aSequence.length, 3);
let includeHidden = aSequence[0];
let redirectsMode = aSequence[1];
let maxResults = aSequence[2];
let sortingMode = aSequence[3];
let maxResults = aSequence[1];
let sortingMode = aSequence[2];
print("\nTESTING: includeHidden(" + includeHidden + ")," +
" redirectsMode(" + redirectsMode + ")," +
" maxResults(" + maxResults + ")," +
" sortingMode(" + sortingMode + ").");
function isHidden(aVisit) {
return aVisit.transType == Ci.nsINavHistoryService.TRANSITION_FRAMED_LINK ||
aVisit.isRedirect;
}
// Build expectedData array.
let expectedData = visits.filter(function (aVisit, aIndex, aArray) {
// Embed visits never appear in results.
if (aVisit.transType == Ci.nsINavHistoryService.TRANSITION_EMBED)
return false;
if (aVisit.transType == Ci.nsINavHistoryService.TRANSITION_FRAMED_LINK &&
!includeHidden) {
if (!includeHidden && isHidden(aVisit)) {
// If the page has any non-hidden visit, then it's visible.
if (visits.filter(function (refVisit) {
return refVisit.uri == aVisit.uri &&
refVisit.transType != Ci.nsINavHistoryService.TRANSITION_FRAMED_LINK;
return refVisit.uri == aVisit.uri && !isHidden(refVisit);
}).length == 0)
return false;
}
if (redirectsMode == Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_SOURCE) {
// Filter out any redirect target.
return aVisit.transType != Ci.nsINavHistoryService.TRANSITION_REDIRECT_PERMANENT &&
aVisit.transType != Ci.nsINavHistoryService.TRANSITION_REDIRECT_TEMPORARY;
}
if (redirectsMode == Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET) {
// Filter out any entry that is a redirect source.
return visits.filter(function (refVisit) {
return !refVisit.isRedirect && refVisit.uri == aVisit.uri;
}).length > 0;
}
return true;
});
@ -129,7 +83,6 @@ function check_results_callback(aSequence) {
let query = PlacesUtils.history.getNewQuery();
let options = PlacesUtils.history.getNewQueryOptions();
options.includeHidden = includeHidden;
options.redirectsMode = redirectsMode;
options.sortingMode = sortingMode;
if (maxResults)
options.maxResults = maxResults;
@ -256,6 +209,7 @@ function add_visits_to_database() {
transType: transition,
uri: "http://" + transition + ".example.com/",
title: transition + "-example",
isRedirect: true,
lastVisit: timeInMicroseconds--,
visitCount: (transition == Ci.nsINavHistoryService.TRANSITION_EMBED ||
transition == Ci.nsINavHistoryService.TRANSITION_FRAMED_LINK) ? 0 : visitCount++,
@ -303,6 +257,7 @@ function add_visits_to_database() {
uri: "http://" + transition + ".example.com/",
title: getLastValue("http://" + transition + ".example.com/", "title"),
lastVisit: getLastValue("http://" + transition + ".example.com/", "lastVisit"),
isRedirect: true,
referrer: "http://" + transition + ".redirect.perm.example.com/",
visitCount: getLastValue("http://" + transition + ".example.com/", "visitCount"),
isInQuery: true }));
@ -334,9 +289,6 @@ function run_test() {
// This array will be used by cartProd to generate a matrix of all possible
// combinations.
let includeHidden_options = [true, false];
let redirectsMode_options = [Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_ALL,
Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_SOURCE,
Ci.nsINavHistoryQueryOptions.REDIRECTS_MODE_TARGET];
let maxResults_options = [5, 10, 20, null];
// These sortingMode are choosen to toggle using special queries for history
// menu and most visited smart bookmark.
@ -344,7 +296,7 @@ function run_test() {
Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING,
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING];
// Will execute check_results_callback() for each generated combination.
cartProd([includeHidden_options, redirectsMode_options, maxResults_options, sorting_options],
cartProd([includeHidden_options, maxResults_options, sorting_options],
check_results_callback);
remove_all_bookmarks();

View File

@ -12,7 +12,7 @@ tail =
[test_history_queries_titles_liveUpdate.js]
[test_onlyBookmarked.js]
[test_querySerialization.js]
[test_redirectsMode.js]
[test_redirects.js]
# Bug 676989: test hangs consistently on Android
skip-if = os == "android"
[test_results-as-tag-contents-query.js]

View File

@ -1145,6 +1145,54 @@ tests.push({
//------------------------------------------------------------------------------
tests.push({
name: "L.3",
desc: "recalculate hidden for redirects.",
setup: function() {
addVisits([
{ uri: NetUtil.newURI("http://l3.moz.org/"),
transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("http://l3.moz.org/redirecting/"),
transition: TRANSITION_TYPED },
{ uri: NetUtil.newURI("http://l3.moz.org/redirecting2/"),
transition: TRANSITION_REDIRECT_TEMPORARY,
referrer: NetUtil.newURI("http://l3.moz.org/redirecting/") },
{ uri: NetUtil.newURI("http://l3.moz.org/target/"),
transition: TRANSITION_REDIRECT_PERMANENT,
referrer: NetUtil.newURI("http://l3.moz.org/redirecting2/") },
]);
},
asyncCheck: function(aCallback) {
let stmt = mDBConn.createAsyncStatement(
"SELECT h.url FROM moz_places h WHERE h.hidden = 1"
);
stmt.executeAsync({
_count: 0,
handleResult: function(aResultSet) {
for (let row; (row = aResultSet.getNextRow());) {
let url = row.getResultByIndex(0);
do_check_true(/redirecting/.test(url));
this._count++;
}
},
handleError: function(aError) {
},
handleCompletion: function(aReason) {
dump_table("moz_places");
dump_table("moz_historyvisits");
do_check_eq(aReason, Ci.mozIStorageStatementCallback.REASON_FINISHED);
do_check_eq(this._count, 2);
aCallback();
}
});
stmt.finalize();
}
});
//------------------------------------------------------------------------------
tests.push({
name: "Z",
desc: "Sanity: Preventive maintenance does not touch valid items",