toolkit/components/places/tests/chrome/test_341972b.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet
michael@0 4 href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
michael@0 5 <window title="Update Livemark SiteURI, null to start"
michael@0 6 xmlns:html="http://www.w3.org/1999/xhtml"
michael@0 7 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 8 onload="runTest()">
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 11
michael@0 12 <body xmlns="http://www.w3.org/1999/xhtml" />
michael@0 13
michael@0 14 <script type="application/javascript">
michael@0 15 <![CDATA[
michael@0 16 /*
michael@0 17 Test updating livemark siteURI to the value from the feed, when it's null
michael@0 18 */
michael@0 19 SimpleTest.waitForExplicitFinish();
michael@0 20
michael@0 21 const Cc = Components.classes;
michael@0 22 const Ci = Components.interfaces;
michael@0 23 const Cr = Components.results;
michael@0 24
michael@0 25 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
michael@0 26 Components.utils.import("resource://gre/modules/NetUtil.jsm");
michael@0 27 Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
michael@0 28
michael@0 29 function runTest() {
michael@0 30 const FEEDSPEC = "http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/sample_feed.atom";
michael@0 31 const FEEDSITESPEC = "http://example.org/";
michael@0 32
michael@0 33 PlacesUtils.livemarks.addLivemark(
michael@0 34 { title: "foo"
michael@0 35 , parentId: PlacesUtils.toolbarFolderId
michael@0 36 , index: PlacesUtils.bookmarks.DEFAULT_INDEX
michael@0 37 , feedURI: NetUtil.newURI(FEEDSPEC)
michael@0 38 })
michael@0 39 .then(function (aLivemark) {
michael@0 40 is(aLivemark.siteURI, null, "Has null livemark site URI");
michael@0 41
michael@0 42 waitForLivemarkLoad(aLivemark, function (aLivemark) {
michael@0 43 is(aLivemark.siteURI.spec, FEEDSITESPEC,
michael@0 44 "livemark site URI set to value in feed");
michael@0 45
michael@0 46 PlacesUtils.bookmarks.removeItem(aLivemark.id);
michael@0 47 SimpleTest.finish();
michael@0 48 });
michael@0 49 }, function () {
michael@0 50 is(true, false, "Should not fail adding a livemark");
michael@0 51 }
michael@0 52 );
michael@0 53 }
michael@0 54
michael@0 55 function waitForLivemarkLoad(aLivemark, aCallback) {
michael@0 56 // Don't need a real node here.
michael@0 57 let node = {};
michael@0 58 let resultObserver = {
michael@0 59 nodeInserted: function() {},
michael@0 60 nodeRemoved: function() {},
michael@0 61 nodeAnnotationChanged: function() {},
michael@0 62 nodeTitleChanged: function() {},
michael@0 63 nodeHistoryDetailsChanged: function() {},
michael@0 64 nodeMoved: function() {},
michael@0 65 ontainerStateChanged: function () {},
michael@0 66 sortingChanged: function() {},
michael@0 67 batching: function() {},
michael@0 68 invalidateContainer: function(node) {
michael@0 69 isnot(aLivemark.status, Ci.mozILivemark.STATUS_FAILED,
michael@0 70 "Loading livemark should success");
michael@0 71 if (aLivemark.status == Ci.mozILivemark.STATUS_READY) {
michael@0 72 aLivemark.unregisterForUpdates(node, resultObserver);
michael@0 73 aCallback(aLivemark);
michael@0 74 }
michael@0 75 }
michael@0 76 };
michael@0 77 aLivemark.registerForUpdates(node, resultObserver);
michael@0 78 aLivemark.reload();
michael@0 79 }
michael@0 80
michael@0 81 ]]>
michael@0 82 </script>
michael@0 83
michael@0 84 </window>

mercurial