Mercurial > hg > config
annotate chrome/pageloader.js @ 196:dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
author | Benjamin Smedberg <benjamin@smedbergs.us> |
---|---|
date | Wed, 21 Jul 2010 15:57:39 -0400 |
parents | |
children | b4da709724e1 |
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 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
40 const Cc = Components.classes; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
41 const Ci = Components.interfaces; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
42 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
43 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
|
44 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
45 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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
51 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
|
52 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
53 var pages; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
54 var pageIndex; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
55 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
|
56 var cycle; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
57 var report; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
58 var renderReport; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
59 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
|
60 var timeout = -1; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
61 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
|
62 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
|
63 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
|
64 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
65 var content; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
66 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
67 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
|
68 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
69 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
|
70 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
71 // 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
|
72 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
|
73 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
74 function plInit() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
75 if (running) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
76 return; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
77 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
78 running = true; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
79 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
80 cycle = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
81 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
82 try { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
83 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
|
84 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
85 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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 if (args.timeout) timeout = parseInt(args.timeout); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
97 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
|
98 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
|
99 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
100 if (forceCC && |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
101 !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
|
102 .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
|
103 .garbageCollect) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
104 forceCC = false; |
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 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
107 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
|
108 .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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
114 if (!pages) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
115 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
|
116 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
117 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
118 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
119 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
|
120 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
|
121 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
122 } |
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 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
|
125 startIndex = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
126 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
|
127 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
|
128 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
|
129 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
|
130 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
131 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
132 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
137 if (doRenderTest) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
138 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
|
139 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
140 pageIndex = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
141 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
142 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
|
143 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
|
144 .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
|
145 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
|
146 .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
|
147 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
|
148 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
|
149 (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
|
150 "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
|
151 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
152 // 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
|
153 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
|
154 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
155 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
|
156 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
|
157 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
158 // 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
|
159 // 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
|
160 // 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
|
161 setTimeout(function () { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
162 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
|
163 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
|
164 browserWindow.focus(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
165 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
166 content = browserWindow.getBrowser(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
167 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
|
168 }, 500); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
169 }; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
170 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
171 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
|
172 } else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
173 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
|
174 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
175 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
|
176 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
177 setTimeout(plLoadPage, 250); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
178 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
179 } catch(e) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
180 dumpLine(e); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
181 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
182 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
183 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
184 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
185 function plPageFlags() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
186 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
|
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 // 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
|
190 var removeLastAddedListener = null; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
191 function plLoadPage() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
192 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
|
193 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
194 if (removeLastAddedListener) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
195 removeLastAddedListener(); |
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 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
|
198 // 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
|
199 // 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
|
200 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
|
201 removeLastAddedListener = function() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
202 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
|
203 }; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
204 } else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
205 // 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
|
206 // 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
|
207 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
208 // 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
|
209 // 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
|
210 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
|
211 removeLastAddedListener = function() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
212 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
|
213 }; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
214 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
215 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
216 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
|
217 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
|
218 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
219 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
|
220 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
|
221 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
222 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
223 function loadFail() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
224 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
|
225 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
|
226 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
227 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
228 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
229 function plNextPage() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
230 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
|
231 pageIndex++; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
232 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
233 if (forceCC) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
234 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
|
235 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
|
236 .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
|
237 .garbageCollect(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
238 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
|
239 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
|
240 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
241 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
242 setTimeout(plLoadPage, 250); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
243 } else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
244 plStop(false); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
245 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
246 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
247 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
248 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
|
249 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
|
250 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
|
251 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
|
252 i++; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
253 } else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
254 i = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
255 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
256 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
|
257 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
|
258 if (noisy) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
259 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
|
260 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
261 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
262 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
263 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
|
264 // 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
|
265 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
|
266 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
|
267 return; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
268 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
|
269 clearTimeout(timeoutEvent); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
270 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
271 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
272 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
|
273 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
|
274 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
275 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
276 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
277 // 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
|
278 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
|
279 plRecordTime(time); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
280 setTimeout(plNextPage, 250); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
281 }; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
282 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
283 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
284 // 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
|
285 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
|
286 // 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
|
287 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
|
288 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
|
289 return; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
290 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
|
291 clearTimeout(timeoutEvent); |
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 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
|
294 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
|
295 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
296 // 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
|
297 // 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
|
298 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
|
299 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
|
300 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
301 } |
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 plRecordTime(time); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
304 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
305 if (doRenderTest) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
306 runRenderTest(); |
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 plNextPage(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
309 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
310 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
311 function runRenderTest() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
312 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
|
313 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
314 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
|
315 return; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
316 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
317 var win; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
318 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
319 if (browserWindow) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
320 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
|
321 else |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
322 win = window; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
323 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
|
324 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
325 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
|
326 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
|
327 wu.redraw(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
328 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
|
329 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
330 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
|
331 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
332 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
333 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
|
334 try { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
335 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
|
336 pageIndex = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
337 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
|
338 cycle++; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
339 setTimeout(plLoadPage, 250); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
340 return; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
341 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
342 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
343 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
|
344 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
345 if (!renderReport) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
346 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
|
347 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
|
348 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
349 else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
350 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
|
351 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
|
352 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
|
353 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
354 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
355 } catch (e) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
356 dumpLine(e); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
357 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
358 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
359 if (content) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
360 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
|
361 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
362 goQuitApplication(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
363 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
364 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
365 /* Returns array */ |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
366 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
|
367 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
|
368 .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
|
369 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
|
370 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
371 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
|
372 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
|
373 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
374 var d = []; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
375 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
376 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
|
377 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
|
378 var more; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
379 do { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
380 lineNo++; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
381 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
|
382 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
|
383 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
384 // strip comments |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
385 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
|
386 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
387 // 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
|
388 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
|
389 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
390 if (!s) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
391 continue; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
392 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
393 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
|
394 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
|
395 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
396 // 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
|
397 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
|
398 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
|
399 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
|
400 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
|
401 return null; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
402 } |
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 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
|
405 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
|
406 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
|
407 return null; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
408 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
409 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
410 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
|
411 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
|
412 return null; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
413 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
|
414 } else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
415 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
|
416 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
|
417 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
|
418 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
419 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
|
420 } 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
|
421 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
|
422 return null; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
423 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
424 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
425 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
|
426 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
427 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
|
428 continue; |
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 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
|
431 flags: flags }); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
432 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
433 } while (more); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
434 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
435 return d; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
436 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
437 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
438 function dumpLine(str) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
439 dump(str); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
440 dump("\n"); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
441 } |