This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27954 - navigator.productSub
Summary: navigator.productSub
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-04 07:10 UTC by Philip Jägenstedt
Modified: 2015-09-30 13:23 UTC (History)
6 users (show)

See Also:


Attachments

Description Philip Jägenstedt 2015-02-04 07:10:36 UTC
This is also used too much and too easy to support to be removed:
https://www.chromestatus.com/metrics/feature/timeline/popularity/123

In Gecko it is "20100101" and in WebKit/Blink it's "20030107". IE11 and earlier didn't have it, but in the IE Tech Preview Edge mode it's "20030107" too.

Unless Gecko feel like taking a risk, spec'ing it as either value is probably simplest.
Comment 1 Simon Pieters 2015-02-04 14:23:35 UTC
These strings also appear in the User-Agent.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference says 20100101 is used in desktop Firefox but not on mobile. However, navigator.productSub is 20100101 on mobile Firefox AFAICT.
Comment 2 Bruno Racineux 2015-02-27 23:28:37 UTC
I am fine with 'either'. Definitely against "empty" as specs, as I wouldn't want to loose the valuable '20030107' KHTML flag.

All Webkit based browsers and Konqueror have this '20030107' unique identifier. It represents the Apple's forking date of the KDE engine and first Beta release of Safari.

For the IE Tech Preview Edge engine to replicate that, deliberately fooling code that Explorer is a full-fledge webkit engine is dangerous distortion.
 
Implementors love to complain that browser detection is wrong. But Microsoft is playing that very same game here. IE12/Edge is trying to pass for a Webkit engine for previously written javascript code. And yet, it has none of the native specific characteristics and/or bugs of Webkit, which on would try to circumvent by being a responsible developer. I find this very troubling.

For IE to support webkit prefixes is reasonable. However, pretending to be something they are not, and deliberately messing around with good signals like this, will break "good and well intended" code. I'd welcome a 'navigator.productSub' spec prohibiting browsers from that kind of misleading practice.

Aside from webkit, navigator.productSub does little for me. Gecko's '20100101' is not fully consistent because some windows build had the Firefox build version  instead. So it can be used as a signal, but not a unique a guarantee.

And as Simon mentioned, Firefox Mobile on GeckoOS deliberately made navigator.productSub, navigator.vendor and navigator.cpu all empty. But all other desktop versions of Firefox kept their initial values. '20100101' is otherwise the mark of a Gecko 2 engine.
Comment 3 Ian 'Hixie' Hickson 2015-03-04 21:45:31 UTC
Would Gecko be willing to change productSub to 20030107 everywhere?
Comment 4 Philip Jägenstedt 2015-03-05 07:00:12 UTC
CC Boris as the usual Mozilla suspect :)
Comment 5 Boris Zbarsky 2015-03-05 15:38:18 UTC
Hmm.  Gerv, do you happen to recall what issues we ran into when we tried removing productSub altogether on desktop, whether they were issues with just the UA string proper or with the specific navigator.productSub getter, and whether we'd have the same issues with the "20030107" string?
Comment 6 Gervase Markham 2015-03-05 16:04:52 UTC
Hi Boris,

As I remember, what we did was try and replace the current date with "17.0" or "4.0" or some other Firefox version number in the UA string. However, we had the problem that people were doing numeric comparisons against particular date values to check for support for things, and because 4.0 is < 20080801 (for example), those checks were failing.

We managed to make this change on Mobile, but not on Desktop. So now our UAs are distinct in this regard. 20100101 should not be used for detecting Gecko - searching for "Gecko/" should be used for that.

None of the above directly relates to productSub, though - we were looking at it from the perspective of UA parsing.

Still, therefore, I'd say we wouldn't support changing it to a lower value (20030107), because people may still be doing numeric comparisons on the number that they expect to pass, and those may well fail unexpectedly.

