Comment 196 for bug 233901

Revision history for this message
In , Anthony-lanni (anthony-lanni) wrote :

    I may have been unclear: I use the same vendor.js and dw-config.cfg file for all three packages (Firefox, T-bird, and Mozilla). Each of those has their own config file, called firefox.js, etc. The index file and its module are written in perl. Here they are:

http://proxyconfig/autoconfig/index.cgi:
#!/usr/bin/perl -w
use strict;
use configFilename;
#Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007
#Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
my $config_path = 'resources/js';
my $default_config = 'common-config.js';
my $config_file;
$config_file = $config_path . '/' . get_config_filename();
if( ! -e $config_file ) {
    $config_file = $config_path . '/' . $default_config;
}
print ("Content-type: application/x-javascript-config\n\n");
open(TMPFILE, $config_file);
while(<TMPFILE>) {
    print;
}
close(TMPFILE);

and

http://proxyconfig/autoconfig/configFilename.pm:
#!/usr/bin/perl -w
sub get_config_filename
{
    my $browser = 'mozilla';
    my $user_agent = $ENV{'HTTP_USER_AGENT'};
    my $version;
    $browser =
    ($user_agent =~ /Firefox/) ? 'firefox' :
    ($user_agent =~ /Thunderbird/) ? 'thunderbird' :
    ($user_agent =~ /Seamonkey/) ? 'mozilla' :
                                  'mozilla'; #default
    return $browser . '-config' . '.js';
}