toolkit/components/places/tests/chrome/test_342484.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 Bad Livemarks"
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 items that aren't allowed
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/bad_links.atom";
michael@0 31 const GOOD_URLS = ["http://example.org/first", "http://example.org/last"];
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 , siteURI: NetUtil.newURI("http:/mochi.test/")
michael@0 39 })
michael@0 40 .then(function (aLivemark) {
michael@0 41 waitForLivemarkLoad(aLivemark, function (aLivemark) {
michael@0 42 let nodes = aLivemark.getNodesForContainer({});
michael@0 43
michael@0 44 is(nodes.length, 2, "Created the two good livemark items");
michael@0 45 for (let i = 0; i < nodes.length; ++i) {
michael@0 46 let node = nodes[i];
michael@0 47 ok(GOOD_URLS.indexOf(node.uri) != -1, "livemark item created with bad uri " + node.uri);
michael@0 48 }
michael@0 49
michael@0 50 PlacesUtils.bookmarks.removeItem(aLivemark.id);
michael@0 51 SimpleTest.finish();
michael@0 52 });
michael@0 53 }, function () {
michael@0 54 is(true, false, "Should not fail adding a livemark");
michael@0 55 }
michael@0 56 );
michael@0 57 }
michael@0 58
michael@0 59 function waitForLivemarkLoad(aLivemark, aCallback) {
michael@0 60 // Don't need a real node here.
michael@0 61 let node = {};
michael@0 62 let resultObserver = {
michael@0 63 nodeInserted: function() {},
michael@0 64 nodeRemoved: function() {},
michael@0 65 nodeAnnotationChanged: function() {},
michael@0 66 nodeTitleChanged: function() {},
michael@0 67 nodeHistoryDetailsChanged: function() {},
michael@0 68 nodeMoved: function() {},
michael@0 69 ontainerStateChanged: function () {},
michael@0 70 sortingChanged: function() {},
michael@0 71 batching: function() {},
michael@0 72 invalidateContainer: function(node) {
michael@0 73 isnot(aLivemark.status, Ci.mozILivemark.STATUS_FAILED,
michael@0 74 "Loading livemark should success");
michael@0 75 if (aLivemark.status == Ci.mozILivemark.STATUS_READY) {
michael@0 76 aLivemark.unregisterForUpdates(node, resultObserver);
michael@0 77 aCallback(aLivemark);
michael@0 78 }
michael@0 79 }
michael@0 80 };
michael@0 81 aLivemark.registerForUpdates(node, resultObserver);
michael@0 82 aLivemark.reload();
michael@0 83 }
michael@0 84
michael@0 85 ]]>
michael@0 86 </script>
michael@0 87
michael@0 88 </window>

mercurial