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

mercurial