Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | |
michael@0 | 3 | <!-- This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | - License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> |
michael@0 | 6 | |
michael@0 | 7 | <!-- Bug 466422: |
michael@0 | 8 | - Check that we replace the left pane with a correct one if it gets corrupted |
michael@0 | 9 | - and we end up having more than one. --> |
michael@0 | 10 | |
michael@0 | 11 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 12 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 13 | type="text/css"?> |
michael@0 | 14 | |
michael@0 | 15 | <?xml-stylesheet href="chrome://browser/content/places/places.css"?> |
michael@0 | 16 | <?xml-stylesheet href="chrome://browser/skin/places/places.css"?> |
michael@0 | 17 | |
michael@0 | 18 | <?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?> |
michael@0 | 19 | |
michael@0 | 20 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 21 | title="Test handling of multiple left pane folders" |
michael@0 | 22 | onload="runTest();"> |
michael@0 | 23 | |
michael@0 | 24 | <script type="application/javascript" |
michael@0 | 25 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
michael@0 | 26 | |
michael@0 | 27 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 28 | <p id="display"></p> |
michael@0 | 29 | <div id="content" style="display: none"></div> |
michael@0 | 30 | <pre id="test"></pre> |
michael@0 | 31 | </body> |
michael@0 | 32 | |
michael@0 | 33 | <script type="application/javascript"> |
michael@0 | 34 | <![CDATA[ |
michael@0 | 35 | |
michael@0 | 36 | function runTest() { |
michael@0 | 37 | // Sanity checks. |
michael@0 | 38 | ok(PlacesUtils, "PlacesUtils is running in chrome context"); |
michael@0 | 39 | ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context"); |
michael@0 | 40 | ok(PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION > 0, |
michael@0 | 41 | "Left pane version in chrome context, " + |
michael@0 | 42 | "current version is: " + PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION ); |
michael@0 | 43 | |
michael@0 | 44 | var fakeLeftPanes = []; |
michael@0 | 45 | var as = PlacesUtils.annotations; |
michael@0 | 46 | var bs = PlacesUtils.bookmarks; |
michael@0 | 47 | |
michael@0 | 48 | // We need 2 left pane folders to simulate a corrupt profile. |
michael@0 | 49 | do { |
michael@0 | 50 | let leftPaneItems = as.getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO); |
michael@0 | 51 | // Create a fake left pane folder. |
michael@0 | 52 | let fakeLeftPaneRoot = bs.createFolder(PlacesUtils.placesRootId, "", |
michael@0 | 53 | bs.DEFAULT_INDEX); |
michael@0 | 54 | as.setItemAnnotation(fakeLeftPaneRoot, PlacesUIUtils.ORGANIZER_FOLDER_ANNO, |
michael@0 | 55 | PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION, 0, |
michael@0 | 56 | as.EXPIRE_NEVER); |
michael@0 | 57 | fakeLeftPanes.push(fakeLeftPaneRoot); |
michael@0 | 58 | } while (fakeLeftPanes.length < 2); |
michael@0 | 59 | |
michael@0 | 60 | // Initialize the left pane queries. |
michael@0 | 61 | PlacesUIUtils.leftPaneFolderId; |
michael@0 | 62 | |
michael@0 | 63 | // Check left pane. |
michael@0 | 64 | ok(PlacesUIUtils.leftPaneFolderId > 0, |
michael@0 | 65 | "Left pane folder correctly created"); |
michael@0 | 66 | var leftPaneItems = as.getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO); |
michael@0 | 67 | is(leftPaneItems.length, 1, |
michael@0 | 68 | "We correctly have only 1 left pane folder"); |
michael@0 | 69 | |
michael@0 | 70 | // Check that all old left pane items have been removed. |
michael@0 | 71 | fakeLeftPanes.forEach(function(aItemId) { |
michael@0 | 72 | try { |
michael@0 | 73 | bs.getItemTitle(aItemId); |
michael@0 | 74 | throw("This folder should have been removed"); |
michael@0 | 75 | } catch (ex) {} |
michael@0 | 76 | }); |
michael@0 | 77 | |
michael@0 | 78 | } |
michael@0 | 79 | ]]> |
michael@0 | 80 | </script> |
michael@0 | 81 | |
michael@0 | 82 | </window> |