Bug 578268: Eliminate the last vestiges of mork from Firefox. r=mak

This commit is contained in:
Kyle Huey 2011-07-02 12:16:45 -07:00
Родитель 9c957082a3
Коммит a5b3835737
10 изменённых файлов: 61 добавлений и 226 удалений

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

@ -42,8 +42,6 @@ MOZ_UPDATER=1
MOZ_PHOENIX=1 MOZ_PHOENIX=1
MOZ_CHROME_FILE_FORMAT=omni MOZ_CHROME_FILE_FORMAT=omni
# always enabled for form history
MOZ_MORKREADER=1
MOZ_SAFE_BROWSING=1 MOZ_SAFE_BROWSING=1
MOZ_SERVICES_SYNC=1 MOZ_SERVICES_SYNC=1
MOZ_APP_VERSION=$FIREFOX_VERSION MOZ_APP_VERSION=$FIREFOX_VERSION

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

@ -4772,7 +4772,7 @@ MOZ_FEEDS=1
MOZ_INSTALLER=1 MOZ_INSTALLER=1
MOZ_JSDEBUGGER=1 MOZ_JSDEBUGGER=1
MOZ_MORK= MOZ_MORK=
MOZ_MORKREADER=1 MOZ_MORKREADER=
MOZ_AUTH_EXTENSION=1 MOZ_AUTH_EXTENSION=1
MOZ_OGG=1 MOZ_OGG=1
MOZ_RAW= MOZ_RAW=

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

@ -87,7 +87,6 @@ CPPSRCS = \
nsNavHistoryResult.cpp \ nsNavHistoryResult.cpp \
nsNavBookmarks.cpp \ nsNavBookmarks.cpp \
nsMaybeWeakPtr.cpp \ nsMaybeWeakPtr.cpp \
nsMorkHistoryImporter.cpp \
nsPlacesModule.cpp \ nsPlacesModule.cpp \
SQLFunctions.cpp \ SQLFunctions.cpp \
Helpers.cpp \ Helpers.cpp \
@ -98,6 +97,12 @@ CPPSRCS = \
VisitInfo.cpp \ VisitInfo.cpp \
$(NULL) $(NULL)
ifdef MOZ_MORKREADER
CPPSRCS += nsMorkHistoryImporter.cpp
else
CPPSRCS += nsNoMorkStubImporter.cpp
endif
LOCAL_INCLUDES += -I$(srcdir)/../build LOCAL_INCLUDES += -I$(srcdir)/../build
# This is the default value. Must be in sync with the one defined in SQLite. # This is the default value. Must be in sync with the one defined in SQLite.

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

