Commits

Burak Gürsoy committed f091037

Fiz mozilla parser to include the missing token.

Comments (0)

Files changed (4)

    => Set the ua parser name only if it wasn't set inside the actual parser.
    => Fixes for Maxthon and Android stupidities.
    => Fix for emacs parser.
+   => Fix mozilla parser.
 
 0.34 Sun Apr  8 00:08:41 2012
    => "normalize" option.

lib/Parse/HTTP/UserAgent/Base/Parsers.pm

 }
 
 sub _parse_mozilla_family {
-    my($self, $moz, $thing, $extra, @extras) = @_;
+    my($self, $moz, $thing, $extra, @others) = @_;
     # firefox variation or just mozilla itself
     my($name, $version)      = split RE_SLASH, defined $extra->[1] ? $extra->[1]
                              :                                       $moz
                              ;
+    if ( $version ) {
+        $extra->[1] = '';
+    }
     $self->[UA_NAME]         = $name;
-    $self->[UA_TOOLKIT]      = $extra ? [ split RE_SLASH, $extra->[0] ] : [];
     $self->[UA_VERSION_RAW]  = $version;
+    $self->[UA_TOOLKIT]      = $extra->[0]
+                             ? [ split RE_SLASH, shift @{ $extra } ]
+                             : []
+                             ;
 
     if ( @{$thing} && index($thing->[LAST_ELEMENT], 'rv:') != NO_IMATCH ) {
         $self->[UA_MOZILLA]  = pop @{ $thing };
         }
     }
 
-    $self->[UA_EXTRAS] = [ @{ $thing }, @extras ];
+    $self->[UA_EXTRAS] = [
+        grep { $_ }
+        @{ $thing },
+        @others,
+        $extra ? @{ $extra } : (),
+    ];
     return 1;
 }
 

t/data/desktop/epiphany/1

 'parser'           => 'mozilla_family:generic',
 'strength'         => 'U',
 'os'               => 'Linux i686',
-'extras'           => ['X11'],
+'extras'           => ['X11','Firefox/3.0'],
 'toolkit'          => ['Gecko','20080528','20080528.000'],
 'version_raw'      => '2.22',
 'lang'             => 'en',

t/data/desktop/firefox/0x

 'parser'           => 'firefox',
 'strength'         => 'U',
 'os'               => 'Linux i686',
-'extras'           => ['X11'],
+'extras'           => ['X11','Firebird/0.6.1'],
 'version_raw'      => '0.6.1',
 'lang'             => 'en-US',
 'mozilla'          => ['1.5','1.500'],