2007-07-26 09:23:11 -07:00
|
|
|
/* -*- 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 mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Google Inc.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2005
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Darin Fisher <darin@meer.net>
|
|
|
|
* Dietrich Ayala <dietrich@mozilla.com>
|
|
|
|
* Dan Mills <thunder@mozilla.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 ***** */
|
|
|
|
|
|
|
|
// Get browser history service
|
|
|
|
try {
|
|
|
|
var bhist = Cc["@mozilla.org/browser/global-history;2"].getService(Ci.nsIBrowserHistory);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("Could not get history service\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get navhistory service
|
|
|
|
try {
|
|
|
|
var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("Could not get history service\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get annotation service
|
|
|
|
try {
|
|
|
|
var annosvc= Cc["@mozilla.org/browser/annotation-service;1"].getService(Ci.nsIAnnotationService);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("Could not get annotation service\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get bookmark service
|
|
|
|
try {
|
|
|
|
var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("Could not get nav-bookmarks-service\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// create and add history observer
|
|
|
|
var observer = {
|
|
|
|
onBeginUpdateBatch: function() {
|
|
|
|
},
|
|
|
|
onEndUpdateBatch: function() {
|
|
|
|
},
|
|
|
|
onVisit: function(aURI, aVisitID, aTime, aSessionID, aReferringID, aTransitionType) {
|
|
|
|
},
|
2007-08-15 14:22:56 -07:00
|
|
|
onTitleChanged: function(aURI, aPageTitle) {
|
2007-07-26 09:23:11 -07:00
|
|
|
},
|
|
|
|
onDeleteURI: function(aURI) {
|
|
|
|
},
|
|
|
|
onClearHistory: function() {
|
|
|
|
this.historyCleared = true;
|
|
|
|
},
|
|
|
|
onPageChanged: function(aURI, aWhat, aValue) {
|
|
|
|
},
|
|
|
|
expiredURIs: [],
|
|
|
|
onPageExpired: function(aURI, aVisitTime, aWholeEntry) {
|
|
|
|
this.expiredURI = aURI.spec;
|
|
|
|
},
|
|
|
|
QueryInterface: function(iid) {
|
|
|
|
if (iid.equals(Ci.nsINavBookmarkObserver) ||
|
|
|
|
iid.equals(Ci.nsISupports)) {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
throw Cr.NS_ERROR_NO_INTERFACE;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
histsvc.addObserver(observer, false);
|
|
|
|
|
2007-08-24 10:40:55 -07:00
|
|
|
// get direct db connection for date-based anno tests
|
|
|
|
var dirService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
|
|
|
var dbFile = dirService.get("ProfD", Ci.nsIFile);
|
|
|
|
dbFile.append("places.sqlite");
|
|
|
|
|
|
|
|
var dbService = Cc["@mozilla.org/storage/service;1"].getService(Ci.mozIStorageService);
|
|
|
|
var dbConnection = dbService.openDatabase(dbFile);
|
|
|
|
|
|
|
|
|
2007-11-04 17:10:37 -08:00
|
|
|
var testURI = uri("http://mozilla.com");
|
|
|
|
var testAnnoName = "tests/expiration/history";
|
|
|
|
var testAnnoVal = "foo";
|
2007-12-05 00:30:07 -08:00
|
|
|
var bookmark = bmsvc.insertBookmark(bmsvc.bookmarksMenuFolder, testURI, bmsvc.DEFAULT_INDEX, "foo");
|
2007-11-04 17:10:37 -08:00
|
|
|
var triggerURI = uri("http://foobar.com");
|
|
|
|
|
2007-07-26 09:23:11 -07:00
|
|
|
// main
|
|
|
|
function run_test() {
|
|
|
|
/*
|
|
|
|
test that nsIBrowserHistory.removePagesFromHost does remove expirable annotations
|
|
|
|
but doesn't remove bookmarks or EXPIRE_NEVER annotations.
|
|
|
|
*/
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-26 09:23:11 -07:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName + "Hist", testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY);
|
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName + "Never", testAnnoVal, 0, annosvc.EXPIRE_NEVER);
|
|
|
|
bhist.removePagesFromHost("mozilla.com", false);
|
|
|
|
do_check_eq(bmsvc.getBookmarkURI(bookmark).spec, testURI.spec);
|
|
|
|
try {
|
|
|
|
annosvc.getPageAnnotation(testAnnoName + "Hist");
|
|
|
|
do_throw("nsIBrowserHistory.removePagesFromHost() didn't remove an EXPIRE_WITH_HISTORY annotation");
|
|
|
|
} catch(ex) {}
|
|
|
|
do_check_eq(annosvc.getPageAnnotation(testURI, testAnnoName + "Never"), testAnnoVal);
|
|
|
|
annosvc.removePageAnnotation(testURI, testAnnoName + "Never");
|
|
|
|
|
|
|
|
/*
|
|
|
|
test that nsIBrowserHistory.removeAllPages does remove expirable annotations
|
|
|
|
but doesn't remove bookmarks or EXPIRE_NEVER annotations.
|
|
|
|
*/
|
2007-08-24 10:40:55 -07:00
|
|
|
var removeAllTestURI = uri("http://removeallpages.com");
|
2007-09-09 17:48:34 -07:00
|
|
|
var removeAllTestURINever = uri("http://removeallpagesnever.com");
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(removeAllTestURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-09-09 17:48:34 -07:00
|
|
|
var bmURI = uri("http://bookmarked");
|
2007-12-05 00:30:07 -08:00
|
|
|
bmsvc.insertBookmark(bmsvc.bookmarksMenuFolder, bmURI, bmsvc.DEFAULT_INDEX, "foo");
|
2008-01-23 13:23:13 -08:00
|
|
|
//bhist.addPageWithDetails(placeURI, "place uri", Date.now() * 1000);
|
2007-09-09 17:48:34 -07:00
|
|
|
var placeURI = uri("place:folder=23");
|
2008-01-23 13:23:13 -08:00
|
|
|
bhist.addPageWithDetails(placeURI, "place uri", Date.now() * 1000);
|
2007-08-24 10:40:55 -07:00
|
|
|
annosvc.setPageAnnotation(removeAllTestURI, testAnnoName + "Hist", testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY);
|
2007-09-09 17:48:34 -07:00
|
|
|
annosvc.setPageAnnotation(removeAllTestURINever, testAnnoName + "Never", testAnnoVal, 0, annosvc.EXPIRE_NEVER);
|
2007-07-26 09:23:11 -07:00
|
|
|
bhist.removeAllPages();
|
|
|
|
try {
|
2007-09-09 17:48:34 -07:00
|
|
|
annosvc.getPageAnnotation(removeAllTestURI, testAnnoName + "Hist");
|
|
|
|
do_throw("nsIBrowserHistory.removeAllPages() didn't remove an EXPIRE_WITH_HISTORY annotation");
|
2007-07-26 09:23:11 -07:00
|
|
|
} catch(ex) {}
|
2007-09-09 17:48:34 -07:00
|
|
|
// test that the moz_places record was removed for this URI
|
|
|
|
do_check_eq(histsvc.getPageTitle(removeAllTestURI), null);
|
2007-08-24 10:40:55 -07:00
|
|
|
try {
|
2007-09-09 17:48:34 -07:00
|
|
|
do_check_eq(annosvc.getPageAnnotation(removeAllTestURINever, testAnnoName + "Never"), testAnnoVal);
|
|
|
|
annosvc.removePageAnnotation(removeAllTestURINever, testAnnoName + "Never");
|
2007-08-24 10:40:55 -07:00
|
|
|
} catch(ex) {
|
|
|
|
do_throw("nsIBrowserHistory.removeAllPages deleted EXPIRE_NEVER annos!");
|
|
|
|
}
|
2007-09-09 17:48:34 -07:00
|
|
|
// test that the moz_places record was not removed for EXPIRE_NEVER anno
|
|
|
|
do_check_neq(histsvc.getPageTitle(removeAllTestURINever), null);
|
|
|
|
// for place URI
|
|
|
|
do_check_neq(histsvc.getPageTitle(placeURI), null);
|
|
|
|
// for bookmarked URI
|
|
|
|
do_check_neq(histsvc.getPageTitle(bmURI), null);
|
2007-07-26 09:23:11 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
test anno expiration (expire never)
|
|
|
|
*/
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-26 09:23:11 -07:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_NEVER);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_NEVER);
|
|
|
|
histsvc.removeAllPages();
|
|
|
|
// anno should still be there
|
|
|
|
do_check_eq(annosvc.getPageAnnotation(testURI, testAnnoName), testAnnoVal);
|
|
|
|
do_check_eq(annosvc.getItemAnnotation(bookmark, testAnnoName), testAnnoVal);
|
2007-08-19 13:02:48 -07:00
|
|
|
annosvc.removeItemAnnotation(bookmark, testAnnoName);
|
2007-07-26 09:23:11 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
test anno expiration (expire with history)
|
|
|
|
*/
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-26 09:23:11 -07:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY);
|
|
|
|
histsvc.removeAllPages();
|
|
|
|
try {
|
|
|
|
annosvc.getPageAnnotation(testURI, testAnnoName);
|
|
|
|
do_throw("page still had expire_with_history anno");
|
|
|
|
} catch(ex) {}
|
|
|
|
|
|
|
|
/*
|
|
|
|
test anno expiration (days)
|
|
|
|
- add a bookmark, set an anno on the bookmarked uri
|
|
|
|
- manually tweak moz_annos.dateAdded, making it expired
|
|
|
|
- add another entry (to kick off expiration)
|
|
|
|
- try to get the anno (should fail. maybe race here? is there a way to determine
|
|
|
|
if the page has been added, so we know that expiration is done?)
|
|
|
|
*/
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-30 16:15:32 -07:00
|
|
|
|
2007-07-26 09:23:11 -07:00
|
|
|
// these annotations should be removed (after manually tweaking their dateAdded)
|
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_DAYS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_DAYS);
|
2007-07-30 16:15:32 -07:00
|
|
|
|
2007-08-23 15:26:11 -07:00
|
|
|
// set dateAdded to 8 days ago
|
|
|
|
var expirationDate = (Date.now() - (8 * 86400 * 1000)) * 1000;
|
2007-07-26 09:23:11 -07:00
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_annos SET dateAdded = " + expirationDate);
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_items_annos SET dateAdded = " + expirationDate);
|
2007-07-30 16:15:32 -07:00
|
|
|
|
2007-07-26 09:23:11 -07:00
|
|
|
// these annotations should remain
|
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName + "NotExpired", testAnnoVal, 0, annosvc.EXPIRE_DAYS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName + "NotExpired", testAnnoVal, 0, annosvc.EXPIRE_DAYS);
|
|
|
|
|
|
|
|
// add a uri and then remove it, to trigger expiration
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-26 09:23:11 -07:00
|
|
|
bhist.removePage(triggerURI);
|
|
|
|
|
|
|
|
// test for unexpired annos
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getPageAnnotation(testURI, testAnnoName + "NotExpired"), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("anno < 7 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removePageAnnotation(testURI, testAnnoName + "NotExpired");
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getItemAnnotation(bookmark, testAnnoName + "NotExpired"), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("item anno < 7 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removeItemAnnotation(bookmark, testAnnoName + "NotExpired");
|
|
|
|
|
|
|
|
// test for expired annos
|
|
|
|
try {
|
|
|
|
annosvc.getPageAnnotation(testURI, testAnnoName);
|
|
|
|
do_throw("page still had days anno");
|
|
|
|
} catch(ex) {}
|
|
|
|
try {
|
|
|
|
annosvc.getItemAnnotation(bookmark, testAnnoName);
|
|
|
|
do_throw("bookmark still had days anno");
|
|
|
|
} catch(ex) {}
|
|
|
|
|
2007-08-23 15:26:11 -07:00
|
|
|
// test anno expiration (days) removes annos annos 6 days old
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-08-23 15:26:11 -07:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_DAYS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_DAYS);
|
|
|
|
// these annotations should remain as they are only 6 days old
|
|
|
|
var expirationDate = (Date.now() - (6 * 86400 * 1000)) * 1000;
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_annos SET dateAdded = " + expirationDate);
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_items_annos SET dateAdded = " + expirationDate);
|
|
|
|
|
|
|
|
// add a uri and then remove it, to trigger expiration
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-08-23 15:26:11 -07:00
|
|
|
bhist.removePage(triggerURI);
|
|
|
|
|
|
|
|
// test for unexpired annos
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getPageAnnotation(testURI, testAnnoName), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("anno < 7 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removePageAnnotation(testURI, testAnnoName);
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getItemAnnotation(bookmark, testAnnoName), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("item anno < 7 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removeItemAnnotation(bookmark, testAnnoName);
|
|
|
|
|
|
|
|
|
|
|
|
// test anno expiration (weeks) removes annos 31 days old
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-26 09:23:11 -07:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WEEKS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WEEKS);
|
2007-08-23 15:26:11 -07:00
|
|
|
// these annotations should not remain as they are 31 days old
|
|
|
|
var expirationDate = (Date.now() - (31 * 86400 * 1000)) * 1000;
|
2007-07-26 09:23:11 -07:00
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_annos SET dateAdded = " + expirationDate);
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_items_annos SET dateAdded = " + expirationDate);
|
|
|
|
// these annotations should remain
|
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName + "NotExpired", testAnnoVal, 0, annosvc.EXPIRE_WEEKS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName + "NotExpired", testAnnoVal, 0, annosvc.EXPIRE_WEEKS);
|
|
|
|
|
|
|
|
// add a uri and then remove it, to trigger expiration
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-26 09:23:11 -07:00
|
|
|
bhist.removePage(triggerURI);
|
|
|
|
|
|
|
|
// test for unexpired annos
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getPageAnnotation(testURI, testAnnoName + "NotExpired"), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("anno < 30 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removePageAnnotation(testURI, testAnnoName + "NotExpired");
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getItemAnnotation(bookmark, testAnnoName + "NotExpired"), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("item anno < 30 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removeItemAnnotation(bookmark, testAnnoName + "NotExpired");
|
|
|
|
|
|
|
|
try {
|
|
|
|
annosvc.getPageAnnotation(testURI, testAnnoName);
|
|
|
|
do_throw("page still had weeks anno");
|
|
|
|
} catch(ex) {}
|
|
|
|
try {
|
|
|
|
annosvc.getItemAnnotation(bookmark, testAnnoName);
|
|
|
|
do_throw("bookmark still had weeks anno");
|
|
|
|
} catch(ex) {}
|
|
|
|
|
2007-08-23 15:26:11 -07:00
|
|
|
// test anno expiration (weeks) does not remove annos 29 days old
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-08-23 15:26:11 -07:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WEEKS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WEEKS);
|
|
|
|
// these annotations should remain as they are only 29 days old
|
|
|
|
var expirationDate = (Date.now() - (29 * 86400 * 1000)) * 1000;
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_annos SET dateAdded = " + expirationDate);
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_items_annos SET dateAdded = " + expirationDate);
|
|
|
|
|
|
|
|
// add a uri and then remove it, to trigger expiration
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-08-23 15:26:11 -07:00
|
|
|
bhist.removePage(triggerURI);
|
|
|
|
|
|
|
|
// test for unexpired annos
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getPageAnnotation(testURI, testAnnoName), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("anno < 30 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removePageAnnotation(testURI, testAnnoName);
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getItemAnnotation(bookmark, testAnnoName), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("item anno < 30 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removeItemAnnotation(bookmark, testAnnoName);
|
|
|
|
|
|
|
|
// test anno expiration (months) removes annos 181 days old
|
2007-07-26 09:23:11 -07:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_MONTHS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_MONTHS);
|
2007-08-23 15:26:11 -07:00
|
|
|
var expirationDate = (Date.now() - (181 * 86400 * 1000)) * 1000;
|
2007-07-26 09:23:11 -07:00
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_annos SET dateAdded = " + expirationDate);
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_items_annos SET dateAdded = " + expirationDate);
|
|
|
|
// these annotations should remain
|
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName + "NotExpired", testAnnoVal, 0, annosvc.EXPIRE_MONTHS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName + "NotExpired", testAnnoVal, 0, annosvc.EXPIRE_MONTHS);
|
|
|
|
|
|
|
|
// add a uri and then remove it, to trigger expiration
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-26 09:23:11 -07:00
|
|
|
bhist.removePage(triggerURI);
|
|
|
|
|
|
|
|
// test for unexpired annos
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getPageAnnotation(testURI, testAnnoName + "NotExpired"), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("anno < 180 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removePageAnnotation(testURI, testAnnoName + "NotExpired");
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getItemAnnotation(bookmark, testAnnoName + "NotExpired"), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("item anno < 180 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removeItemAnnotation(bookmark, testAnnoName + "NotExpired");
|
|
|
|
|
|
|
|
try {
|
|
|
|
var annoVal = annosvc.getPageAnnotation(testURI, testAnnoName);
|
|
|
|
do_throw("page still had months anno");
|
|
|
|
} catch(ex) {}
|
|
|
|
try {
|
|
|
|
annosvc.getItemAnnotation(bookmark, testAnnoName);
|
|
|
|
do_throw("bookmark still had months anno");
|
|
|
|
} catch(ex) {}
|
|
|
|
|
2007-08-23 15:26:11 -07:00
|
|
|
// test anno expiration (months) does not remove annos 179 days old
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-08-23 15:26:11 -07:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_MONTHS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_MONTHS);
|
|
|
|
// these annotations should remain as they are only 179 days old
|
|
|
|
var expirationDate = (Date.now() - (179 * 86400 * 1000)) * 1000;
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_annos SET dateAdded = " + expirationDate);
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_items_annos SET dateAdded = " + expirationDate);
|
|
|
|
|
|
|
|
// add a uri and then remove it, to trigger expiration
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-08-23 15:26:11 -07:00
|
|
|
bhist.removePage(triggerURI);
|
|
|
|
|
|
|
|
// test for unexpired annos
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getPageAnnotation(testURI, testAnnoName), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("anno < 180 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removePageAnnotation(testURI, testAnnoName);
|
|
|
|
try {
|
|
|
|
do_check_eq(annosvc.getItemAnnotation(bookmark, testAnnoName), testAnnoVal);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("item anno < 180 days old was expired!");
|
|
|
|
}
|
|
|
|
annosvc.removeItemAnnotation(bookmark, testAnnoName);
|
|
|
|
|
2007-07-26 09:23:11 -07:00
|
|
|
// test anno expiration (session)
|
|
|
|
// XXX requires app restart
|
2007-07-30 16:15:32 -07:00
|
|
|
|
|
|
|
// test expiration of anno dateAdded vs lastModified (bug #389902)
|
|
|
|
// add an anno w/ days expiration
|
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_DAYS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_DAYS);
|
|
|
|
// make it 8 days old
|
|
|
|
var expirationDate = (Date.now() - (8 * 86400 * 1000)) * 1000;
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_annos SET dateAdded = " + expirationDate);
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_items_annos SET dateAdded = " + expirationDate);
|
|
|
|
// modify it's value
|
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, "mod", 0, annosvc.EXPIRE_DAYS);
|
|
|
|
annosvc.setItemAnnotation(bookmark, testAnnoName, "mod", 0, annosvc.EXPIRE_DAYS);
|
|
|
|
// add a uri and then remove it, to trigger expiration
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-30 16:15:32 -07:00
|
|
|
bhist.removePage(triggerURI);
|
|
|
|
// anno should still be there
|
|
|
|
try {
|
|
|
|
var annoVal = annosvc.getPageAnnotation(testURI, testAnnoName);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("page lost a days anno that was 8 days old, but was modified today");
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
annosvc.getItemAnnotation(bookmark, testAnnoName);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw("bookmark lost a days anno that was 8 days old, but was modified today");
|
|
|
|
}
|
|
|
|
|
|
|
|
// now make the anno lastModified 8 days old
|
|
|
|
var expirationDate = (Date.now() - (8 * 86400 * 1000)) * 1000;
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_annos SET lastModified = " + expirationDate);
|
|
|
|
dbConnection.executeSimpleSQL("UPDATE moz_items_annos SET lastModified = " + expirationDate);
|
|
|
|
// add a uri and then remove it, to trigger expiration
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-07-30 16:15:32 -07:00
|
|
|
bhist.removePage(triggerURI);
|
|
|
|
// anno should have been deleted
|
|
|
|
try {
|
|
|
|
var annoVal = annosvc.getPageAnnotation(testURI, testAnnoName);
|
|
|
|
do_throw("page still had a days anno that was modified 8 days ago");
|
|
|
|
} catch(ex) {}
|
|
|
|
try {
|
|
|
|
annosvc.getItemAnnotation(bookmark, testAnnoName);
|
|
|
|
do_throw("bookmark lost a days anno that was modified 8 days ago");
|
|
|
|
} catch(ex) {}
|
2007-11-04 17:10:37 -08:00
|
|
|
|
|
|
|
startIncrementalExpirationTests();
|
|
|
|
}
|
|
|
|
|
|
|
|
// incremental expiration tests
|
|
|
|
// run async, chained
|
|
|
|
|
|
|
|
function startIncrementalExpirationTests() {
|
2007-12-05 00:30:07 -08:00
|
|
|
startExpireNeither();
|
2007-11-04 17:10:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
|
|
|
var ghist = Cc["@mozilla.org/browser/global-history;2"].getService(Ci.nsIGlobalHistory2);
|
|
|
|
|
|
|
|
/*
|
2008-03-18 11:03:34 -07:00
|
|
|
test 1: NO EXPIRATION CRITERIA MET (INSIDE SITES CAP)
|
2007-12-05 00:30:07 -08:00
|
|
|
|
|
|
|
1. zero visits > {browser.history_expire_days}
|
|
|
|
2. zero visits > {browser.history_expire_days_min}
|
|
|
|
AND total visited site count < {browser.history_expire_sites}
|
|
|
|
|
2007-11-04 17:10:37 -08:00
|
|
|
steps:
|
2007-12-04 23:40:49 -08:00
|
|
|
- clear history
|
2007-12-05 00:30:07 -08:00
|
|
|
- reset observer
|
|
|
|
- add a visit, w/ current date
|
|
|
|
- set browser.history_expire_days to 3
|
|
|
|
- set browser.history_expire_days_min to 2
|
|
|
|
- set browser.history_expire_sites to 2
|
|
|
|
- kick off incremental expiration
|
|
|
|
|
|
|
|
confirmation:
|
|
|
|
- check onPageExpired, confirm nothing was expired
|
|
|
|
- query for the visit, confirm it's there
|
|
|
|
|
2007-12-04 23:40:49 -08:00
|
|
|
*/
|
2007-12-05 00:30:07 -08:00
|
|
|
function startExpireNeither() {
|
|
|
|
dump("startExpireNeither()\n");
|
|
|
|
// setup
|
2007-12-05 00:01:13 -08:00
|
|
|
histsvc.removeAllPages();
|
2007-12-05 00:30:07 -08:00
|
|
|
observer.expiredURI = null;
|
|
|
|
|
|
|
|
// add data
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-12-04 23:40:49 -08:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY);
|
2007-12-05 00:30:07 -08:00
|
|
|
|
2008-03-18 11:03:34 -07:00
|
|
|
// set sites cap to 2
|
2007-12-05 00:30:07 -08:00
|
|
|
prefs.setIntPref("browser.history_expire_sites", 2);
|
|
|
|
// set date minimum to 2
|
|
|
|
prefs.setIntPref("browser.history_expire_days_min", 2);
|
|
|
|
// set date maximum to 3
|
|
|
|
prefs.setIntPref("browser.history_expire_days", 3);
|
|
|
|
|
|
|
|
// trigger expiration
|
|
|
|
ghist.addURI(triggerURI, false, true, null);
|
|
|
|
|
|
|
|
// setup confirmation
|
2007-12-05 00:01:13 -08:00
|
|
|
do_test_pending();
|
2007-12-05 00:30:07 -08:00
|
|
|
do_timeout(3600, "checkExpireNeither();"); // incremental expiration timer is 3500
|
2007-12-04 23:40:49 -08:00
|
|
|
}
|
|
|
|
|
2007-12-05 00:30:07 -08:00
|
|
|
function checkExpireNeither() {
|
|
|
|
dump("checkExpireNeither()\n");
|
2007-12-04 23:40:49 -08:00
|
|
|
try {
|
2007-12-05 00:30:07 -08:00
|
|
|
do_check_eq(observer.expiredURI, null);
|
|
|
|
do_check_eq(annosvc.getPageAnnotationNames(testURI, {}).length, 1);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw(ex);
|
|
|
|
}
|
|
|
|
dump("done incremental expiration test 1\n");
|
|
|
|
startExpireDaysOnly();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
test 2: MAX-AGE DATE CRITERIA MET
|
|
|
|
|
|
|
|
1. some visits > {browser.history_expire_days}
|
|
|
|
2. total visited sites count < {browser.history_expire_sites}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- clear history
|
|
|
|
- reset observer
|
|
|
|
- add a visit, 4 days old
|
|
|
|
- set browser.history_expire_days to 3
|
|
|
|
- set browser.history_expire_days_min to 2
|
|
|
|
- set browser.history_expire_sites to 2
|
|
|
|
- kick off incremental expiration
|
|
|
|
|
|
|
|
confirmation:
|
|
|
|
- check onPageExpired, confirm nothing was expired
|
|
|
|
- query for the visit, confirm it's there
|
|
|
|
*/
|
|
|
|
function startExpireDaysOnly() {
|
|
|
|
// setup
|
|
|
|
histsvc.removeAllPages();
|
|
|
|
observer.expiredURI = null;
|
|
|
|
|
2007-12-08 15:17:16 -08:00
|
|
|
dump("startExpireDaysOnly()\n");
|
|
|
|
|
2007-12-05 00:30:07 -08:00
|
|
|
// add expirable visit
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, (Date.now() - (86400 * 2 * 1000)) * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-12-05 00:30:07 -08:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY);
|
|
|
|
|
|
|
|
// add un-expirable visit
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(uri("http://unexpirable.com"), (Date.now() - (86400 * 1000)) * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-12-05 00:30:07 -08:00
|
|
|
|
2008-03-18 11:03:34 -07:00
|
|
|
// set sites cap to 2
|
2007-12-05 00:30:07 -08:00
|
|
|
prefs.setIntPref("browser.history_expire_sites", 2);
|
|
|
|
// set date minimum to 2
|
2007-12-08 15:17:16 -08:00
|
|
|
prefs.setIntPref("browser.history_expire_days_min", 2);
|
|
|
|
// set date maximum to 3
|
|
|
|
prefs.setIntPref("browser.history_expire_days", 3);
|
2007-12-05 00:30:07 -08:00
|
|
|
|
|
|
|
// trigger expiration
|
|
|
|
ghist.addURI(triggerURI, false, true, null);
|
|
|
|
|
|
|
|
// setup confirmation
|
|
|
|
do_timeout(3600, "checkExpireDaysOnly();"); // incremental expiration timer is 3500
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkExpireDaysOnly() {
|
|
|
|
try {
|
|
|
|
// test expired record
|
2007-12-08 15:17:16 -08:00
|
|
|
do_check_eq(observer.expiredURI, null);
|
|
|
|
do_check_eq(annosvc.getPageAnnotationNames(testURI, {}).length, 1);
|
2007-12-05 00:30:07 -08:00
|
|
|
// test unexpired record
|
|
|
|
do_check_neq(histsvc.getPageTitle(uri("http://unexpirable.com")), null);
|
2007-11-04 17:10:37 -08:00
|
|
|
} catch(ex) {}
|
2007-12-05 00:30:07 -08:00
|
|
|
dump("done expiration test 2\n");
|
|
|
|
startExpireBoth();
|
2007-11-04 17:10:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2007-12-05 00:30:07 -08:00
|
|
|
test 3: MIN-AGE+VISIT-CAP CRITERIA MET
|
2007-11-04 17:10:37 -08:00
|
|
|
|
2007-12-05 00:30:07 -08:00
|
|
|
1. zero visits > {browser.history_expire_days}
|
|
|
|
2. some visits > {browser.history_expire_days_min}
|
|
|
|
AND total visited sites count > {browser.history_expire_sites}
|
2007-11-04 17:10:37 -08:00
|
|
|
|
|
|
|
steps:
|
2007-12-05 00:01:13 -08:00
|
|
|
- clear history
|
2007-12-05 00:30:07 -08:00
|
|
|
- reset observer
|
2008-03-18 11:03:34 -07:00
|
|
|
- add a visit to an url, 2 days old
|
|
|
|
- add a visit to another url, today
|
2007-12-05 00:30:07 -08:00
|
|
|
- set browser.history_expire_days to 3
|
|
|
|
- set browser.history_expire_days_min to 1
|
|
|
|
- set browser.history_expire_sites to 1
|
2007-11-04 17:10:37 -08:00
|
|
|
- kick off incremental expiration
|
2007-12-05 00:30:07 -08:00
|
|
|
|
|
|
|
confirmation:
|
2008-03-18 11:03:34 -07:00
|
|
|
- check onPageExpired, confirm our oldest visit was expired
|
|
|
|
- query for the oldest visit, confirm it's not there
|
2007-11-04 17:10:37 -08:00
|
|
|
*/
|
2007-12-05 00:30:07 -08:00
|
|
|
function startExpireBoth() {
|
|
|
|
// setup
|
2007-12-05 00:01:13 -08:00
|
|
|
histsvc.removeAllPages();
|
2007-12-05 00:30:07 -08:00
|
|
|
observer.expiredURI = null;
|
2007-12-08 15:17:16 -08:00
|
|
|
dump("starting expiration test 3: both criteria met\n");
|
2007-12-05 00:30:07 -08:00
|
|
|
|
|
|
|
// add visits
|
|
|
|
// 2 days old, in microseconds
|
|
|
|
var age = (Date.now() - (86400 * 2 * 1000)) * 1000;
|
|
|
|
dump("AGE: " + age + "\n");
|
2007-12-21 11:37:18 -08:00
|
|
|
histsvc.addVisit(testURI, age, null, histsvc.TRANSITION_TYPED, false, 0);
|
2007-11-04 17:10:37 -08:00
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY);
|
2007-12-05 00:30:07 -08:00
|
|
|
|
2008-03-18 11:03:34 -07:00
|
|
|
// set sites cap to 1
|
2007-12-05 00:30:07 -08:00
|
|
|
prefs.setIntPref("browser.history_expire_sites", 1);
|
|
|
|
// set date max to 3
|
|
|
|
prefs.setIntPref("browser.history_expire_days", 3);
|
|
|
|
// set date minimum to 1
|
2007-12-08 15:17:16 -08:00
|
|
|
prefs.setIntPref("browser.history_expire_days_min", 1);
|
2007-12-05 00:30:07 -08:00
|
|
|
|
|
|
|
// trigger expiration
|
2008-03-18 11:03:34 -07:00
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
|
|
|
annosvc.setPageAnnotation(triggerURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY);
|
2007-12-05 00:30:07 -08:00
|
|
|
|
|
|
|
// setup confirmation
|
|
|
|
do_timeout(3600, "checkExpireBoth();"); // incremental expiration timer is 3500
|
2007-11-04 17:10:37 -08:00
|
|
|
}
|
|
|
|
|
2007-12-05 00:30:07 -08:00
|
|
|
function checkExpireBoth() {
|
2007-11-04 17:10:37 -08:00
|
|
|
try {
|
2007-12-05 00:30:07 -08:00
|
|
|
do_check_eq(observer.expiredURI, testURI.spec);
|
2007-11-04 17:10:37 -08:00
|
|
|
do_check_eq(annosvc.getPageAnnotationNames(testURI, {}).length, 0);
|
2008-03-18 11:03:34 -07:00
|
|
|
do_check_eq(annosvc.getPageAnnotationNames(triggerURI, {}).length, 1);
|
2007-11-04 17:10:37 -08:00
|
|
|
} catch(ex) {}
|
2007-12-05 00:30:07 -08:00
|
|
|
dump("done expiration test 3\n");
|
2008-03-18 11:03:34 -07:00
|
|
|
startExpireNeitherOver()
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
test 4: NO EXPIRATION CRITERIA MET (OVER SITES CAP)
|
|
|
|
|
|
|
|
1. zero visits > {browser.history_expire_days}
|
|
|
|
2. zero visits > {browser.history_expire_days_min}
|
|
|
|
AND total visited site count > {browser.history_expire_sites}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- clear history
|
|
|
|
- reset observer
|
|
|
|
- add a visit to an url, w/ current date
|
|
|
|
- add a visit to another url, w/ current date
|
|
|
|
- set browser.history_expire_days to 3
|
|
|
|
- set browser.history_expire_days_min to 2
|
|
|
|
- set browser.history_expire_sites to 1
|
|
|
|
- kick off incremental expiration
|
|
|
|
|
|
|
|
confirmation:
|
|
|
|
- check onPageExpired, confirm nothing was expired
|
|
|
|
- query for the visit, confirm it's there
|
|
|
|
|
|
|
|
*/
|
|
|
|
function startExpireNeitherOver() {
|
|
|
|
dump("startExpireNeitherOver()\n");
|
|
|
|
// setup
|
|
|
|
histsvc.removeAllPages();
|
|
|
|
observer.expiredURI = null;
|
|
|
|
|
|
|
|
// add data
|
|
|
|
histsvc.addVisit(testURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
|
|
|
annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY);
|
|
|
|
|
|
|
|
// set sites cap to 1
|
|
|
|
prefs.setIntPref("browser.history_expire_sites", 1);
|
|
|
|
// set date minimum to 2
|
|
|
|
prefs.setIntPref("browser.history_expire_days_min", 2);
|
|
|
|
// set date maximum to 3
|
|
|
|
prefs.setIntPref("browser.history_expire_days", 3);
|
|
|
|
|
|
|
|
// trigger expiration
|
|
|
|
histsvc.addVisit(triggerURI, Date.now() * 1000, null, histsvc.TRANSITION_TYPED, false, 0);
|
|
|
|
annosvc.setPageAnnotation(triggerURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY);
|
|
|
|
|
|
|
|
// setup confirmation
|
|
|
|
do_timeout(3600, "checkExpireNeitherOver();"); // incremental expiration timer is 3500
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkExpireNeitherOver() {
|
|
|
|
dump("checkExpireNeitherOver()\n");
|
|
|
|
try {
|
|
|
|
do_check_eq(observer.expiredURI, null);
|
|
|
|
do_check_eq(annosvc.getPageAnnotationNames(testURI, {}).length, 1);
|
|
|
|
do_check_eq(annosvc.getPageAnnotationNames(triggerURI, {}).length, 1);
|
|
|
|
} catch(ex) {
|
|
|
|
do_throw(ex);
|
|
|
|
}
|
|
|
|
dump("done incremental expiration test 4\n");
|
2007-11-04 17:10:37 -08:00
|
|
|
do_test_finished();
|
2007-07-26 09:23:11 -07:00
|
|
|
}
|