Bug 578268: Eliminate the last vestiges of mork from Firefox. r=mak
authorKyle Huey <khuey@kylehuey.com>
Sat, 02 Jul 2011 12:16:45 -0700
changeset 72748 4e3b03de1fd3df9a76e470e0a2f32dc86eabf9ab
parent 72747 0c02168c83a686c3ff4c2b9c3c85c4a8cf7d6c47
child 72749 bd7d3f2d51ad9dfc35ba7e2d9a931c9983350f6f
push id159
push usereakhgari@mozilla.com
push dateTue, 16 Aug 2011 17:53:11 +0000
treeherdermozilla-beta@8786e3e49240 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs578268
milestone7.0a1
first release with
nightly linux32
4e3b03de1fd3 / 7.0a1 / 20110703030754 / files
nightly linux64
4e3b03de1fd3 / 7.0a1 / 20110703030754 / files
nightly mac
4e3b03de1fd3 / 7.0a1 / 20110703030754 / files
nightly win32
4e3b03de1fd3 / 7.0a1 / 20110703030754 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 578268: Eliminate the last vestiges of mork from Firefox. r=mak
browser/confvars.sh
configure.in
toolkit/components/places/Makefile.in
toolkit/components/places/nsNoMorkStubImporter.cpp
toolkit/components/places/tests/unit/history_import_test.dat
toolkit/components/places/tests/unit/test_history_import.js
toolkit/components/places/tests/unit/test_migrateFrecency.js
toolkit/components/places/tests/unit/xpcshell.ini
toolkit/library/libxul-config.mk
toolkit/toolkit-makefiles.sh
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -37,18 +37,16 @@
 # ***** END LICENSE BLOCK *****
 
 MOZ_APP_BASENAME=Firefox
 MOZ_APP_VENDOR=Mozilla
 MOZ_UPDATER=1
 MOZ_PHOENIX=1
 
 MOZ_CHROME_FILE_FORMAT=omni
-# always enabled for form history
-MOZ_MORKREADER=1
 MOZ_SAFE_BROWSING=1
 MOZ_SERVICES_SYNC=1
 MOZ_APP_VERSION=$FIREFOX_VERSION
 MOZ_EXTENSIONS_DEFAULT=" gnomevfs"
 # MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
 # Changing either of these values requires a clobber to ensure correct results,
 # because branding dependencies are broken.
 MOZ_BRANDING_DIRECTORY=browser/branding/nightly
--- a/configure.in
+++ b/configure.in
@@ -4767,17 +4767,17 @@ MOZ_ARG_HEADER(Application)
 
 ENABLE_TESTS=1
 MOZ_BRANDING_DIRECTORY=
 MOZ_OFFICIAL_BRANDING=
 MOZ_FEEDS=1
 MOZ_INSTALLER=1
 MOZ_JSDEBUGGER=1
 MOZ_MORK=
-MOZ_MORKREADER=1
+MOZ_MORKREADER=
 MOZ_AUTH_EXTENSION=1
 MOZ_OGG=1
 MOZ_RAW=
 MOZ_SYDNEYAUDIO=
 MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_MEDIA=
--- a/toolkit/components/places/Makefile.in
+++ b/toolkit/components/places/Makefile.in
@@ -82,27 +82,32 @@ CPPSRCS = \
   nsAnnoProtocolHandler.cpp \
   nsAnnotationService.cpp \
   nsFaviconService.cpp \
   nsNavHistory.cpp \
   nsNavHistoryQuery.cpp \
   nsNavHistoryResult.cpp \
   nsNavBookmarks.cpp \
   nsMaybeWeakPtr.cpp \
-  nsMorkHistoryImporter.cpp \
   nsPlacesModule.cpp \
   SQLFunctions.cpp \
   Helpers.cpp \
   History.cpp \
   nsPlacesImportExportService.cpp \
   AsyncFaviconHelpers.cpp \
   PlaceInfo.cpp \
   VisitInfo.cpp \
   $(NULL)
 
