annotate chrome/pageloader.js @ 200:31249cbe4f19

Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
author Joel Maher <jmaher@mozilla.com>
date Sun, 30 Jan 2011 10:21:05 -0500
parents 59d4f04497dd
children bffb8b1b0948
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
2 /* ***** BEGIN LICENSE BLOCK *****
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
4 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
5 * The contents of this file are subject to the Mozilla Public License Version
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
6 * 1.1 (the "License"); you may not use this file except in compliance with
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
7 * the License. You may obtain a copy of the License at
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
8 * http://www.mozilla.org/MPL/
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
9 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
10 * Software distributed under the License is distributed on an "AS IS" basis,
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
12 * for the specific language governing rights and limitations under the
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
13 * License.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
14 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
15 * The Original Code is tp.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
16 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
17 * The Initial Developer of the Original Code is
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
18 * Mozilla Corporation.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
19 * Portions created by the Initial Developer are Copyright (C) 2007
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
20 * the Initial Developer. All Rights Reserved.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
21 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
22 * Contributor(s):
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
23 * Rob Helmer <rhelmer@mozilla.com>
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
24 * Vladimir Vukicevic <vladimir@mozilla.com>
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
25 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
26 * Alternatively, the contents of this file may be used under the terms of
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
29 * in which case the provisions of the GPL or the LGPL are applicable instead
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
30 * of those above. If you wish to allow use of your version of this file only
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
31 * under the terms of either the GPL or the LGPL, and not to allow others to
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
32 * use your version of this file under the terms of the MPL, indicate your
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
33 * decision by deleting the provisions above and replace them with the notice
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
34 * and other provisions required by the GPL or the LGPL. If you do not delete
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
35 * the provisions above, a recipient may use your version of this file under
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
36 * the terms of any one of the MPL, the GPL or the LGPL.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
37 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
38 * ***** END LICENSE BLOCK ***** */
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
39
198
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
40 try {
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
41 if (Cc === undefined) {
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
42 var Cc = Components.classes;
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
43 var Ci = Components.interfaces;
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
44 }
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
45 } catch (ex) {}
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
46
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
47 var NUM_CYCLES = 5;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
48
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
49 var pageFilterRegexp = null;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
50 var reportFormat = "js";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
51 var useBrowser = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
52 var winWidth = 1024;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
53 var winHeight = 768;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
54
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
55 var doRenderTest = false;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
56
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
57 var pages;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
58 var pageIndex;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
59 var start_time;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
60 var cycle;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
61 var report;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
62 var renderReport;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
63 var noisy = false;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
64 var timeout = -1;
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
65 var delay = 250;
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
66 var timeoutEvent = -1;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
67 var running = false;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
68 var forceCC = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
69
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
70 var content;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
71
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
72 var TEST_DOES_OWN_TIMING = 1;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
73
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
74 var browserWindow = null;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
75
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
76 // the io service
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
77 var gIOS = null;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
78
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
79 function plInit() {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
80 if (running) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
81 return;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
82 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
83 running = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
84
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
85 cycle = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
86
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
87 try {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
88 var args = window.arguments[0].wrappedJSObject;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
89
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
90 var manifestURI = args.manifest;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
91 var startIndex = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
92 var endIndex = -1;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
93 if (args.startIndex) startIndex = parseInt(args.startIndex);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
94 if (args.endIndex) endIndex = parseInt(args.endIndex);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
95 if (args.numCycles) NUM_CYCLES = parseInt(args.numCycles);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
96 if (args.format) reportFormat = args.format;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
97 if (args.width) winWidth = parseInt(args.width);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
98 if (args.height) winHeight = parseInt(args.height);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
99 if (args.filter) pageFilterRegexp = new RegExp(args.filter);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
100 if (args.noisy) noisy = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
101 if (args.timeout) timeout = parseInt(args.timeout);
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
102 if (args.delay) delay = parseInt(args.delay);
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
103 forceCC = !args.noForceCC;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
104 doRenderTest = args.doRender;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
105
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
106 if (forceCC &&
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
107 !window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
108 .getInterface(Components.interfaces.nsIDOMWindowUtils)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
109 .garbageCollect) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
110 forceCC = false;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
111 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
112
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
113 gIOS = Cc["@mozilla.org/network/io-service;1"]
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
114 .getService(Ci.nsIIOService);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
115 if (args.offline)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
116 gIOS.offline = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
117 var fileURI = gIOS.newURI(manifestURI, null, null);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
118 pages = plLoadURLsFromURI(fileURI);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
119
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
120 if (!pages) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
121 dumpLine('tp: could not load URLs, quitting');
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
122 plStop(true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
123 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
124
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
125 if (pages.length == 0) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
126 dumpLine('tp: no pages to test, quitting');
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
127 plStop(true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
128 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
129
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
130 if (startIndex < 0)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
131 startIndex = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
132 if (endIndex == -1 || endIndex >= pages.length)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
133 endIndex = pages.length-1;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
134 if (startIndex > endIndex) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
135 dumpLine("tp: error: startIndex >= endIndex");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
136 plStop(true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
137 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
138
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
139 pages = pages.slice(startIndex,endIndex+1);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
140 var pageUrls = pages.map(function(p) { return p.url.spec.toString(); });
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
141 report = new Report(pageUrls);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
142
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
143 if (doRenderTest)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
144 renderReport = new Report(pageUrls);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
145
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
146 pageIndex = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
147
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
148 if (args.useBrowserChrome) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
149 var wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"]
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
150 .getService(Ci.nsIWindowWatcher);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
151 var blank = Cc["@mozilla.org/supports-string;1"]
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
152 .createInstance(Ci.nsISupportsString);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
153 blank.data = "about:blank";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
154 browserWindow = wwatch.openWindow
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
155 (null, "chrome://browser/content/", "_blank",
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
156 "chrome,dialog=no,width=" + winWidth + ",height=" + winHeight, blank);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
157
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
158 // get our window out of the way
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
159 window.resizeTo(10,10);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
160
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
161 var browserLoadFunc = function (ev) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
162 browserWindow.removeEventListener('load', browserLoadFunc, true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
163
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
164 // do this half a second after load, because we need to be
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
165 // able to resize the window and not have it get clobbered
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
166 // by the persisted values
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
167 setTimeout(function () {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
168 browserWindow.resizeTo(winWidth, winHeight);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
169 browserWindow.moveTo(0, 0);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
170 browserWindow.focus();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
171
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
172 content = browserWindow.getBrowser();
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
173
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
174 // Load the frame script for e10s / IPC message support
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
175 if (content.getAttribute("remote") == "true") {
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
176 let contentScript = "data:,addEventListener('load', function(e) { " +
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
177 " if (e.originalTarget.defaultView == content) { " +
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
178 " sendAsyncMessage('PageLoader:Load', {}); " +
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
179 " content.wrappedJSObject.tpRecordTime = function(t) { sendAsyncMessage('PageLoader:RecordTime', { time: t }); } " +
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
180 " }" +
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
181 "}, true);"
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
182 content.messageManager.loadFrameScript(contentScript, false);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
183 }
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
184
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
185 setTimeout(plLoadPage, 100);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
186 }, 500);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
187 };
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
188
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
189 browserWindow.addEventListener('load', browserLoadFunc, true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
190 } else {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
191 window.resizeTo(winWidth, winHeight);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
192
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
193 content = document.getElementById('contentPageloader');
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
194
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
195 setTimeout(plLoadPage, delay);
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
196 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
197 } catch(e) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
198 dumpLine(e);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
199 plStop(true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
200 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
201 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
202
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
203 function plPageFlags() {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
204 return pages[pageIndex].flags;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
205 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
206
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
207 // load the current page, start timing
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
208 var removeLastAddedListener = null;
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
209 var removeLastAddedMsgListener = null;
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
210 function plLoadPage() {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
211 var pageName = pages[pageIndex].url.spec;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
212
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
213 if (removeLastAddedListener)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
214 removeLastAddedListener();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
215
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
216 if (removeLastAddedMsgListener)
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
217 removeLastAddedMsgListener();
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
218
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
219 if (plPageFlags() & TEST_DOES_OWN_TIMING) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
220 // if the page does its own timing, use a capturing handler
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
221 // to make sure that we can set up the function for content to call
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
222 content.addEventListener('load', plLoadHandlerCapturing, true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
223 removeLastAddedListener = function() {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
224 content.removeEventListener('load', plLoadHandlerCapturing, true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
225 };
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
226 } else {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
227 // if the page doesn't do its own timing, use a bubbling handler
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
228 // to make sure that we're called after the page's own onload() handling
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
229
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
230 // XXX we use a capturing event here too -- load events don't bubble up
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
231 // to the <browser> element. See bug 390263.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
232 content.addEventListener('load', plLoadHandler, true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
233 removeLastAddedListener = function() {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
234 content.removeEventListener('load', plLoadHandler, true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
235 };
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
236 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
237
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
238 // If the test browser is remote (e10s / IPC) we need to use messages to watch for page load
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
239 if (content.getAttribute("remote") == "true") {
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
240 content.messageManager.addMessageListener('PageLoader:Load', plLoadHandlerMessage);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
241 content.messageManager.addMessageListener('PageLoader:RecordTime', plRecordTimeMessage);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
242 removeLastAddedMsgListener = function() {
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
243 content.messageManager.removeMessageListener('PageLoader:Load', plLoadHandlerMessage);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
244 content.messageManager.removeMessageListener('PageLoader:RecordTime', plRecordTimeMessage);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
245 };
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
246 }
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
247
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
248 if (timeout > 0) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
249 timeoutEvent = setTimeout('loadFail()', timeout);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
250 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
251 start_time = Date.now();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
252 content.loadURI(pageName);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
253 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
254
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
255 function loadFail() {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
256 var pageName = pages[pageIndex].url.spec;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
257 dumpLine("__FAILTimeout exceeded on " + pageName + "__FAIL")
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
258 plStop(true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
259 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
260
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
261 function plNextPage() {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
262 if (pageIndex < pages.length-1) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
263 pageIndex++;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
264
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
265 if (forceCC) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
266 var tccstart = new Date();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
267 window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
268 .getInterface(Components.interfaces.nsIDOMWindowUtils)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
269 .garbageCollect();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
270 var tccend = new Date();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
271 report.recordCCTime(tccend - tccstart);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
272 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
273
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
274 setTimeout(plLoadPage, delay);
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
275 } else {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
276 plStop(false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
277 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
278 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
279
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
280 function plRecordTime(time) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
281 var pageName = pages[pageIndex].url.spec;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
282 var i = pageIndex
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
283 if (i < pages.length-1) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
284 i++;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
285 } else {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
286 i = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
287 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
288 var nextName = pages[i].url.spec;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
289 report.recordTime(pageIndex, time);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
290 if (noisy) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
291 dumpLine("Cycle " + (cycle+1) + ": loaded " + pageName + " (next: " + nextName + ")");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
292 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
293 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
294
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
295 function plLoadHandlerCapturing(evt) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
296 // make sure we pick up the right load event
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
297 if (evt.type != 'load' ||
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
298 evt.originalTarget.defaultView.frameElement)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
299 return;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
300 if (timeout > 0) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
301 clearTimeout(timeoutEvent);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
302 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
303
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
304 if (!(plPageFlags() & TEST_DOES_OWN_TIMING)) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
305 dumpLine("tp: Capturing onload handler used with page that doesn't do its own timing?");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
306 plStop(true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
307 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
308
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
309 // set up the function for content to call
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
310 content.contentWindow.wrappedJSObject.tpRecordTime = function (time) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
311 plRecordTime(time);
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
312 setTimeout(plNextPage, delay);
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
313 };
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
314 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
315
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
316 // the onload handler
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
317 function plLoadHandler(evt) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
318 // make sure we pick up the right load event
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
319 if (evt.type != 'load' ||
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
320 evt.originalTarget.defaultView.frameElement)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
321 return;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
322 if (timeout > 0) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
323 clearTimeout(timeoutEvent);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
324 }
197
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
325 var docElem;
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
326 if (browserWindow)
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
327 docElem = browserWindow.frames["content"].document.documentElement;
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
328 else
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
329 docElem = content.contentDocument.documentElement;
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
330 var width;
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
331 if ("getBoundingClientRect" in docElem) {
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
332 width = docElem.getBoundingClientRect().width;
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
333 } else if ("offsetWidth" in docElem) {
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
334 width = docElem.offsetWidth;
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
335 }
b4da709724e1 Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents: 196
diff changeset
336
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
337 var end_time = Date.now();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
338 var time = (end_time - start_time);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
339
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
340 // does this page want to do its own timing?
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
341 // if so, we shouldn't be here
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
342 if (plPageFlags() & TEST_DOES_OWN_TIMING) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
343 dumpLine("tp: Bubbling onload handler used with page that does its own timing?");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
344 plStop(true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
345 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
346
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
347 plRecordTime(time);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
348
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
349 if (doRenderTest)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
350 runRenderTest();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
351
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
352 plNextPage();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
353 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
354
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
355 // the onload handler used for remote (e10s) browser
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
356 function plLoadHandlerMessage(message) {
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
357 if (timeout > 0) {
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
358 clearTimeout(timeoutEvent);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
359 }
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
360
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
361 // does this page want to do its own timing?
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
362 // if so, let's bail
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
363 if (plPageFlags() & TEST_DOES_OWN_TIMING)
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
364 return;
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
365
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
366 var end_time = Date.now();
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
367 var time = (end_time - start_time);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
368
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
369 plRecordTime(time);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
370
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
371 if (doRenderTest)
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
372 runRenderTest();
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
373
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
374 plNextPage();
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
375 }
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
376
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
377 // the record time handler used for remote (e10s) browser
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
378 function plRecordTimeMessage(message) {
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
379 plRecordTime(message.json.time);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
380 setTimeout(plNextPage, delay);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
381 }
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
382
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
383 function runRenderTest() {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
384 const redrawsPerSample = 500;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
385
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
386 if (!Ci.nsIDOMWindowUtils)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
387 return;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
388
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
389 var win;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
390
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
391 if (browserWindow)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
392 win = content.contentWindow;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
393 else
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
394 win = window;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
395 var wu = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
396
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
397 var start = Date.now();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
398 for (var j = 0; j < redrawsPerSample; j++)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
399 wu.redraw();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
400 var end = Date.now();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
401
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
402 renderReport.recordTime(pageIndex, end - start);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
403 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
404
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
405 function plStop(force) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
406 try {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
407 if (force == false) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
408 pageIndex = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
409 if (cycle < NUM_CYCLES-1) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
410 cycle++;
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
411 setTimeout(plLoadPage, delay);
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
412 return;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
413 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
414
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
415 var formats = reportFormat.split(",");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
416
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
417 if (!renderReport) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
418 for each (var fmt in formats)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
419 dumpLine(report.getReport(fmt));
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
420 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
421 else {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
422 dumpLine ("*************** Render report *******************");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
423 for each (var fmt in formats)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
424 dumpLine(renderReport.getReport(fmt));
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
425 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
426 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
427 } catch (e) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
428 dumpLine(e);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
429 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
430
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
431 if (content) {
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
432 content.removeEventListener('load', plLoadHandler, true);
200
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
433 if (content.getAttribute("remote") == "true")
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
434 content.messageManager.removeMessageListener('PageLoader:Load', plLoadHandlerMessage);
31249cbe4f19 Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents: 198
diff changeset
435 }
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
436
198
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
437 if (MozillaFileLogger)
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
438 MozillaFileLogger.close();
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
439
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
440 goQuitApplication();
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
441 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
442
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
443 /* Returns array */
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
444 function plLoadURLsFromURI(manifestUri) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
445 var fstream = Cc["@mozilla.org/network/file-input-stream;1"]
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
446 .createInstance(Ci.nsIFileInputStream);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
447 var uriFile = manifestUri.QueryInterface(Ci.nsIFileURL);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
448
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
449 fstream.init(uriFile.file, -1, 0, 0);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
450 var lstream = fstream.QueryInterface(Ci.nsILineInputStream);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
451
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
452 var d = [];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
453
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
454 var lineNo = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
455 var line = {value:null};
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
456 var more;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
457 do {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
458 lineNo++;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
459 more = lstream.readLine(line);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
460 var s = line.value;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
461
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
462 // strip comments
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
463 s = s.replace(/#.*/, '');
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
464
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
465 // strip leading and trailing whitespace
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
466 s = s.replace(/^\s*/, '').replace(/s\*$/, '');
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
467
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
468 if (!s)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
469 continue;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
470
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
471 var flags = 0;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
472 var urlspec = s;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
473
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
474 // split on whitespace, and figure out if we have any flags
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
475 var items = s.split(/\s+/);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
476 if (items[0] == "include") {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
477 if (items.length != 2) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
478 dumpLine("tp: Error on line " + lineNo + " in " + manifestUri.spec + ": include must be followed by the manifest to include!");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
479 return null;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
480 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
481
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
482 var subManifest = gIOS.newURI(items[1], null, manifestUri);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
483 if (subManifest == null) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
484 dumpLine("tp: invalid URI on line " + manifestUri.spec + ":" + lineNo + " : '" + line.value + "'");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
485 return null;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
486 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
487
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
488 var subItems = plLoadURLsFromURI(subManifest);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
489 if (subItems == null)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
490 return null;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
491 d = d.concat(subItems);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
492 } else {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
493 if (items.length == 2) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
494 if (items[0].indexOf("%") != -1)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
495 flags |= TEST_DOES_OWN_TIMING;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
496
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
497 urlspec = items[1];
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
498 } else if (items.length != 1) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
499 dumpLine("tp: Error on line " + lineNo + " in " + manifestUri.spec + ": whitespace must be %-escaped!");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
500 return null;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
501 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
502
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
503 var url = gIOS.newURI(urlspec, null, manifestUri);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
504
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
505 if (pageFilterRegexp && !pageFilterRegexp.test(url.spec))
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
506 continue;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
507
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
508 d.push({ url: url,
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
509 flags: flags });
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
510 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
511 } while (more);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
512
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
513 return d;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
514 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
515
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
516 function dumpLine(str) {
198
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
517 if (MozillaFileLogger)
59d4f04497dd package into extension for profile, add direct file logging instead of stdout r=vlad
Joel Maher <jmaher@mozilla.com>
parents: 197
diff changeset
518 MozillaFileLogger.log(str + "\n");
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
519 dump(str);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
520 dump("\n");
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
521 }