3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is buster.cgi, released
19 # The Initial Developer of the Original Code is
20 # Netscape Communications Corporation.
21 # Portions created by the Initial Developer are Copyright (C) 2000
22 # the Initial Developer. All Rights Reserved.
25 # Chris Waterson <waterson@netscape.com>
27 # Alternatively, the contents of this file may be used under the terms of
28 # either the GNU General Public License Version 2 or later (the "GPL"), or
29 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 # in which case the provisions of the GPL or the LGPL are applicable instead
31 # of those above. If you wish to allow use of your version of this file only
32 # under the terms of either the GPL or the LGPL, and not to allow others to
33 # use your version of this file under the terms of the MPL, indicate your
34 # decision by deleting the provisions above and replace them with the notice
35 # and other provisions required by the GPL or the LGPL. If you do not delete
36 # the provisions above, a recipient may use your version of this file under
37 # the terms of any one of the MPL, the GPL or the LGPL.
39 # ***** END LICENSE BLOCK *****
41 # This is a modified version of Chris Hofmann's <chofmann@netscape.com>
42 # infamous "browser buster" test harness. It's a bit simpler (CGI
43 # instead of using cookies; IFRAME instead of FRAMESET), and has some
44 # extra parameters that make it a bit easier to test with, but it's
45 # pretty faithful otherwise.
47 # It accepts a couple of parameters, including
49 # file=<filename> Set this to the name of the file containing
50 # the URLs that you want the buster to cycle through. This
51 # might be a security hole, so don't run this script on a
52 # server with s3kret stuff on it, mmkay?
54 # page=<number> This is used to maintain state, and is the line
55 # number in the file that the buster will pull up in the
56 # IFRAME. Set if by hand if you need to for some reason.
58 # last=<number> The buster will run until it's exhausted all
59 # the URLs in the file, or until it reaches this line in the
60 # file; e.g., setting it to "5" will load five URLs.
62 # refresh=<number> The timeout (in seconds) to wait before doing
63 # a page refresh, and thus loading the next URL. Defaults to
68 # Find the page'th URL in the file with the specified name
71 my ($file, $page) = @_;
74 || die("can't open $::File");
76 LINE
: while (<URLS
>) {
78 last LINE
unless --$page;
90 $::File
= $::Query
->param("file");
91 $::File
= "top100.txt" unless $::File
;
93 $::Page
= $::Query
->param("page");
94 $::Page
= 0 unless $::Page
;
95 $::URL
= FindURL
($::File
, ++$::Page
);
97 $::Last
= $::Query
->param("last");
98 $::Last
= -1 unless $::Last
;
100 $::Refresh
= $::Query
->param("refresh");
101 $::Refresh
= 30 unless $::Refresh
;
104 print qq{Content
-type
: text
/html
111 if ($::URL
&& ($::Page
<= $::Last
|| $::Last
== -1)) {
112 # Make a web page that'll load $::URL in an IFRAME, with
113 # a meta-refresh that'll reload us again in short order.
114 print qq{<meta http
-equiv
="Pragma" content
="no-cache">
115 <meta http
-equiv
="refresh" content
="$::Refresh;url=buster.cgi?file=$::File&page=$::Page&last=$::Last&refresh=$::Refresh">
116 <title
>BrowserBuster II
: $::URL
</title
>
117 <style type
="text/css">
126 dump("+++ loading $::URL\\n");
130 print "$::File: $::URL";
132 print " ($::Page of $::Last)<br>";
135 <iframe width
="100%" height
="100%" src
="$::URL">
139 # Make a web page that'll close the current browser
140 # window, terminating the test app.
142 <title
>BrowserBuster II
: Done
!</title
>
143 <body onload
="window.close();">