Gerv
Comment 7 Philip Jägenstedt 2015-03-05 16:29:59 UTC
Would it likely be safe for Gecko to always return "20100101"? That would at least limit productSub to two possible values.
Comment 8 Gervase Markham 2015-03-05 16:31:43 UTC
(In reply to Philip Jägenstedt from comment #7)
> Would it likely be safe for Gecko to always return "20100101"? That would at
> least limit productSub to two possible values.

That's what we do now, isn't it?

Gerv
Comment 9 Philip Jägenstedt 2015-03-06 04:27:03 UTC
(In reply to Gervase Markham from comment #8)
> (In reply to Philip Jägenstedt from comment #7)
> > Would it likely be safe for Gecko to always return "20100101"? That would at
> > least limit productSub to two possible values.
> 
> That's what we do now, isn't it?

Oh, great if so. Can you check comment #1 to see if that documentation is just wrong?
Comment 10 Bruno Racineux 2015-03-06 05:31:24 UTC
> Oh, great if so. Can you check comment #1 to see if that documentation is
> just wrong?
The doc is not wrong. But I can see that our comments are indeed confusing, as we are speaking of two different mobile(s). To clarify:

I am pretty sure Simon's observation was referring to Firefox on Android.
While both Gervase and I meant 'mobile' as in the Firefox OS (B2G Phone).

Firefox on B2G is an empty string. Firefox on Android is still "20100101".
Comment 11 Gervase Markham 2015-03-06 08:59:44 UTC
Someone with a Firefox OS phone would need to check what navigator.productSub is. We changed the UA, but that doesn't _necessarily_ mean productSub is always the same value.

Is there a website which dumps these values to the page so we can test?

Gerv
Comment 13 Gervase Markham 2015-03-06 10:03:25 UTC
Thank you. The answer appears to be 20100101 on both Firefox OS and Firefox for Android.

Gerv
Comment 14 Bruno Racineux 2015-03-06 10:04:33 UTC
(In reply to Gervase Markham from comment #11)
> We changed the UA, but that doesn't _necessarily_ mean productSub is always the same value.

Ok. You are right. My mistake. The B2G emulator has indeed productSub "20100101".
Gecko could be frozen at "20100101" and Webkit at "20030107". That would work.
Comment 15 Boris Zbarsky 2015-03-06 15:27:22 UTC
What do we tell new UAs (like servo) to implement?
Comment 16 Philip Jägenstedt 2015-03-06 17:20:48 UTC
Have you decided what UA string Servo will have? I suspect this and many other questions will follow naturally from that...
Comment 17 Boris Zbarsky 2015-03-06 17:31:14 UTC
I don't know that that's been decided, but the point is in an ideal world the spec would describe the interactions there instead of requiring reverse-engineering....
Comment 18 Philip Jägenstedt 2015-03-06 18:19:07 UTC
Yes, that is true. I'd certainly be OK with the spec saying that if the UA string contains this and that, productSub should be this and that.
Comment 19 Ian 'Hixie' Hickson 2015-03-30 22:28:47 UTC
Have non-Gecko browsers considered changing to "20100101"?
Comment 20 Philip Jägenstedt 2015-03-31 09:25:12 UTC
Since we now have three non-Gecko engines returning "20030107" it seems like a tough job to change them to something else.

An analysis of how productSub is used in the wild might make some changes seem safer than others, though. Simon, does a quick search for 20030107 and 20100101 in httparchive data reveal anything interesting?
Comment 22 Gervase Markham 2015-04-01 08:16:53 UTC
Because the Gecko date was originally a Gecko invention, I would suspect that it was more often checked in Gecko-detecting code paths, and so 20100101 would be a more common value to check for on the web than 20030107. In addition, if people are doing numeric comparisons, it it more compatible to round the figure up rather than down. 

As noted in comment 6, Mozilla at one point tried to replace the date with a Firefox version number, but we found that sites were doing:

if (number > 20080507) {
  // Use new Gecko feature
}

and if "number" was 15.0 or 21.0, then of course the comparison failed and we got the old codepath. That's how we ended up freezing the Gecko date at the current value at the time (or thereabouts).

So I'd say either we spec that either value is permissible, or we spec the 20100101 date. If it takes a few years for UAs to catch up, I doubt the web will be weeping into its beer.

Gerv
Comment 23 Simon Pieters 2015-04-01 12:42:43 UTC
There was a lot of noise in the 20100101 matches. The only thing being relevant for 20100101 are matches of "<20100101" and ">=20100101", for which there are three pages.

page url
http://www.privemanagers.com/ https://www.privemanagers.com/sly/sc/modules/ISC_Core.js
http://www.songs.to/	http://songs.to/songs/sc/modules/ISC_Core.js
http://www.sourcenext.info/	http://www.sourcenext.com/js/_site.js

some extracts:

var _8=isc.Browser.geckoVersion,_9=_8<20100101&&((_5.overflow!=""visible"")&&(_8>=20051111||(_7==isc.Canvas.ABSOLUTE&&_5.overflow!=""hidden"")))

isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.redrawOnResize=false;isc.A.overflow=""hidden"";isc.A.useExplicitHeight=isc.Browser.isSafari||(isc.Browser.isFirefox&&isc.Browser.isStrict&&isc.Browser.geckoVersion>=20100101);

var _8=isc.Browser.geckoVersion,_9=_8<20100101&&((_5.overflow!=""visible"")&&(_8>=20051111||(_7==isc.Canvas.ABSOLUTE&&_5.overflow!=""hidden"")))

var _9=isc.Browser.geckoVersion;var _10=_9<20100101&&((_6.overflow!=""visible"")&&(_9>=20051111||(_8==isc.Canvas.ABSOLUTE&&_6.overflow!=""hidden"")))

isc.A.useExplicitHeight=isc.Browser.isSafari||(isc.Browser.isFirefox&&isc.Browser.isStrict&&isc.Browser.geckoVersion>=20100101);


(This does not take into account comparing other values as Gerv said above pages are doing.)
Comment 24 Simon Pieters 2015-04-01 12:48:39 UTC
For 20030107, three pages.

page url
http://www.javaworld.com.tw/	http://www.javaworld.com.tw/jute/javaworld/home.js
http://www.trashbox.ru/	http://trashbox.ru/webcache/all1201407055542.gz.js
http://www.dell4me.com/	http://www1-cdn.dell.com/JS/default/jsmin.ashx?set=masthead&theme=default&cmp=0&version=14.7.31.1

if( suppressMenus || ( isOpera && readOperaVer() < 7 ) || ( isGecko && navigator.productSub <= 20011022 ) || ( isGecko && navigator.productSub == 20030107 ) ) { // Opera 6.x doesn't seem to like the DHTML... // Netscape 6.2 puts the menus in the wrong place... // Safari, the menus don't go away... problem in ResetMenu isDHTML = false; } } }

if(navigator.product==""Gecko""&&navigator.productSub>=20030107&&!(typeof(opera)=='object'&&opera.postError)){this.gecko=true;return true;}

if (isGecko && navigator.productSub == 20030107) { var x = navigator.userAgent.indexOf(""AppleWebKit""); if (x > -1) { isDHTML = (navigator.userAgent.substring(x + 12, x + 15)) > 300; } else { isDHTML = false; }
Comment 25 Philip Jägenstedt 2015-04-03 04:33:01 UTC
Interesting, not a single case of `if (isWebKit && navigator.productSub=="20030107") doStuffWithPrefixes();` or `var WebKit = navigator.productSub=="20030107"`?
Comment 26 Simon Pieters 2015-04-07 07:51:29 UTC
Nope
Comment 27 Philip Jägenstedt 2015-04-08 12:51:15 UTC
That's a bit surprising, but encouraging. It still seems like a formidable challenge to have Blink, WebKit and IE change, though. If we can get people from WebKit and IE saying that they'd consider trying it, maybe.
Comment 28 Philip Jägenstedt 2015-09-30 13:23:16 UTC
Spec'd in https://github.com/whatwg/html/pull/199