Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Internet Explorer support #27560

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/dav/lib/Connector/Sabre/FilesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ public function httpGet(RequestInterface $request, ResponseInterface $response)
$filename = $node->getName();
if ($this->request->isUserAgent(
[
Request::USER_AGENT_IE,
Request::USER_AGENT_ANDROID_MOBILE_CHROME,
Request::USER_AGENT_FREEBOX,
])) {
Expand Down
1 change: 0 additions & 1 deletion apps/dav/lib/Files/BrowserErrorPagePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public static function isBrowserRequest(IRequest $request) {
return false;
}
return $request->isUserAgent([
Request::USER_AGENT_IE,
Request::USER_AGENT_MS_EDGE,
Request::USER_AGENT_CHROME,
Request::USER_AGENT_FIREFOX,
Expand Down
1 change: 0 additions & 1 deletion apps/files/lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
$params['showgridview'] = $this->config->getUserValue($user, 'files', 'show_grid', false);
$params['isIE'] = \OC_Util::isIe();
$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
$params['showHiddenFiles'] = $showHidden ? 1 : 0;
$cropImagePreviews = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', true);
Expand Down
3 changes: 1 addition & 2 deletions apps/files/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@
$publicUploadEnabled = $shareManager->shareApiLinkAllowPublicUpload() ? 'yes' : 'no';;

$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
$isIE = OC_Util::isIe();

// renders the controls and table headers template
$tmpl = new OCP\Template('files', 'list', '');

// gridview not available for ie
$tmpl->assign('showgridview', $showgridview && !$isIE);
$tmpl->assign('showgridview', $showgridview);
$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
$tmpl->printPage();
3 changes: 1 addition & 2 deletions apps/files/recentlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
$userSession = \OC::$server->getUserSession();

$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
$isIE = OC_Util::isIe();

$tmpl = new OCP\Template('files', 'recentlist', '');

// gridview not available for ie
$tmpl->assign('showgridview', $showgridview && !$isIE);
$tmpl->assign('showgridview', $showgridview);

$tmpl->printPage();
3 changes: 1 addition & 2 deletions apps/files/simplelist.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
$userSession = \OC::$server->getUserSession();

$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
$isIE = OC_Util::isIe();

// renders the controls and table headers template
$tmpl = new OCP\Template('files', 'simplelist', '');

// gridview not available for ie
$tmpl->assign('showgridview', $showgridview && !$isIE);
$tmpl->assign('showgridview', $showgridview);
$tmpl->printPage();
12 changes: 5 additions & 7 deletions apps/files/templates/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
<?php $_['appNavigation']->printPage(); ?>
<div id="app-content">

<?php if (!$_['isIE']) { ?>
<input type="checkbox" class="hidden-visually" id="showgridview"
aria-label="<?php p($l->t('Toggle grid view'))?>"
<?php if ($_['showgridview']) { ?>checked="checked" <?php } ?>/>
<label id="view-toggle" for="showgridview" class="button <?php p($_['showgridview'] ? 'icon-toggle-filelist' : 'icon-toggle-pictures') ?>"
title="<?php p($l->t('Toggle grid view'))?>"></label>
<?php } ?>
<input type="checkbox" class="hidden-visually" id="showgridview"
aria-label="<?php p($l->t('Toggle grid view'))?>"
<?php if ($_['showgridview']) { ?>checked="checked" <?php } ?>/>
<label id="view-toggle" for="showgridview" class="button <?php p($_['showgridview'] ? 'icon-toggle-filelist' : 'icon-toggle-pictures') ?>"
title="<?php p($l->t('Toggle grid view'))?>"></label>

<?php foreach ($_['appContents'] as $content) { ?>
<div id="app-content-<?php p($content['id']) ?>" class="hidden viewcontainer">
Expand Down
1 change: 0 additions & 1 deletion apps/files/tests/Controller/ViewControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ public function testIndexWithRegularBrowser() {
],
'hiddenFields' => [],
'showgridview' => false,
'isIE' => false,
]
);
$policy = new Http\ContentSecurityPolicy();
Expand Down
3 changes: 1 addition & 2 deletions apps/files_external/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@
$userSession = \OC::$server->getUserSession();

$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', true);
$isIE = OC_Util::isIe();

$tmpl = new OCP\Template('files_external', 'list', '');

// gridview not available for ie
$tmpl->assign('showgridview', $showgridview && !$isIE);
$tmpl->assign('showgridview', $showgridview);

/* Load Status Manager */
\OCP\Util::addStyle('files_external', 'external');
Expand Down
3 changes: 1 addition & 2 deletions apps/files_sharing/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@
$eventDispatcher = \OC::$server->get(OCP\EventDispatcher\IEventDispatcher::class);

$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
$isIE = OC_Util::isIe();

$tmpl = new OCP\Template('files_sharing', 'list', '');

// gridview not available for ie
$tmpl->assign('showgridview', $showgridview && !$isIE);
$tmpl->assign('showgridview', $showgridview);

// fire script events
$legacyEventDispatcher->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts', new GenericEvent());
Expand Down
3 changes: 1 addition & 2 deletions apps/files_trashbin/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
$userSession = \OC::$server->getUserSession();

$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
$isIE = OC_Util::isIe();

$tmpl = new OCP\Template('files_trashbin', 'index', '');

// gridview not available for ie
$tmpl->assign('showgridview', $showgridview && !$isIE);
$tmpl->assign('showgridview', $showgridview);
OCP\Util::addScript('files_trashbin', 'files_trashbin');
$tmpl->printPage();
1 change: 0 additions & 1 deletion apps/files_versions/lib/Sabre/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public function afterGet(RequestInterface $request, ResponseInterface $response)

if ($this->request->isUserAgent(
[
Request::USER_AGENT_IE,
Request::USER_AGENT_ANDROID_MOBILE_CHROME,
Request::USER_AGENT_FREEBOX,
])) {
Expand Down
3 changes: 0 additions & 3 deletions apps/settings/src/components/AuthToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ import {

// When using capture groups the following parts are extracted the first is used as the version number, the second as the OS
const userAgentMap = {
ie: /(?:MSIE|Trident|Trident\/7.0; rv)[ :](\d+)/,
// Microsoft Edge User Agent from https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx
edge: /^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Chrome\/[0-9.]+ (?:Mobile Safari|Safari)\/[0-9.]+ Edge\/[0-9.]+$/,
// Firefox User Agent from https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference
Expand All @@ -118,7 +117,6 @@ const userAgentMap = {
sailfishBrowser: /(Sailfish).*SailfishBrowser\/(\d+)/,
}
const nameMap = {
ie: t('setting', 'Internet Explorer'),
edge: t('setting', 'Edge'),
firefox: t('setting', 'Firefox'),
chrome: t('setting', 'Google Chrome'),
Expand All @@ -135,7 +133,6 @@ const nameMap = {
sailfishBrowser: 'SailfishBrowser',
}
const iconMap = {
ie: 'icon-desktop',
edge: 'icon-desktop',
firefox: 'icon-desktop',
chrome: 'icon-desktop',
Expand Down
10 changes: 1 addition & 9 deletions core/src/OC/dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,20 +304,12 @@ const Dialogs = {
multiselect = false
}

// No grid for IE!
if (OC.Util.isIE()) {
self.$filePicker.find('#picker-view-toggle').remove()
self.$filePicker.find('#picker-filestable').removeClass('view-grid')
}

$('body').append(self.$filePicker)

self.$showGridView = $('input#picker-showgridview')
self.$showGridView.on('change', _.bind(self._onGridviewChange, self))

if (!OC.Util.isIE()) {
self._getGridSettings()
}
self._getGridSettings()

var newButton = self.$filePicker.find('.actions.creatable .button-add')
if (type === self.FILEPICKER_TYPE_CHOOSE && !options.allowDirectoryChooser) {
Expand Down
10 changes: 0 additions & 10 deletions core/src/OC/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*
*/

import $ from 'jquery'
import moment from 'moment'

import History from './util-history'
Expand Down Expand Up @@ -141,15 +140,6 @@ export default {
return moment(timestamp).fromNow()
},

/**
* Returns whether this is IE
*
* @returns {bool} true if this is IE, false otherwise
*/
isIE() {
return $('html').hasClass('ie')
},

/**
* Returns the width of a generic browser scrollbar
*
Expand Down
11 changes: 3 additions & 8 deletions core/src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,15 @@ moment.locale(OC.getLocale())
*/
export const initCore = () => {
const userAgent = window.navigator.userAgent
const msie = userAgent.indexOf('MSIE ')
const trident = userAgent.indexOf('Trident/')
const edge = userAgent.indexOf('Edge/')

if (msie > 0 || trident > 0) {
// (IE 10 or older) || IE 11
$('html').addClass('ie')
} else if (edge > 0) {
if (edge > 0) {
// for edge
$('html').addClass('edge')
}

// css variables fallback for IE
if (msie > 0 || trident > 0 || edge > 0) {
// css variables fallback for Edge
if (edge > 0) {
console.info('Legacy browser detected, applying css vars polyfill')
cssVars({
watch: true,
Expand Down
1 change: 0 additions & 1 deletion lib/private/AppFramework/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
* @property mixed[] server
*/
class Request implements \ArrayAccess, \Countable, IRequest {
public const USER_AGENT_IE = '/(MSIE)|(Trident)/';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets keep that?

// Microsoft Edge User Agent from https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx
public const USER_AGENT_MS_EDGE = '/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Chrome\/[0-9.]+ (Mobile Safari|Safari)\/[0-9.]+ Edge\/[0-9.]+$/';
// Firefox User Agent from https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference
Expand Down
4 changes: 0 additions & 4 deletions lib/private/TemplateLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ public function __construct($renderAs, $appId = '') {
/** @var IInitialStateService */
$this->initialState = \OC::$server->get(IInitialStateService::class);

if (\OC_Util::isIe()) {
Util::addStyle('ie');
}

// Decide which page we show
if ($renderAs === TemplateResponse::RENDER_AS_USER) {
/** @var INavigationManager */
Expand Down
1 change: 0 additions & 1 deletion lib/private/legacy/OC_Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class OC_Response {
public static function setContentDispositionHeader($filename, $type = 'attachment') {
if (\OC::$server->getRequest()->isUserAgent(
[
\OC\AppFramework\Http\Request::USER_AGENT_IE,
\OC\AppFramework\Http\Request::USER_AGENT_ANDROID_MOBILE_CHROME,
\OC\AppFramework\Http\Request::USER_AGENT_FREEBOX,
])) {
Expand Down
5 changes: 0 additions & 5 deletions lib/private/legacy/OC_Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ public static function initTemplateEngine($renderAs) {
}
OC_Util::addScript('core', 'dist/main', true);

if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) {
// shim for the davclient.js library
\OCP\Util::addScript('dist/files_iedavclient');
}

self::$initTemplateEngineFirstRun = false;
}
}
Expand Down
13 changes: 0 additions & 13 deletions lib/private/legacy/OC_Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -1463,17 +1463,4 @@ public static function needUpgrade(\OC\SystemConfig $config) {
return false;
}
}

/**
* is this Internet explorer ?
*
* @return boolean
*/
public static function isIe() {
if (!isset($_SERVER['HTTP_USER_AGENT'])) {
return false;
}

return preg_match(Request::USER_AGENT_IE, $_SERVER['HTTP_USER_AGENT']) === 1;
}
}
30 changes: 0 additions & 30 deletions tests/lib/AppFramework/Http/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -932,20 +932,6 @@ public function testUndefinedUserAgent($testAgent, $userAgent, $matches) {
*/
public function userAgentProvider() {
return [
[
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
[
Request::USER_AGENT_IE
],
true,
],
[
'Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0',
[
Request::USER_AGENT_IE
],
false,
],
[
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36',
[
Expand All @@ -967,25 +953,9 @@ public function userAgentProvider() {
],
true,
],
[
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
[
Request::USER_AGENT_ANDROID_MOBILE_CHROME
],
false,
],
[
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
[
Request::USER_AGENT_IE,
Request::USER_AGENT_ANDROID_MOBILE_CHROME,
],
true,
],
[
'Mozilla/5.0 (Linux; Android 4.4; Nexus 4 Build/KRT16S) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.59 Mobile Safari/537.36',
[
Request::USER_AGENT_IE,
Request::USER_AGENT_ANDROID_MOBILE_CHROME,
],
true,
Expand Down