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.
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /*
8 * TEST DESCRIPTION:
9 *
10 * This test checks that in a basic history query all transition types visits
11 * appear but TRANSITION_EMBED and TRANSITION_FRAMED_LINK ones.
12 */
14 let transitions = [
15 TRANSITION_LINK
16 , TRANSITION_TYPED
17 , TRANSITION_BOOKMARK
18 , TRANSITION_EMBED
19 , TRANSITION_FRAMED_LINK
20 , TRANSITION_REDIRECT_PERMANENT
21 , TRANSITION_REDIRECT_TEMPORARY
22 , TRANSITION_DOWNLOAD
23 ];
25 function runQuery(aResultType) {
26 let options = PlacesUtils.history.getNewQueryOptions();
27 options.resultType = aResultType;
28 let root = PlacesUtils.history.executeQuery(PlacesUtils.history.getNewQuery(),
29 options).root;
30 root.containerOpen = true;
31 let cc = root.childCount;
32 do_check_eq(cc, transitions.length - 2);
34 for (let i = 0; i < cc; i++) {
35 let node = root.getChild(i);
36 // Check that all transition types but EMBED and FRAMED appear in results
37 do_check_neq(node.uri.substr(6,1), TRANSITION_EMBED);
38 do_check_neq(node.uri.substr(6,1), TRANSITION_FRAMED_LINK);
39 }
40 root.containerOpen = false;
41 }
43 function run_test()
44 {
45 run_next_test();
46 }
48 add_task(function test_execute()
49 {
50 // add visits, one for each transition type
51 for (let [, transition] in Iterator(transitions)) {
52 yield promiseAddVisits({
53 uri: uri("http://" + transition + ".mozilla.org/"),
54 transition: transition
55 });
56 }
58 runQuery(Ci.nsINavHistoryQueryOptions.RESULTS_AS_VISIT);
59 runQuery(Ci.nsINavHistoryQueryOptions.RESULTS_AS_URI);
60 });