Edgewall Software

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#11262 closed defect (fixed)

MSIE10 bug: "#__msie303:" not being replaced to "#" on client side

Reported by: lp-san@… Owned by: Jun Omae
Priority: normal Milestone: 1.0.2
Component: ticket system Version: 1.0.1
Severity: minor Keywords: iexplorer, iexplorer10, navigation, javascript, msie303
Cc: Branch:
Release Notes:

Fix #__msie303 workaround not working on Internet Explorer 10 in strict mode.

API Changes:
Internal Changes:


Found a bug in our local 1.0.1 installation.

Using Windows 7 SP1 x64 and freshly installed MSIE10 with all default settings.

When making changes to existing ticket or just adding a comment, the resulting URL is something like http://trac.***.ru/ticket/39746#__msie303:comment:14

IE9 is OK, but in IE10 it's always "#__msie303": in the URL anchor.

I checked the source code within the browser, the replacement js code is alright, but the address stays wrong. I checked IE10 development console, there are no javascript fatal errors.

Finally, I tried to create a new ticket on Edgewall's 1.0.1 sandbox and then post a comment into it with my MSIE10. I got exactly the same broblem and the wrong url: http://trac.edgewall.org/demo-1.0/ticket/2121#__msie303:comment:1

I asked my colleague with MSIE10 (unfortunatelly, I cannon ask him about his exact environment) to check for this problem at our installation, he has the same problems.

Before I installed MSIE10, there was no such problem with MSIE9 on my machine.

Attachments (0)

Change History (9)

comment:1 by Ryan J Ollos, 9 years ago

Component: web frontendticket system
Milestone: 1.0.2

I can confirm the behavior in IE10 on Windows 7. I haven't looked into the source of the problem, but I think we should fix this for 1.0.2.

comment:2 by Jun Omae, 9 years ago

Reproduced. The hash #__msie303:... is workaround for #10382 and #10590 introduced by [10851] and [11016]. According to comment:8:ticket:10382, the issue was present in IE 7/8/9.

I just confirmed the #10382 with IE 6-10.

IE6 reproduced
IE7 reproduced
IE8 not reproduced
IE9 not reproduced
IE10 not reproduced

At least, for IE10, the workaround is not needed.

  • trac/web/api.py

    index 05e80d1..b82a70f 100644
    a b from hashlib import md5  
    2323import new
    2424import mimetypes
    2525import os
     26import re
    2627import socket
    2728from StringIO import StringIO
    2829import sys
    class Request(object):  
    479480            scheme, host = urlparse.urlparse(self.base_url)[:2]
    480481            url = urlparse.urlunparse((scheme, host, url, None, None, None))
    482         # Workaround #10382, IE6+ bug when post and redirect with hash
    483         if status == 303 and '#' in url and \
    484                 ' MSIE ' in self.environ.get('HTTP_USER_AGENT', ''):
    485             url = url.replace('#', '#__msie303:')
     483        # Workaround #10382, IE6-IE9 bug when post and redirect with hash
     484        if status == 303 and '#' in url:
     485            match = re.search(' MSIE ([0-9]+)',
     486                              self.environ.get('HTTP_USER_AGENT', ''))
     487            if match and int(match.group(1)) < 10:
     488                url = url.replace('#', '#__msie303:')
    487490        self.send_header('Location', url)
    488491        self.send_header('Content-Type', 'text/plain')
Last edited 9 years ago by Jun Omae (previous) (diff)

comment:3 by anonymous, 9 years ago

AFAIR, MSIE lies about its version when working in Compatibility Mode. It might be more accurate to check for Trident version, shall the issue be compatibility-independent.

comment:4 by Jun Omae, 9 years ago

Indeed. Thanks for the information!

comment:5 by Jun Omae, 9 years ago

Owner: set to Jun Omae
Status: newassigned

I investigated with each version of Internet Explorer again.

#10382 #__msie303 workaround User-Agent
IE 10 (strict mode) not reproduced not working Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)
IE 10 (compat mode) not reproduced ok Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/6.0)
IE 9 (strict mode) not reproduced ok Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
IE 9 (compat mode) not reproduced ok Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0)
IE 8 (strict mode) not reproduced ok Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
IE 8 (compat mode) not reproduced ok Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)

Therefore, I think that the patch in comment:2 is sufficient to solve this issue. I'll apply it to 0.12-stable, 1.0-stable and trunk later.

comment:6 by Jun Omae, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for the reporting! Fixed in [11949] for 0.12-stable and merged in [11950-11951].

comment:7 by lostpoint <lp-san@…>, 9 years ago

Thanks for fixing :)

comment:8 by lostpoint <lp-san@…>, 9 years ago

BTW, I thought you will eventually change the checking from MSIE string to Trident.

I personally used the following code based on your:

  • Internal/Utilities/trac/branches/TR1.0.1/trac/web/api.py

    a b  
    475475        # Workaround #10382, IE6+ bug when post and redirect with hash
     476        # manually patched until 1.0.2 - REMOVE LATER
     477        import re
     478        #
    476479        if status == 303 and '#' in url and \
     480                re.search('Trident ([0-9]+)',self.environ.get('HTTP_USER_AGENT', '')) and \
     481                int(re.search('Trident ([0-9]+)',self.environ.get('HTTP_USER_AGENT', '')).group(1)) < 6 and \
    477482                ' MSIE ' in self.environ.get('HTTP_USER_AGENT', ''):
    478483            url = url.replace('#', '#__msie303:')

Although MSIE would be okay as well, shall the bug appears only in Strict Mode (MSIE version in User Agent should be 10 in Strict Mode, AFAIK).

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:9 by mark.cooke@…, 7 years ago

Note: similar issue raised again for 1.0.8 as #12149.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.