Mercurial > hg > config
annotate chrome/pageloader.js @ 208:3f290bcae11a
wtf
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 13 Feb 2012 16:24:06 -0800 |
parents | beca399c3a16 |
children |
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; |
206
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
69 var reportRSS = false; |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
70 |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
71 var useMozAfterPaint = false; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
72 var gPaintWindow = window; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
73 var gPaintListener = false; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
74 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
75 //when TEST_DOES_OWN_TIMING, we need to store the time from the page as MozAfterPaint can be slower than pageload |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
76 var gTime = -1; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
77 var gStartTime = -1; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
78 |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
79 var content; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
80 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
81 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
|
82 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
83 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
|
84 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
85 // 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
|
86 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
|
87 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
88 function plInit() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
89 if (running) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
90 return; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
91 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
92 running = true; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
93 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
94 cycle = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
95 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
96 try { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
97 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
|
98 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 if (args.delay) delay = parseInt(args.delay); |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
112 if (args.mozafterpaint) useMozAfterPaint = true; |
206
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
113 if (args.rss) reportRSS = true; |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
114 |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
115 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
|
116 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
|
117 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
118 if (forceCC && |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
119 !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
|
120 .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
|
121 .garbageCollect) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
122 forceCC = false; |
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 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
|
126 .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
|
127 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
|
128 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
|
129 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
|
130 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
|
131 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
132 if (!pages) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
133 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
|
134 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
135 } |
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 (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
|
138 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
|
139 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
140 } |
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 (startIndex < 0) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
143 startIndex = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
144 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
|
145 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
|
146 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
|
147 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
|
148 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
149 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
150 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
151 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
|
152 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
|
153 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
|
154 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
155 if (doRenderTest) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
156 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
|
157 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
158 pageIndex = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
159 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
160 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
|
161 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
|
162 .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
|
163 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
|
164 .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
|
165 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
|
166 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
|
167 (null, "chrome://browser/content/", "_blank", |
201
bffb8b1b0948
bug 651659 (pageloader no longer creating browser windows with chrome) one small change and chrome returns! (take 1) p=anodelman r=jmaher
Alice Nodelman <alice@mozilla.com>
parents:
200
diff
changeset
|
168 "chrome,all,dialog=no,width=" + winWidth + ",height=" + winHeight, blank); |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
169 |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
170 gPaintWindow = browserWindow; |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
171 // 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
|
172 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
|
173 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
174 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
|
175 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
|
176 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
177 // 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
|
178 // 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
|
179 // 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
|
180 setTimeout(function () { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
181 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
|
182 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
|
183 browserWindow.focus(); |
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 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
|
186 |
31249cbe4f19
Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents:
198
diff
changeset
|
187 // 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
|
188 if (content.getAttribute("remote") == "true") { |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
189 let contentScript = "data:,function _contentLoadHandler(e) { " + |
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
|
190 " if (e.originalTarget.defaultView == content) { " + |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
191 " content.wrappedJSObject.tpRecordTime = function(t, s) { sendAsyncMessage('PageLoader:RecordTime', { time: t, startTime: s }); }; "; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
192 if (useMozAfterPaint) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
193 contentScript += "" + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
194 "function _contentPaintHandler() { " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
195 " var utils = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils); " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
196 " if (utils.isMozAfterPaintPending) { " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
197 " addEventListener('MozAfterPaint', function(e) { " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
198 " removeEventListener('MozAfterPaint', arguments.callee, true); " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
199 " sendAsyncMessage('PageLoader:MozAfterPaint', {}); " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
200 " }, true); " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
201 " } else { " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
202 " sendAsyncMessage('PageLoader:MozAfterPaint', {}); " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
203 " } " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
204 "}; " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
205 "content.wrappedJSObject.setTimeout(_contentPaintHandler, 0); "; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
206 } else { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
207 contentScript += " sendAsyncMessage('PageLoader:Load', {}); "; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
208 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
209 contentScript += "" + |
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
|
210 " }" + |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
211 "} " + |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
212 "addEventListener('load', _contentLoadHandler, 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
|
213 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
|
214 } |
206
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
215 if (reportRSS) { |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
216 initializeMemoryCollector(plLoadPage, 100); |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
217 } else { |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
218 setTimeout(plLoadPage, 100); |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
219 } |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
220 }, 500); |
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 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
|
224 } else { |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
225 gPaintWindow = window; |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
226 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
|
227 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
228 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
|
229 |
206
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
230 if (reportRSS) { |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
231 initializeMemoryCollector(plLoadPage, delay); |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
232 } else { |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
233 setTimeout(plLoadPage, delay); |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
234 } |
196
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 } catch(e) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
237 dumpLine(e); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
238 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
239 } |
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 function plPageFlags() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
243 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
|
244 } |
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 // 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
|
247 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
|
248 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
|
249 function plLoadPage() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
250 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
|
251 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
252 if (removeLastAddedListener) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
253 removeLastAddedListener(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
254 |
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
|
255 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
|
256 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
|
257 |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
258 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
|
259 // 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
|
260 // to make sure that we can set up the function for content to call |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
261 |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
262 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
|
263 removeLastAddedListener = function() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
264 content.removeEventListener('load', plLoadHandlerCapturing, true); |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
265 if (useMozAfterPaint) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
266 content.removeEventListener("MozAfterPaint", plPaintedCapturing, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
267 gPaintHandler = false; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
268 } |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
269 }; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
270 } else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
271 // 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
|
272 // 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
|
273 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
274 // 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
|
275 // 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
|
276 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
|
277 removeLastAddedListener = function() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
278 content.removeEventListener('load', plLoadHandler, true); |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
279 if (useMozAfterPaint) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
280 gPaintWindow.removeEventListener("MozAfterPaint", plPainted, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
281 gPaintHandler = false; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
282 } |
196
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 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
285 |
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
|
286 // 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
|
287 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
|
288 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
|
289 content.messageManager.addMessageListener('PageLoader:RecordTime', plRecordTimeMessage); |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
290 if (useMozAfterPaint) |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
291 content.messageManager.addMessageListener('PageLoader:MozAfterPaint', plPaintHandler); |
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
|
292 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
|
293 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
|
294 content.messageManager.removeMessageListener('PageLoader:RecordTime', plRecordTimeMessage); |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
295 if (useMozAfterPaint) |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
296 content.messageManager.removeMessageListener('PageLoader:MozAfterPaint', plPaintHandler); |
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
|
297 }; |
31249cbe4f19
Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents:
198
diff
changeset
|
298 } |
31249cbe4f19
Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents:
198
diff
changeset
|
299 |
196
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 timeoutEvent = setTimeout('loadFail()', timeout); |
206
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
302 } |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
303 if (reportRSS) { |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
304 collectMemory(startAndLoadURI, pageName); |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
305 } else { |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
306 startAndLoadURI(pageName); |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
307 } |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
308 } |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
309 |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
310 function startAndLoadURI(pageName) { |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
311 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
|
312 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
|
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 function loadFail() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
316 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
|
317 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
|
318 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
319 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
320 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
321 function plNextPage() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
322 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
|
323 pageIndex++; |
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 if (forceCC) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
326 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
|
327 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
|
328 .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
|
329 .garbageCollect(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
330 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
|
331 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
|
332 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
333 |
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
|
334 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
|
335 } else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
336 plStop(false); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
337 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
338 } |
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 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
|
341 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
|
342 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
|
343 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
|
344 i++; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
345 } else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
346 i = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
347 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
348 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
|
349 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
|
350 if (noisy) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
351 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
|
352 } |
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 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
|
356 // 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
|
357 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
|
358 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
|
359 return; |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
360 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
361 //set the tpRecordTime function (called from test pages we load to store a global time. |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
362 content.contentWindow.wrappedJSObject.tpRecordTime = function (time, startTime) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
363 gTime = time; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
364 gStartTime = startTime; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
365 setTimeout(plWaitForPaintingCapturing, 0); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
366 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
367 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
368 content.removeEventListener('load', plLoadHandlerCapturing, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
369 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
370 setTimeout(plWaitForPaintingCapturing, 0); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
371 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
372 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
373 function plWaitForPaintingCapturing() { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
374 if (gPaintListener) |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
375 return; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
376 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
377 var utils = gPaintWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor) |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
378 .getInterface(Components.interfaces.nsIDOMWindowUtils); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
379 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
380 if (utils.isMozAfterPaintPending && useMozAfterPaint) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
381 if (gPaintListener == false) |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
382 gPaintWindow.addEventListener("MozAfterPaint", plPaintedCapturing, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
383 gPaintListener = true; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
384 return; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
385 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
386 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
387 _loadHandlerCapturing(); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
388 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
389 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
390 function plPaintedCapturing() { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
391 gPaintWindow.removeEventListener("MozAfterPaint", plPaintedCapturing, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
392 gPaintListener = false; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
393 _loadHandlerCapturing(); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
394 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
395 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
396 function _loadHandlerCapturing() { |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
397 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
|
398 clearTimeout(timeoutEvent); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
399 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
400 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
401 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
|
402 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
|
403 plStop(true); |
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 |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
406 if (useMozAfterPaint) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
407 if (gStartTime != null && gStartTime >= 0) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
408 gTime = (new Date()) - gStartTime; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
409 gStartTime = -1; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
410 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
411 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
412 |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
413 // set up the function for content to call |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
414 if (gTime >= 0) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
415 plRecordTime(gTime); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
416 gTime = -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
|
417 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
|
418 }; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
419 } |
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 // 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
|
422 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
|
423 // 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
|
424 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
|
425 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
|
426 return; |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
427 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
428 content.removeEventListener('load', plLoadHandler, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
429 setTimeout(waitForPainted, 0); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
430 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
431 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
432 // This is called after we have received a load event, now we wait for painted |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
433 function waitForPainted() { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
434 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
435 var utils = gPaintWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor) |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
436 .getInterface(Components.interfaces.nsIDOMWindowUtils); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
437 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
438 if (!utils.isMozAfterPaintPending || !useMozAfterPaint) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
439 _loadHandler(); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
440 return; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
441 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
442 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
443 if (gPaintListener == false) |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
444 gPaintWindow.addEventListener("MozAfterPaint", plPainted, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
445 gPaintListener = true; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
446 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
447 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
448 function plPainted() { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
449 gPaintWindow.removeEventListener("MozAfterPaint", plPainted, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
450 gPaintListener = false; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
451 _loadHandler(); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
452 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
453 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
454 function _loadHandler() { |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
455 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
|
456 clearTimeout(timeoutEvent); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
457 } |
197
b4da709724e1
Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents:
196
diff
changeset
|
458 var docElem; |
b4da709724e1
Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents:
196
diff
changeset
|
459 if (browserWindow) |
b4da709724e1
Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents:
196
diff
changeset
|
460 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
|
461 else |
b4da709724e1
Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents:
196
diff
changeset
|
462 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
|
463 var width; |
b4da709724e1
Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents:
196
diff
changeset
|
464 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
|
465 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
|
466 } 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
|
467 width = docElem.offsetWidth; |
b4da709724e1
Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents:
196
diff
changeset
|
468 } |
b4da709724e1
Bug 379233 - check offset before recording page load complete - r=vladimir
Alice Nodelman <alice@mozilla.com>
parents:
196
diff
changeset
|
469 |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
470 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
|
471 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
|
472 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
473 // 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
|
474 // 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
|
475 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
|
476 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
|
477 plStop(true); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
478 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
479 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
480 plRecordTime(time); |
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 if (doRenderTest) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
483 runRenderTest(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
484 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
485 plNextPage(); |
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 |
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
|
488 // 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
|
489 function plLoadHandlerMessage(message) { |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
490 _loadHandlerMessage(); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
491 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
492 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
493 // the mozafterpaint handler for remote (e10s) browser |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
494 function plPaintHandler(message) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
495 _loadHandlerMessage(); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
496 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
497 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
498 // the core handler for remote (e10s) browser |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
499 function _loadHandlerMessage() { |
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
|
500 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
|
501 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
|
502 } |
31249cbe4f19
Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents:
198
diff
changeset
|
503 |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
504 var time = -1; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
505 |
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
|
506 // does this page want to do its own timing? |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
507 if ((plPageFlags() & TEST_DOES_OWN_TIMING)) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
508 if (typeof(gStartTime) != "number") |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
509 gStartTime = Date.parse(gStartTime); |
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
|
510 |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
511 if (gTime >= 0) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
512 if (useMozAfterPaint && gStartTime >= 0) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
513 gTime = Date.now() - gStartTime; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
514 gStartTime = -1; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
515 } else if (useMozAfterPaint) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
516 gTime = -1; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
517 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
518 time = gTime; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
519 gTime = -1; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
520 } |
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
|
521 |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
522 } else { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
523 var end_time = Date.now(); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
524 time = (end_time - start_time); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
525 } |
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
|
526 |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
527 if (time >= 0) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
528 plRecordTime(time); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
529 if (doRenderTest) |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
530 runRenderTest(); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
531 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
532 plNextPage(); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
533 } |
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
|
534 } |
31249cbe4f19
Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents:
198
diff
changeset
|
535 |
31249cbe4f19
Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents:
198
diff
changeset
|
536 // 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
|
537 function plRecordTimeMessage(message) { |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
538 gTime = message.json.time; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
539 if (useMozAfterPaint) { |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
540 gStartTime = message.json.startTime; |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
541 } |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
542 _loadHandlerMessage(); |
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
|
543 } |
31249cbe4f19
Bug 629691 - pageloader.xpi does not support e10s for Tp chrome testing. r=jmaher
Joel Maher <jmaher@mozilla.com>
parents:
198
diff
changeset
|
544 |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
545 function runRenderTest() { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
546 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
|
547 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
548 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
|
549 return; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
550 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
551 var win; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
552 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
553 if (browserWindow) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
554 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
|
555 else |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
556 win = window; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
557 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
|
558 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
559 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
|
560 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
|
561 wu.redraw(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
562 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
|
563 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
564 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
|
565 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
566 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
567 function plStop(force) { |
206
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
568 if (reportRSS) { |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
569 collectMemory(plStopAll, force); |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
570 } else { |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
571 plStopAll(force); |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
572 } |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
573 } |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
574 |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
575 function plStopAll(force) { |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
576 try { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
577 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
|
578 pageIndex = 0; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
579 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
|
580 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
|
581 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
|
582 return; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
583 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
584 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
585 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
|
586 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
587 if (!renderReport) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
588 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
|
589 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
|
590 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
591 else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
592 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
|
593 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
|
594 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
|
595 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
596 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
597 } catch (e) { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
598 dumpLine(e); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
599 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
600 |
206
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
601 if (reportRSS) { |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
602 stopMemCollector(); |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
603 } |
beca399c3a16
Bug 685632 - Please collect RSS (memory) data during Talos testing on Android. r=jlebar,njn
Joel Maher <jmaher@mozilla.com>
parents:
205
diff
changeset
|
604 |
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
|
605 if (content) { |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
606 content.removeEventListener('load', plLoadHandlerCapturing, true); |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
607 content.removeEventListener('load', plLoadHandler, true); |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
608 if (useMozAfterPaint) |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
609 content.removeEventListener("MozAfterPaint", plPaintedCapturing, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
610 content.removeEventListener("MozAfterPaint", plPainted, true); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
611 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
612 if (content.getAttribute("remote") == "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
|
613 content.messageManager.removeMessageListener('PageLoader:Load', plLoadHandlerMessage); |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
614 content.messageManager.removeMessageListener('PageLoader:RecordTime', plRecordTimeMessage); |
204
4dec1e56c677
Bug 689518 - error in pageloader causes talos + e10s to timeout in certain cases. r=bear
Joel Maher <jmaher@mozilla.com>
parents:
202
diff
changeset
|
615 if (useMozAfterPaint) |
202
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
616 content.messageManager.removeMessageListener('PageLoader:MozAfterPaint', plPaintHandler); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
617 |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
618 content.messageManager.loadFrameScript("data:,removeEventListener('load', _contentLoadHandler, true);", false); |
0b38ce037298
Bug 661918 - Tp should wait for MozAfterPaint after onload. r=tnikkel,vlad
Joel Maher <jmaher@mozilla.com>
parents:
201
diff
changeset
|
619 } |
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
|
620 } |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
621 |
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
|
622 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
|
623 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
|
624 |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
625 goQuitApplication(); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
626 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
627 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
628 /* Returns array */ |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
629 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
|
630 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
|
631 .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
|
632 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
|
633 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
634 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
|
635 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
|
636 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
637 var d = []; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
638 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
639 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
|
640 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
|
641 var more; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
642 do { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
643 lineNo++; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
644 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
|
645 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
|
646 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
647 // strip comments |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
648 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
|
649 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
650 // strip leading and trailing whitespace |
205
eaef28f55f92
Bug 692997 Ensure trailing spaces in pageloader manifest are properly trimmed r=jmaher
Clint Talbert <ctalbert@mozilla.com>
parents:
204
diff
changeset
|
651 s = s.replace(/^\s*/, '').replace(/\s*$/, ''); |
196
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
652 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
653 if (!s) |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
654 continue; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
655 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
656 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
|
657 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
|
658 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
659 // 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
|
660 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
|
661 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
|
662 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
|
663 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
|
664 return null; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
665 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
666 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
667 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
|
668 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
|
669 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
|
670 return null; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
671 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
672 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
673 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
|
674 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
|
675 return null; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
676 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
|
677 } else { |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
678 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
|
679 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
|
680 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
|
681 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
682 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
|
683 } 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
|
684 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
|
685 return null; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
686 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
687 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
688 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
|
689 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
690 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
|
691 continue; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
692 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
693 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
|
694 flags: flags }); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
695 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
696 } while (more); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
697 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
698 return d; |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
699 } |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
700 |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
701 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
|
702 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
|
703 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
|
704 dump(str); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
705 dump("\n"); |
dd0018bc27de
Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff
changeset
|
706 } |