Making WordPress.org


Ignore:
Timestamp:
09/21/2017 07:10:15 PM (7 years ago)
Author:
coffee2code
Message:

Browse Happy API: Mark versions of Internet Explorer earlier than 11 as insecure.

  • Adds IE 10 & 11 user-agent strings to test data
  • Adds unit test for insecure browsers (currently just testing for IE)

Props SergeyBiryukov.
Fixes #2587.
Fixes #core40165.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/core/browse-happy/1.0/tests/phpunit/tests/browse-happy.php

    r5948 r5949  
    6161                'Windows Internet Explorer 9.0',
    6262            ],
     63            // #2587
     64            [
     65                'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)',
     66                'Windows Internet Explorer 10.0',
     67            ],
     68            // #2587
     69            [
     70                'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko',
     71                'Windows Internet Explorer 11',
     72            ],
    6373            [
    6474                'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.21022)',
     
    217227    }
    218228
     229    /**
     230     * @dataProvider data_browse_happy
     231     *
     232     * @param string $header 'User-Agent' header value.
     233     */
     234    function test_insecure_browsers( $header ) {
     235        $parsed = browsehappy_parse_user_agent( $header );
     236
     237        if ( 'Internet Explorer' === $parsed['name'] && version_compare( $parsed['version'], '11', '<' ) ) {
     238            $this->assertTrue( $parsed['insecure'] );
     239        }
     240    }
     241
    219242}
    220243
Note: See TracChangeset for help on using the changeset viewer.