annotate components/tp-cmdline.js @ 196:dd0018bc27de

Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
author Benjamin Smedberg <benjamin@smedbergs.us>
date Wed, 21 Jul 2010 15:57:39 -0400
parents
children 31249cbe4f19
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
196
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
1 /* ***** 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
2 * 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
3 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
4 * 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
5 * 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
6 * 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
7 * 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
8 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
9 * 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
10 * 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
11 * 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
12 * License.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
13 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
14 * The Original Code is DOM Inspector.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
15 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
16 * 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
17 * Christopher A. Aillon <christopher@aillon.com>.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
18 * Portions created by the Initial Developer are Copyright (C) 2003
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
19 * 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
20 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
21 * Contributor(s):
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
22 * Christopher A. Aillon <christopher@aillon.com>
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
23 * L. David Baron, Mozilla Corporation <dbaron@dbaron.org> (modified for reftest)
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, Mozilla Corporation <dbaron@dbaron.org> (modified for tp)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
25 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
26 * Alternatively, the contents of this file may be used under the terms of
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
29 * in which case the provisions of the GPL or the LGPL are applicable instead
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
30 * of those above. If you wish to allow use of your version of this file only
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
31 * under the terms of either the GPL or the LGPL, and not to allow others to
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
32 * use your version of this file under the terms of the MPL, indicate your
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
33 * decision by deleting the provisions above and replace them with the notice
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
34 * and other provisions required by the GPL or the LGPL. If you do not delete
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
35 * the provisions above, a recipient may use your version of this file under
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
36 * the terms of any one of the MPL, the GPL or the LGPL.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
37 *
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
38 * ***** END LICENSE BLOCK ***** */
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
39
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
40 // This only implements nsICommandLineHandler, since it needs
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
41 // to handle multiple arguments.
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
42
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
43 const TP_CMDLINE_CONTRACTID = "@mozilla.org/commandlinehandler/general-startup;1?type=tp";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
44 const TP_CMDLINE_CLSID = Components.ID('{8AF052F5-8EFE-4359-8266-E16498A82E8B}');
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
45 const CATMAN_CONTRACTID = "@mozilla.org/categorymanager;1";
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
46 const nsISupports = Components.interfaces.nsISupports;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
47
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
48 const nsICategoryManager = Components.interfaces.nsICategoryManager;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
49 const nsICommandLine = Components.interfaces.nsICommandLine;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
50 const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
51 const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
52 const nsISupportsString = Components.interfaces.nsISupportsString;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
53 const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
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 function PageLoaderCmdLineHandler() {}
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
56 PageLoaderCmdLineHandler.prototype =
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
57 {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
58 /* nsISupports */
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
59 QueryInterface : function handler_QI(iid) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
60 if (iid.equals(nsISupports))
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
61 return this;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
62
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
63 if (nsICommandLineHandler && iid.equals(nsICommandLineHandler))
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
64 return this;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
65
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
66 throw Components.results.NS_ERROR_NO_INTERFACE;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
67 },
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
68
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
69 /* nsICommandLineHandler */
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
70 handle : function handler_handle(cmdLine) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
71 var args = {};
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
72 try {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
73 var uristr = cmdLine.handleFlagWithParam("tp", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
74 if (uristr == null)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
75 return;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
76 try {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
77 args.manifest = cmdLine.resolveURI(uristr).spec;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
78 } catch (e) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
79 return;
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
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
82 args.numCycles = cmdLine.handleFlagWithParam("tpcycles", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
83 args.startIndex = cmdLine.handleFlagWithParam("tpstart", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
84 args.endIndex = cmdLine.handleFlagWithParam("tpend", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
85 args.filter = cmdLine.handleFlagWithParam("tpfilter", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
86 args.format = cmdLine.handleFlagWithParam("tpformat", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
87 args.useBrowserChrome = cmdLine.handleFlag("tpchrome", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
88 args.doRender = cmdLine.handleFlag("tprender", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
89 args.width = cmdLine.handleFlagWithParam("tpwidth", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
90 args.height = cmdLine.handleFlagWithParam("tpheight", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
91 args.offline = cmdLine.handleFlag("tpoffline", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
92 args.noisy = cmdLine.handleFlag("tpnoisy", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
93 args.timeout = cmdLine.handleFlagWithParam("tptimeout", false);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
94 args.noForceCC = cmdLine.handleFlag("tpnoforcecc", false);
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 catch (e) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
97 return;
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
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
100 // get our data through xpconnect
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
101 args.wrappedJSObject = args;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
102
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
103 var wwatch = Components.classes["@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
104 .getService(nsIWindowWatcher);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
105 wwatch.openWindow(null, "chrome://pageloader/content/pageloader.xul", "_blank",
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
106 "chrome,dialog=no,all", args);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
107 cmdLine.preventDefault = true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
108 },
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
109
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
110 helpInfo :
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
111 " -tp <file> Run pageload perf tests on given manifest\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
112 " -tpfilter str Only include pages from manifest that contain str (regexp)\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
113 " -tpcycles n Loop through pages n times\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
114 " -tpstart n Start at index n in the manifest\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
115 " -tpend n End with index n in the manifest\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
116 " -tpformat f1,f2,.. Report format(s) to use\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
117 " -tpchrome Test with normal browser chrome\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
118 " -tprender Run render-only benchmark for each page\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
119 " -tpwidth width Width of window\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
120 " -tpheight height Height of window\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
121 " -tpoffline Force offline mode\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
122 " -tpnoisy Dump the name of the last loaded page to console\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
123 " -tptimeout Max amount of time given for a page to load, quit if exceeded\n" +
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
124 " -tpnoforcecc Don't force cycle collection between each pageload\n"
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
125
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
126 };
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
127
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
128
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
129 var PageLoaderCmdLineFactory =
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
130 {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
131 createInstance : function(outer, iid)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
132 {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
133 if (outer != null) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
134 throw Components.results.NS_ERROR_NO_AGGREGATION;
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 return new PageLoaderCmdLineHandler().QueryInterface(iid);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
138 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
139 };
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 function NSGetFactory(cid) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
142 if (!cid.equals(TP_CMDLINE_CLSID))
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
143 throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
144
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
145 return PageLoaderCmdLineFactory;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
146 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
147
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
148 var PageLoaderCmdLineModule =
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 registerSelf : function(compMgr, fileSpec, location, type)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
151 {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
152 compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
153
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
154 compMgr.registerFactoryLocation(TP_CMDLINE_CLSID,
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
155 "PageLoader CommandLine Service",
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
156 TP_CMDLINE_CONTRACTID,
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
157 fileSpec,
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
158 location,
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
159 type);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
160
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
161 var catman = Components.classes[CATMAN_CONTRACTID].getService(nsICategoryManager);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
162 catman.addCategoryEntry("command-line-handler",
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
163 "m-tp",
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
164 TP_CMDLINE_CONTRACTID, true, true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
165 },
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
166
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
167 unregisterSelf : function(compMgr, fileSpec, location)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
168 {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
169 compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
170
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
171 compMgr.unregisterFactoryLocation(TP_CMDLINE_CLSID, fileSpec);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
172 catman = Components.classes[CATMAN_CONTRACTID].getService(nsICategoryManager);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
173 catman.deleteCategoryEntry("command-line-handler",
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
174 "m-tp", true);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
175 },
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 getClassObject : function(compMgr, cid, iid)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
178 {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
179 return NSGetFactory(cid);
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
180 },
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
181
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
182 canUnload : function(compMgr)
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
183 {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
184 return true;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
185 }
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
186 };
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
187
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
188
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
189 function NSGetModule(compMgr, fileSpec) {
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
190 return PageLoaderCmdLineModule;
dd0018bc27de Copy the pageloader from CVS and into a bundle format (single chrome.manifest).
Benjamin Smedberg <benjamin@smedbergs.us>
parents:
diff changeset
191 }