@ -0,0 +1,45 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Kyle Huey <me@kylehuey.com>
*
* 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 ***** */
#include "nsNavHistory.h"
NS_IMETHODIMP
nsNavHistory::ImportHistory(nsIFile* aFile)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -1,17 +0,0 @@
// <!-- <mdb:mork:z v="1.4"/> -->
< <(a=c)> // (f=iso-8859-1)
(8A=Typed)(8B=LastPageVisited)(8C=ByteOrder)
(80=ns:history:db:row:scope:history:all)
(81=ns:history:db:table:kind:history)(82=URL)(83=Referrer)
(84=LastVisitDate)(85=FirstVisitDate)(86=VisitCount)(87=Name)
(88=Hostname)(89=Hidden)>
<(80=LE)(8A=http://www.mozilla.org/)(99=1230666859910484)(96
=1230666845910353)(8C=mozilla.org)(84=1)(95=4)(8E
=M$00o$00z$00i$00l$00l$00a$00.$00o$00r$00g$00 $00-$00 $00H$00o$00m$00e$00 \
$00o$00f$00 $00t$00h$00e$00 $00M$00o$00z$00i$00l$00l$00a$00 $00P$00r$00o$00j$00\
e$00c$00t$00)(8F=http://www.google.it/)(97=1230666851648604)(88=google.it)
(93=3)(91=G$00o$00o$00g$00l$00e$00)>
{1:^80 {(k^81:c)(s=9)[1(^8C=LE)]}
[7(^82^8A)(^84^99)(^85^96)(^88^8C)(^8A=1)(^86=4)(^87^8E)]
[8(^82^8F)(^84^99)(^85^97)(^88^88)(^8A=1)(^86=3)(^87^91)]}

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

@ -1,101 +0,0 @@
/* -*- 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 Bug 454977 code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Marco Bonardo <mak77bonardo.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 ***** */
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var gh = hs.QueryInterface(Ci.nsIGlobalHistory2);
/**
* Checks to see that a URI is in the database.
*
* @param aURI
* The URI to check.
* @returns true if the URI is in the DB, false otherwise.
*/
function uri_in_db(aURI) {
var options = hs.getNewQueryOptions();
options.maxResults = 1;
options.resultType = options.RESULTS_AS_URI
var query = hs.getNewQuery();
query.uri = aURI;
var result = hs.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
var cc = root.childCount;
root.containerOpen = false;
return (cc == 1);
}
// main
function run_test() {
// test import history
var file = do_get_file("history_import_test.dat");
gh.importHistory(file);
var uri1 = uri("http://www.mozilla.org/");
do_check_true(uri_in_db(uri1));
// Check visit count
var options = hs.getNewQueryOptions();
options.sortingMode = options.SORT_BY_DATE_DESCENDING;
options.resultType = options.RESULTS_AS_VISIT;
var query = hs.getNewQuery();
query.minVisits = 4;
query.maxVisits = 4;
query.uri = uri1;
var result = hs.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
var cc = root.childCount;
do_check_eq(cc, 4);
// Check first and last visits times are correct
var lastVisitDate = root.getChild(0).time;
do_check_eq(lastVisitDate, 1230666859910484);
var firstVisitDate = root.getChild(3).time;
do_check_eq(firstVisitDate, 1230666845910353);
// Check other visits have different times and are between first and last ones
do_check_true(root.getChild(1).time < lastVisitDate &&
root.getChild(1).time > firstVisitDate);
do_check_true(root.getChild(2).time < lastVisitDate &&
root.getChild(2).time > firstVisitDate);
do_check_true(root.getChild(1).time != root.getChild(2).time);
root.containerOpen = false;
}

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

@ -1,100 +0,0 @@
/* ***** 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):
* Edward Lee <edilee@mozilla.com> (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 ***** */
/**
* Make sure all places get their frecency calculated on migrate for bug 476300.
*/
function _(msg) {
dump(".-* DEBUG *-. " + msg + "\n");
}
function run_test() {
_("Copy the history file with plenty of data to migrate");
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
let deleteMork = function() {
let mork = dirSvc.get("ProfD", Ci.nsIFile);
mork.append("history.dat");
if (mork.exists())
mork.remove(false);
};
deleteMork();
let file = do_get_file("migrateFrecency.dat");
file.copyTo(dirSvc.get("ProfD", Ci.nsIFile), "history.dat");
_("Wait until places is done initializing to check migration");
let places = null;
const NS_PLACES_INIT_COMPLETE_TOPIC = "places-init-complete";
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
let observer = {
observe: function (subject, topic, data) {
switch (topic) {
case NS_PLACES_INIT_COMPLETE_TOPIC:
_("Clean up after ourselves: remove observer and mork file");
os.removeObserver(observer, NS_PLACES_INIT_COMPLETE_TOPIC);
deleteMork();
_("Now that places has migrated, check that it calculated frecencies");
var stmt = places.DBConnection.createStatement(
"SELECT COUNT(*) FROM moz_places WHERE frecency < 0");
stmt.executeAsync({
handleResult: function(results) {
_("Should always get a result from COUNT(*)");
let row = results.getNextRow();
do_check_true(!!row);
_("We should have no negative frecencies after migrate");
do_check_eq(row.getResultByIndex(0), 0);
},
handleCompletion: do_test_finished,
handleError: do_throw,
});
stmt.finalize();
break;
}
},
};
os.addObserver(observer, NS_PLACES_INIT_COMPLETE_TOPIC, false);
_("Start places to make it migrate");
places = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsPIPlacesDatabase);
do_test_pending();
}

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

@ -62,7 +62,6 @@ tail =
[test_history.js] [test_history.js]
[test_history_autocomplete_tags.js] [test_history_autocomplete_tags.js]
[test_history_catobs.js] [test_history_catobs.js]
[test_history_import.js]
[test_history_notifications.js] [test_history_notifications.js]
[test_history_observer.js] [test_history_observer.js]
[test_history_removeAllPages.js] [test_history_removeAllPages.js]
@ -71,7 +70,6 @@ tail =
[test_lastModified.js] [test_lastModified.js]
[test_livemarkService_getLivemarkIdForFeedURI.js] [test_livemarkService_getLivemarkIdForFeedURI.js]
[test_markpageas.js] [test_markpageas.js]
[test_migrateFrecency.js]
[test_moz-anno_favicon_mime_type.js] [test_moz-anno_favicon_mime_type.js]
[test_multi_queries.js] [test_multi_queries.js]
[test_multi_word_tags.js] [test_multi_word_tags.js]

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

@ -231,7 +231,9 @@ EXTRA_DSO_LDOPTS += $(SQLITE_LIBS)
endif endif
ifdef MOZ_PLACES ifdef MOZ_PLACES
ifdef MOZ_MORKREADER
STATIC_LIBS += morkreader_s STATIC_LIBS += morkreader_s
endif
COMPONENT_LIBS += \ COMPONENT_LIBS += \
places \ places \

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

@ -941,11 +941,16 @@ if [ "$MOZ_ZIPWRITER" ]; then
" "
fi fi
if [ "$MOZ_MORKREADER" ]; then
add_makefiles "
db/morkreader/Makefile
db/morkreader/external/Makefile
"
fi
if [ "$MOZ_STORAGE" ]; then if [ "$MOZ_STORAGE" ]; then
add_makefiles " add_makefiles "
db/sqlite3/src/Makefile db/sqlite3/src/Makefile
db/morkreader/Makefile
db/morkreader/external/Makefile
storage/Makefile storage/Makefile
storage/public/Makefile storage/public/Makefile
storage/src/Makefile storage/src/Makefile