MDL-48685 core_useragent: Correct IE 5.0 issues

This commit is contained in:
Andrew Nicols
2015-01-27 08:36:28 +08:00
parent 483bdb5c24
commit eeaf95494f
2 changed files with 11 additions and 12 deletions
+7 -7
View File
@@ -176,12 +176,12 @@ class core_useragent {
}
}
if ($this->is_useragent_mobile()) {
$this->devicetype = 'mobile';
$this->devicetype = self::DEVICETYPE_MOBILE;
} else if ($this->is_useragent_tablet()) {
$this->devicetype = 'tablet';
} else if (substr($this->useragent, 0, 34) === 'Mozilla/4.0 (compatible; MSIE 6.0;') {
// Safe way to check for IE6 and not get false positives for some IE 7/8 users.
$this->devicetype = 'legacy';
$this->devicetype = self::DEVICETYPE_TABLET;
} else if (self::check_ie_version('0') && !self::check_ie_version('7.0')) {
// IE 6 and before are considered legacy.
$this->devicetype = self::DEVICETYPE_LEGACY;
} else {
$this->devicetype = self::DEVICETYPE_DEFAULT;
}
@@ -884,7 +884,7 @@ class core_useragent {
if ($instance->useragent === false) {
// Can't be sure, just say no.
$instance->supportssvg = false;
} else if (self::is_ie() and !self::check_ie_version('9')) {
} else if (self::check_ie_version('0') and !self::check_ie_version('9')) {
// IE < 9 doesn't support SVG. Say no.
$instance->supportssvg = false;
} else if (self::is_ie() and !self::check_ie_version('10') and self::check_ie_compatibility_view()) {
@@ -911,7 +911,7 @@ class core_useragent {
*/
public static function supports_json_contenttype() {
// Modern browsers other than IE correctly supports 'application/json' media type.
if (!self::is_ie()) {
if (!self::check_ie_version('0')) {
return true;
}
+4 -5
View File
@@ -32,6 +32,8 @@
class core_useragent_testcase extends basic_testcase {
public function user_agents_providers() {
// Note: When adding new entries to this list, please ensure that any new browser versions are added to the corresponding list.
// This ensures that regression tests are applied to all known user agents.
return array(
// Windows 98; Internet Explorer 5.0.
array(
@@ -48,8 +50,7 @@ class core_useragent_testcase extends basic_testcase {
),
// IE 5.0 is a legacy browser.
// TODO Why is this not legacy!?
//'devicetype' => 'legacy',
'devicetype' => 'legacy',
'supports_svg' => false,
'supports_json_contenttype' => false,
@@ -71,8 +72,7 @@ class core_useragent_testcase extends basic_testcase {
),
// IE 6.0 is a legacy browser.
// TODO Why is this not legacy!?
//'devicetype' => 'legacy',
'devicetype' => 'legacy',
'supports_svg' => false,
'supports_json_contenttype' => false,
@@ -160,7 +160,6 @@ class core_useragent_testcase extends basic_testcase {
'7.0' => true,
'8.0' => true,
),
'iecompatibility' => false,
'versionclasses' => array(
'ie',
'ie8',