toolkit/components/places/tests/chrome/test_381357.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="Add Livemarks from RSS feed served as text/html"
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 loading feeds with text/html
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/rss_as_html.rss";
michael@0 31
michael@0 32 PlacesUtils.livemarks.addLivemark(
michael@0 33 { title: "foo"
michael@0 34 , parentId: PlacesUtils.toolbarFolderId
michael@0 35 , index: PlacesUtils.bookmarks.DEFAULT_INDEX
michael@0 36 , feedURI: NetUtil.newURI(FEEDSPEC)
michael@0 37 , siteURI: NetUtil.newURI("http:/mochi.test/")
michael@0 38 })
michael@0 39 .then(function (aLivemark) {
michael@0 40 waitForLivemarkLoad(aLivemark, function (aLivemark) {
michael@0 41 let nodes = aLivemark.getNodesForContainer({});
michael@0 42
michael@0 43 is(nodes[0].title, "The First Title",
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 SimpleTest.finish();
michael@0 52 }
michael@0 53 );
michael@0 54 }
michael@0 55
michael@0 56 function waitForLivemarkLoad(aLivemark, aCallback) {
michael@0 57 // Don't need a real node here.
michael@0 58 let node = {};
michael@0 59 let resultObserver = {
michael@0 60 nodeInserted: function() {},
michael@0 61 nodeRemoved: function() {},
michael@0 62 nodeAnnotationChanged: function() {},
michael@0 63 nodeTitleChanged: function() {},
michael@0 64 nodeHistoryDetailsChanged: function() {},
michael@0 65 nodeMoved: function() {},
michael@0 66 ontainerStateChanged: function () {},
michael@0 67 sortingChanged: function() {},
michael@0 68 batching: function() {},
michael@0 69 invalidateContainer: function(node) {
michael@0 70 isnot(aLivemark.status, Ci.mozILivemark.STATUS_FAILED,
michael@0 71 "Loading livemark should success");
michael@0 72 if (aLivemark.status == Ci.mozILivemark.STATUS_READY) {
michael@0 73 aLivemark.unregisterForUpdates(node, resultObserver);
michael@0 74 aCallback(aLivemark);
michael@0 75 }
michael@0 76 }
michael@0 77 };
michael@0 78 aLivemark.registerForUpdates(node, resultObserver);
michael@0 79 aLivemark.reload();
michael@0 80 }
michael@0 81
michael@0 82 ]]>
michael@0 83 </script>
michael@0 84
michael@0 85 </window>

mercurial