+ifdef MOZ_MORKREADER
+CPPSRCS += nsMorkHistoryImporter.cpp
+else
+CPPSRCS += nsNoMorkStubImporter.cpp
+endif
+
 LOCAL_INCLUDES += -I$(srcdir)/../build
 
 # This is the default value.  Must be in sync with the one defined in SQLite.
 DEFINES += -DSQLITE_DEFAULT_PAGE_SIZE=32768
 
 EXTRA_COMPONENTS = \
   toolkitplaces.manifest \
   nsLivemarkService.js \
new file mode 100644
--- /dev/null
+++ b/toolkit/components/places/nsNoMorkStubImporter.cpp
@@ -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;
+}
deleted file mode 100644
--- a/toolkit/components/places/tests/unit/history_import_test.dat
+++ /dev/null
@@ -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)]}
deleted file mode 100644
--- a/toolkit/components/places/tests/unit/test_history_import.js
+++ /dev/null
@@ -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;
-}
deleted file mode 100644
--- a/toolkit/components/places/tests/unit/test_migrateFrecency.js
+++ /dev/null
@@ -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();
-}
--- a/toolkit/components/places/tests/unit/xpcshell.ini
+++ b/toolkit/components/places/tests/unit/xpcshell.ini
@@ -57,26 +57,24 @@ tail =
 [test_exclude_livemarks.js]
 [test_faviconService_expireAllFavicons.js]
 [test_favicons.js]
 [test_frecency.js]
 [test_getChildIndex.js]
 [test_history.js]
 [test_history_autocomplete_tags.js]
 [test_history_catobs.js]
-[test_history_import.js]
 [test_history_notifications.js]
 [test_history_observer.js]
 [test_history_removeAllPages.js]
 [test_history_sidebar.js]
 [test_isvisited.js]
 [test_lastModified.js]
 [test_livemarkService_getLivemarkIdForFeedURI.js]
 [test_markpageas.js]
-[test_migrateFrecency.js]
 [test_moz-anno_favicon_mime_type.js]
 [test_multi_queries.js]
 [test_multi_word_tags.js]
 [test_nsINavHistoryViewer.js]
 [test_null_interfaces.js]
 [test_onBeforeDeleteURI_observer.js]
 [test_onItemChanged_tags.js]
 [test_placeURIs.js]
--- a/toolkit/library/libxul-config.mk
+++ b/toolkit/library/libxul-config.mk
@@ -226,17 +226,19 @@ endif
 endif
 
 ifdef MOZ_STORAGE
 COMPONENT_LIBS += storagecomps
 EXTRA_DSO_LDOPTS += $(SQLITE_LIBS)
 endif
 
 ifdef MOZ_PLACES
+ifdef MOZ_MORKREADER
 STATIC_LIBS += morkreader_s
+endif
 
 COMPONENT_LIBS += \
 	places \
 	$(NULL)
 endif
 
 ifdef MOZ_MORK
 ifdef MOZ_XUL
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -936,21 +936,26 @@ if [ "$MOZ_ZIPWRITER" ]; then
   add_makefiles "
     modules/libjar/zipwriter/Makefile
     modules/libjar/zipwriter/public/Makefile
     modules/libjar/zipwriter/src/Makefile
     modules/libjar/zipwriter/test/Makefile
   "
 fi
 
+if [ "$MOZ_MORKREADER" ]; then
+  add_makefiles "
+    db/morkreader/Makefile
+    db/morkreader/external/Makefile
+  "
+fi
+
 if [ "$MOZ_STORAGE" ]; then
   add_makefiles "
     db/sqlite3/src/Makefile
-    db/morkreader/Makefile
-    db/morkreader/external/Makefile
     storage/Makefile
     storage/public/Makefile
     storage/src/Makefile
     storage/build/Makefile
     storage/test/Makefile
   "
 fi