<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>22555</bug_id>
          
          <creation_ts>2013-07-03 14:34:30 +0000</creation_ts>
          <short_desc>navigator.taintEnabled()</short_desc>
          <delta_ts>2015-09-30 11:49:28 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          <blocked>22406</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ian &apos;Hixie&apos; Hickson">ian</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>philipj</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>90226</commentid>
    <comment_count>0</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-07-03 14:34:30 +0000</bug_when>
    <thetext>Examine whether and how many browsers implement navigator.taintEnabled.

See also: https://bugzilla.mozilla.org/show_bug.cgi?id=679971</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90232</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-07-03 14:48:05 +0000</bug_when>
    <thetext>According to the data in the spec, this is a method that IE and Mozilla implement that always returns false. Probably safe to add.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90456</commentid>
    <comment_count>2</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-07-09 05:17:07 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8039.
Check-in comment: navigator.taintEnabled()
http://html5.org/tools/web-apps-tracker?from=8038&amp;to=8039</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117509</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2015-01-27 13:54:20 +0000</bug_when>
    <thetext>It turns out it&apos;s probably not so safe to add, as it is being used for browser sniffing. So Gecko needs to have it, but Blink/WebKit needs to not have it. :-(

https://code.google.com/p/chromium/issues/detail?id=451979

Since the spec allows variation in navigator.userAgent and some other properties on navigator that is necessary due to browser sniffing, it would make sense to me to also allow variation in whether navigator.taintEnabled is present or not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117519</commentid>
    <comment_count>4</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-01-27 17:20:54 +0000</bug_when>
    <thetext>Can you have a look at httparchive data to get an idea of the percentage of sites that do something with navigator.taintEnabled? If that number is too high to convince Gecko of attempting removal again, an analysis of the consequences if supported by Blink would be nice, although time-consuming to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117531</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2015-01-28 08:20:26 +0000</bug_when>
    <thetext>Pages matching \btaintEnabled\b anywhere (page&apos;s HTML, iframes, external CSS/JS):

SELECT page, COUNT(*) as num
FROM [httparchive:runs.2014_08_15_requests_body]
WHERE REGEXP_MATCH(body, r&quot;\btaintEnabled\b&quot;)
GROUP BY page
ORDER BY num desc;

3693 rows.

Total number of pages:

SELECT page, COUNT(*) as num
FROM [httparchive:runs.2014_08_15_requests_body]
WHERE page = url
GROUP BY page
ORDER BY num desc;

129236

So ~2.86% of the pages.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117533</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2015-01-28 09:07:01 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #4)
&gt; If that number is too
&gt; high to convince Gecko of attempting removal again, an analysis of the
&gt; consequences if supported by Blink would be nice, although time-consuming to
&gt; do.

Do you have any bright ideas on how to do that?

I used https://addons.opera.com/sv/extensions/details/violent-monkey/?display=en to define navigator.taintEnabled = function() { return false; }; and loaded the first 40 URLs of the httparchive matches. They all appeared to load fine, but obviously some functionality might have been broken.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117535</commentid>
    <comment_count>7</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-01-28 10:40:25 +0000</bug_when>
    <thetext>I did some IE testing. IE6 and IE11 have navigator.taintEnabled() returning false, and I presume IE7-10 do as well. However, in IE12 Tech Preview with Experimental Web Platform Features enabled, i.e. Edge mode with the Chrome-like UA string, navigator.taintEnabled is gone.

Assuming this change reaches IE12 stable, I don&apos;t think it makes any sense for any non-Gecko engine to attempt adding navigator.taintEnabled(). If Gecko is still unable to remove it, this would be a very sad situation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117536</commentid>
    <comment_count>8</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-01-28 10:44:09 +0000</bug_when>
    <thetext>(In reply to Simon Pieters from comment #6)
&gt; (In reply to Philip Jägenstedt from comment #4)
&gt; &gt; If that number is too
&gt; &gt; high to convince Gecko of attempting removal again, an analysis of the
&gt; &gt; consequences if supported by Blink would be nice, although time-consuming to
&gt; &gt; do.
&gt; 
&gt; Do you have any bright ideas on how to do that?
&gt; 
&gt; I used
&gt; https://addons.opera.com/sv/extensions/details/violent-monkey/?display=en to
&gt; define navigator.taintEnabled = function() { return false; }; and loaded the
&gt; first 40 URLs of the httparchive matches. They all appeared to load fine,
&gt; but obviously some functionality might have been broken.

I&apos;d categorize the 3693 matches into groups of duplicates and look at the largest groups first. I had a quick peek and it looks like the biggest group is MooTools 1.2.x and that unfortunately it just sets window.webkit so that one would have to look for places where that is used, which is hard using grep...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117553</commentid>
    <comment_count>9</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2015-01-28 12:54:59 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #7)
&gt; Assuming this change reaches IE12 stable, I don&apos;t think it makes any sense
&gt; for any non-Gecko engine to attempt adding navigator.taintEnabled().

Agreed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117608</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2015-01-29 23:08:06 +0000</bug_when>
    <thetext>So is the request here to drop taintEnabled()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117612</commentid>
    <comment_count>11</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-01-30 04:31:18 +0000</bug_when>
    <thetext>I&apos;m not sure what the spec needs to say, I commented on the Mozilla bug to get more feedback:
https://bugzilla.mozilla.org/show_bug.cgi?id=679971#c73</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117617</commentid>
    <comment_count>12</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-01-30 09:14:52 +0000</bug_when>
    <thetext>I did a bit more categorizing of the 20141115 httparchive data, and it really is dominated by various incarnations of MooTools, mostly these two patterns:

window.xpath = !!(document.evaluate);
if (window.ActiveXObject) window.ie = window[window.XMLHttpRequest ? &apos;ie7&apos; : &apos;ie6&apos;] = true;
else if (document.childNodes &amp;&amp; !document.all &amp;&amp; !navigator.taintEnabled) window.webkit = window[window.xpath ? &apos;webkit420&apos; : &apos;webkit419&apos;] = true;
else if (document.getBoxObjectFor != null) window.gecko = true;

and

if (window.opera) Client.engine.name = &apos;opera&apos;;
else if (window.ActiveXObject) Client.engine = {&apos;name&apos;: &apos;ie&apos;, &apos;version&apos;: (Client.features.xhr) ? 7 : 6};
else if (!navigator.taintEnabled) Client.engine = {&apos;name&apos;: &apos;webkit&apos;, &apos;version&apos;: (Client.features.xpath) ? 420 : 419};
else if (document.getBoxObjectFor != null) Client.engine.name = &apos;gecko&apos;;

This is where it changed:
https://github.com/mootools/mootools-core/commit/c053361b7fec3ec454e622ba389fb2be0475f563

I also found the &quot;document.childNodes &amp;&amp; !document.all &amp;&amp; !navigator.taintEnabled&quot; pattern in other seemingly non-MooTools code.

Gecko dropped getBoxObjectFor in 2009 &lt;https://bugzilla.mozilla.org/show_bug.cgi?id=340571&gt; so Firefox is actually ending up in the unknown bucket with both scripts. Presumably, then, not being WebKit is the critical part.

Great. The compat constraint is then probably something like:
(navigator.userAgent.indexOf(&quot;WebKit&quot;)!=-1)==(!navigator.taintEnabled)

Bah.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118286</commentid>
    <comment_count>13</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2015-03-04 19:05:49 +0000</bug_when>
    <thetext>isn&apos;t &quot;!navigator.taintEnabled&quot; true regardless?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118338</commentid>
    <comment_count>14</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-03-05 05:02:42 +0000</bug_when>
    <thetext>&quot;!navigator.taintEnabled&quot; is only true if taintEnabled isn&apos;t implemented at all, which it needs to be in order to avoid being identified as WebKit.

This bug really needs input from Mozilla, but nobody reacted when I commented in https://bugzilla.mozilla.org/show_bug.cgi?id=679971

Boris, do you have any good ideas how to resolve this, or could you CC someone at Mozilla who might care about this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118340</commentid>
    <comment_count>15</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-03-05 05:16:16 +0000</bug_when>
    <thetext>So our (Mozilla&apos;s) point of view is that we tried removing this once.  We got tons of breakage: see the dependencies of https://bugzilla.mozilla.org/show_bug.cgi?id=679971

Once burned, twice shy; we&apos;re a bit leery of removing this again...  The potential win, if any, doesn&apos;t seem to be worth the likely compat problems.

But yes, what we ran into is pages detecting &quot;is webkit&quot; using !taintEnabled and then doing webkit-specific hacks and workarounds.  You proposed compat constraint from comment 12 seems spot-on to me, assuming there&apos;s a compat constraint at all.

Of course at this point, given Spartan, Gecko is just about the only UA which doesn&apos;t have &quot;WebKit&quot; in the UA string....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118344</commentid>
    <comment_count>16</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-03-05 06:50:17 +0000</bug_when>
    <thetext>Thanks, Boris. I agree that it doesn&apos;t seem sensible for Gecko to try removing taintEnabled given the way it is used.

Perhaps the best thing would be for the spec to have a note explaining that we&apos;re currently locked into a non-interoperable state for taintEnabled() with no credible path forward.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119084</commentid>
    <comment_count>17</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2015-03-30 20:47:31 +0000</bug_when>
    <thetext>Oh I see, people do &quot;!navigator.taintEnabled&quot;, not &quot;!navigator.taintEnabled()&quot;.

The way forward here is to make all the other ways in which Gecko and WebKit differ go away, so that you get the same result whichever codepath you go down, I guess...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119113</commentid>
    <comment_count>18</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-03-30 23:44:17 +0000</bug_when>
    <thetext>&gt; The way forward here is to make all the other ways in which Gecko and WebKit
&gt; differ go away

The only way to do that web-compatibly is to also make the UA strings match, unfortunately.  There are sites that depend on UA sniffing plus differences in handling of some invalid-per-spec constructs (e.g. functions in blocks in JS) that break if either browser changes to the other&apos;s behavior without changing the UA string to match.

How likely all this is to happen... Yeah.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119122</commentid>
    <comment_count>19</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-03-31 05:54:25 +0000</bug_when>
    <thetext>I think the situation we are in is that there are many incompatibilities required for compat, where changing only one of them breaks things, but changing the whole group (navigator.vendor, navigator.userAgent, navigator.taintEnabled, etc., etc.) would work.

The only hope I can see is to align on those bits that aren&apos;t constrained by sniffing, but it&apos;s not obvious that we can remove them quicker than they accumulate, as obviously it&apos;s not only prefixed things that are being used for sniffing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119318</commentid>
    <comment_count>20</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2015-04-07 22:03:37 +0000</bug_when>
    <thetext>Well we should definitely all have the same UA string (or no UA string). UA strings are a terrible idea.

If there&apos;s a set of things that we can all change at once, it would make sense to work out what that set is and then change them all at once...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119367</commentid>
    <comment_count>21</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-04-08 15:30:22 +0000</bug_when>
    <thetext>In order to stop UA string proliferation we would need to find an alternative to error reporting and analytics. If some proportion of your users is hitting JavaScript exceptions in your Web app, knowing which browser they&apos;re using is a good first step. Also, no browser would be willing to be be the first to merge into another on StatCounter or caniuse.com.

A replacement would have to make it very hard to use the analytics to change any behavior, which means it can&apos;t really be exposed while the user is still interacting with the Web app. I haven&apos;t come up with anything that would really work though. :/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119549</commentid>
    <comment_count>22</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-04-15 22:15:26 +0000</bug_when>
    <thetext>For what it&apos;s worth, I&apos;m making this method [Exposed=Window] only in Gecko, so it&apos;s gone in workers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119620</commentid>
    <comment_count>23</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2015-04-17 08:26:08 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #12)
&gt; Great. The compat constraint is then probably something like:
&gt; (navigator.userAgent.indexOf(&quot;WebKit&quot;)!=-1)==(!navigator.taintEnabled)

(In reply to Boris Zbarsky from comment #22)
&gt; For what it&apos;s worth, I&apos;m making this method [Exposed=Window] only in Gecko,
&gt; so it&apos;s gone in workers.

I&apos;ve made the relevant test expect the above in web-platform-tests in
https://critic.hoppipolla.co.uk/r/3840

I don&apos;t think we should wait until all browsers identify as WebKit (or align in some other way) before fixing this, as that might never happen. It seems more helpful for implementors right now to bake in &quot;do you identify as WebKit?&quot; in the spec, IMO.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123367</commentid>
    <comment_count>24</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-09-30 09:39:45 +0000</bug_when>
    <thetext>In https://github.com/whatwg/html/pull/207 I am introducing the concept of &quot;navigator compatibility mode&quot; to document the dependencies between the different attributes on NavigatorID, things that seems safe to change all at once, but not one by one. As part of that, I&apos;ve made it such that only UAs that use the &quot;Gecko&quot; mode should have taintEnabled(), as I can&apos;t see a way to actually converge further without reducing the number of modes, which would mean saying that Gecko should start masquerading as Chrome, like Edge does.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123375</commentid>
    <comment_count>25</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-09-30 11:49:28 +0000</bug_when>
    <thetext>That fix is now live.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>