Page MenuHomePhabricator

Safari detection fails in wikibits.js
Closed, ResolvedPublic

Description

Author: z9z8z-wps

Description:
Detection of the Safari browser in skins-1.5/common/wikibits.js is done by the line

var is_safari = ((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1));

At least the current Safari version returns a client string containing

"applewebkit/417.9 (khtml, like gecko) safari/417.8"

wich fails the case sensitive comparisation with "AppleWebKit".


Version: 1.6.x
Severity: normal

Details

Reference
bz4662

Related Objects

StatusSubtypeAssignedTask
ResolvedNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:02 PM
bzimport set Reference to bz4662.
bzimport added a subscriber: Unknown Object (MLST).

Safari sends AppleWebKit, but wikibits.js converts the agent string to lowercase
before doing comparisons.

Anyway, user-agent sniffing is kinda crappy; what actually uses these variables?

z9z8z-wps wrote:

It's used for bug 4663. I need to change AppleWebKit to applewebkit and change the line mentioned there to get the toolbar working

Fixed in r13687 (but you should not use it; most functional
checks should be based on behavior, not user-agent reporting.)