3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 # This is a modified version of Chris Hofmann's <chofmann@netscape.com>
8 # infamous "browser buster" test harness. It's a bit simpler (CGI
9 # instead of using cookies; IFRAME instead of FRAMESET), and has some
10 # extra parameters that make it a bit easier to test with, but it's
11 # pretty faithful otherwise.
13 # It accepts a couple of parameters, including
15 # file=<filename> Set this to the name of the file containing
16 # the URLs that you want the buster to cycle through. This
17 # might be a security hole, so don't run this script on a
18 # server with s3kret stuff on it, mmkay?
20 # page=<number> This is used to maintain state, and is the line
21 # number in the file that the buster will pull up in the
22 # IFRAME. Set if by hand if you need to for some reason.
24 # last=<number> The buster will run until it's exhausted all
25 # the URLs in the file, or until it reaches this line in the
26 # file; e.g., setting it to "5" will load five URLs.
28 # refresh=<number> The timeout (in seconds) to wait before doing
29 # a page refresh, and thus loading the next URL. Defaults to
34 # Find the page'th URL in the file with the specified name
37 my ($file, $page) = @_;
40 || die("can't open $::File");
42 LINE
: while (<URLS
>) {
44 last LINE
unless --$page;
56 $::File
= $::Query
->param("file");
57 $::File
= "top100.txt" unless $::File
;
59 $::Page
= $::Query
->param("page");
60 $::Page
= 0 unless $::Page
;
61 $::URL
= FindURL
($::File
, ++$::Page
);
63 $::Last
= $::Query
->param("last");
64 $::Last
= -1 unless $::Last
;
66 $::Refresh
= $::Query
->param("refresh");
67 $::Refresh
= 30 unless $::Refresh
;
70 print qq{Content
-type
: text
/html
77 if ($::URL
&& ($::Page
<= $::Last
|| $::Last
== -1)) {
78 # Make a web page that'll load $::URL in an IFRAME, with
79 # a meta-refresh that'll reload us again in short order.
80 print qq{<meta http
-equiv
="Pragma" content
="no-cache">
81 <meta http
-equiv
="refresh" content
="$::Refresh;url=buster.cgi?file=$::File&page=$::Page&last=$::Last&refresh=$::Refresh">
82 <title
>BrowserBuster II
: $::URL
</title
>
83 <style type
="text/css">
92 dump("+++ loading $::URL\\n");
96 print "$::File: $::URL";
98 print " ($::Page of $::Last)<br>";
101 <iframe width
="100%" height
="100%" src
="$::URL">
105 # Make a web page that'll close the current browser
106 # window, terminating the test app.
108 <title
>BrowserBuster II
: Done
!</title
>
109 <body onload
="window.close();">