summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/unit/test_bug636917_isLivemark.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/places/tests/unit/test_bug636917_isLivemark.js')
-rw-r--r--toolkit/components/places/tests/unit/test_bug636917_isLivemark.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/toolkit/components/places/tests/unit/test_bug636917_isLivemark.js b/toolkit/components/places/tests/unit/test_bug636917_isLivemark.js
new file mode 100644
index 000000000..a7ad1257a
--- /dev/null
+++ b/toolkit/components/places/tests/unit/test_bug636917_isLivemark.js
@@ -0,0 +1,35 @@
+// Test that asking for a livemark in a annotationChanged notification works.
+add_task(function* () {
+ let annoPromise = new Promise(resolve => {
+ let annoObserver = {
+ onItemAnnotationSet(id, name) {
+ if (name == PlacesUtils.LMANNO_FEEDURI) {
+ PlacesUtils.annotations.removeObserver(this);
+ resolve();
+ }
+ },
+ onItemAnnotationRemoved() {},
+ onPageAnnotationSet() {},
+ onPageAnnotationRemoved() {},
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.nsIAnnotationObserver
+ ]),
+ };
+ PlacesUtils.annotations.addObserver(annoObserver, false);
+ });
+
+
+ let livemark = yield PlacesUtils.livemarks.addLivemark(
+ { title: "livemark title"
+ , parentGuid: PlacesUtils.bookmarks.unfiledGuid
+ , index: PlacesUtils.bookmarks.DEFAULT_INDEX
+ , siteURI: uri("http://example.com/")
+ , feedURI: uri("http://example.com/rdf")
+ });
+
+ yield annoPromise;
+
+ livemark = yield PlacesUtils.livemarks.getLivemark({ guid: livemark.guid });
+ Assert.ok(livemark);
+ yield PlacesUtils.livemarks.removeLivemark({ guid: livemark.guid });
+});