Commits

Burak Gürsoy  committed 9dc0715

Fennec support.

  • Participants
  • Parent commits f091037

Comments (0)

Files changed (3)

    => Fixes for Maxthon and Android stupidities.
    => Fix for emacs parser.
    => Fix mozilla parser.
+   => Fennec suport.
 
 0.34 Sun Apr  8 00:08:41 2012
    => "normalize" option.

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

 sub _parse_firefox {
     my($self, @args) = @_;
     $self->_parse_mozilla_family( @args );
+    my $e = $self->[UA_EXTRAS];
+    if ( ref $e eq 'ARRAY'
+        && @{ $e } > 0
+        && index( lc $e->[-1], 'fennec' ) != NO_IMATCH
+    ) {
+        my($name, $version) = split RE_SLASH, pop @{ $e };
+        $self->[UA_ORIGINAL_NAME]    = $name;
+        $self->[UA_ORIGINAL_VERSION] = $version;
+        $self->[UA_MOBILE]           = 1;
+        if ( $self->[UA_LANG]
+            && index( $self->[UA_LANG], q{ } ) != NO_IMATCH
+        ) {
+            push @{ $self->[UA_EXTRAS] }, $self->[UA_LANG];
+            $self->[UA_LANG] = undef;
+        }
+    }
     $self->[UA_NAME] = 'Firefox';
     return 1;
 }

File t/data/mobile/firefox

 [AGENT]
 
-#TODO: Mozilla/5.0 (Android; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
+Mozilla/5.0 (Android; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
+
+extras           => [ 'Linux armv7l' ],
+mobile           => 1,
+mozilla          => [ '10.0.1', '10.000001' ],
+name             => 'Firefox',
+original_name    => 'Fennec',
+original_version => '10.0.1',
+os               => 'Android',
+parser           => 'firefox',
+toolkit          => [ 'Gecko', '20100101', '20100101.000' ],
+version          => '10.000001',
+version_raw      => '10.0.1',
 
 [AGENT]
 
-#TODO: Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
+Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
+
+extras           => [ 'Linux armv7l' ],
+mobile           => 1,
+mozilla          => [ '10.0.1', '10.000001' ],
+name             => 'Firefox',
+original_name    => 'Fennec',
+original_version => '10.0.1',
+os               => 'Maemo',
+parser           => 'firefox',
+toolkit          => [ 'Gecko', '20100101', '20100101.000' ],
+version          => '10.000001',
+version_raw      => '10.0.1',
 
 [AGENT]
 
-#TODO: Mozilla/5.0 (X11; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
+Mozilla/5.0 (X11; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
+
+extras           => [ 'Linux armv7l' ],
+mobile           => 1,
+mozilla          => [ '10.0.1', '10.000001' ],
+name             => 'Firefox',
+original_name    => 'Fennec',
+original_version => '10.0.1',
+os               => 'X11',
+parser           => 'firefox',
+toolkit          => [ 'Gecko', '20100101', '20100101.000' ],
+version          => '10.000001',
+version_raw      => '10.0.1',
 
 [AGENT]
 
-#TODO: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
+Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1
+
+extras           => [ 'Linux i686' ],
+mobile           => 1,
+mozilla          => [ '10.0.1', '10.000001' ],
+name             => 'Firefox',
+original_name    => 'Fennec',
+original_version => '10.0.1',
+os               => 'X11',
+parser           => 'firefox',
+toolkit          => [ 'Gecko', '20100101', '20100101.000' ],
+version          => '10.000001',
+version_raw      => '10.0.1',