2007-03-22 10:30:00 -07:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
|
|
<?xml-stylesheet
|
|
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
2008-01-05 20:45:01 -08:00
|
|
|
<window title="Update Livemark SiteURI, null to start"
|
2007-03-22 10:30:00 -07:00
|
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
|
|
|
|
<body xmlns="http://www.w3.org/1999/xhtml" />
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
<![CDATA[
|
2008-01-05 20:45:01 -08:00
|
|
|
/*
|
|
|
|
Test updating livemark siteURI to the value from the feed, when it's null
|
|
|
|
to start
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
const Cc = Components.classes;
|
|
|
|
const Ci = Components.interfaces;
|
|
|
|
const Cr = Components.results;
|
|
|
|
|
|
|
|
var iosvc = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
|
|
|
|
|
|
|
function uri(spec) {
|
|
|
|
return iosvc.newURI(spec, null, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
var lmsvc = Cc["@mozilla.org/browser/livemark-service;2"].
|
|
|
|
getService(Ci.nsILivemarkService);
|
|
|
|
var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
|
|
|
getService(Ci.nsINavBookmarksService);
|
2008-01-05 20:45:01 -08:00
|
|
|
var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
|
|
|
|
getService(Ci.nsINavHistoryService);
|
2008-01-07 19:36:51 -08:00
|
|
|
var annosvc = Cc["@mozilla.org/browser/annotation-service;1"].
|
|
|
|
getService(Ci.nsIAnnotationService);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-01-05 20:45:01 -08:00
|
|
|
var toolbarFolderId = bmsvc.toolbarFolder;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
var observer =
|
|
|
|
{
|
|
|
|
QueryInterface: function(iid) {
|
2008-01-07 19:36:51 -08:00
|
|
|
if (iid.equals(Ci.nsIAnnotationObserver) ||
|
2007-03-22 10:30:00 -07:00
|
|
|
iid.equals(Ci.nsISupports))
|
|
|
|
return this;
|
|
|
|
throw Cr.NS_ERROR_NO_INTERFACE;
|
|
|
|
},
|
|
|
|
|
2008-01-07 19:36:51 -08:00
|
|
|
// nsIAnnotationObserver
|
|
|
|
onItemAnnotationSet: function(aItemId, aAnnotationName) {
|
|
|
|
if (aAnnotationName == "livemark/siteURI") {
|
|
|
|
var newSiteURI = annosvc.getItemAnnotation(aItemId, aAnnotationName);
|
|
|
|
ok(newSiteURI == FEEDSITESPEC,
|
|
|
|
"livemark site URI not set to value in feed");
|
|
|
|
annosvc.removeObserver(this);
|
|
|
|
bmsvc.removeFolder(gLivemarkId);
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
},
|
2008-01-07 19:36:51 -08:00
|
|
|
onItemAnnotationRemoved: function(aItemId, aAnnotationName) {},
|
|
|
|
onPageAnnotationSet: function(aUri, aAnnotationName) {},
|
|
|
|
onPageAnnotationRemoved: function(aUri, aAnnotationName) {}
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2007-03-22 17:56:55 -07:00
|
|
|
const FEEDSPEC = "http://localhost:8888/tests/toolkit/components/places/tests/chrome/sample_feed.atom";
|
2008-01-05 20:45:01 -08:00
|
|
|
const FEEDSITESPEC = "http://example.org/";
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-02-08 20:41:35 -08:00
|
|
|
gLivemarkId = lmsvc.createLivemarkFolderOnly(toolbarFolderId, "foo",
|
2008-01-05 20:45:01 -08:00
|
|
|
null, uri(FEEDSPEC), -1);
|
2008-01-07 19:36:51 -08:00
|
|
|
annosvc.addObserver(observer, false);
|
2007-03-22 10:30:00 -07:00
|
|
|
lmsvc.reloadLivemarkFolder(gLivemarkId);
|
2008-01-05 20:45:01 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</window>
|