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"
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
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 INITIALSITESPEC = "http://mochi.test:8888/";
32 const FEEDSITESPEC = "http://example.org/";
34 PlacesUtils.livemarks.addLivemark(
35 { title: "foo"
36 , parentId: PlacesUtils.toolbarFolderId
37 , index: PlacesUtils.bookmarks.DEFAULT_INDEX
38 , feedURI: NetUtil.newURI(FEEDSPEC)
39 , siteURI: NetUtil.newURI(INITIALSITESPEC)
40 })
41 .then(function (aLivemark) {
42 is(aLivemark.siteURI.spec, INITIALSITESPEC,
43 "Has correct initial livemark site URI");
45 waitForLivemarkLoad(aLivemark, function (aLivemark) {
46 is(aLivemark.siteURI.spec, FEEDSITESPEC,
47 "livemark site URI set to value in feed");
49 PlacesUtils.bookmarks.removeItem(aLivemark.id);
50 SimpleTest.finish();
51 });
52 }, function () {
53 is(true, false, "Should not fail adding a livemark");
54 }
55 );
56 }
58 function waitForLivemarkLoad(aLivemark, aCallback) {
59 // Don't need a real node here.
60 let node = {};
61 let resultObserver = {
62 nodeInserted: function() {},
63 nodeRemoved: function() {},
64 nodeAnnotationChanged: function() {},
65 nodeTitleChanged: function() {},
66 nodeHistoryDetailsChanged: function() {},
67 nodeMoved: function() {},
68 ontainerStateChanged: function () {},
69 sortingChanged: function() {},
70 batching: function() {},
71 invalidateContainer: function(node) {
72 isnot(aLivemark.status, Ci.mozILivemark.STATUS_FAILED,
73 "Loading livemark should success");
74 if (aLivemark.status == Ci.mozILivemark.STATUS_READY) {
75 aLivemark.unregisterForUpdates(node, resultObserver);
76 aCallback(aLivemark);
77 }
78 }
79 };
80 aLivemark.registerForUpdates(node, resultObserver);
81 aLivemark.reload();
82 }
84 ]]>
85 </script>
87 </window>