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