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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>145717</bug_id>
          
          <creation_ts>2015-06-05 16:19:53 -0700</creation_ts>
          <short_desc>It&apos;s impossible to detect that XMLHttpRequest is blocked by mixed content blocking</short_desc>
          <delta_ts>2018-01-08 17:09:32 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>146706</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=140940</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=145718</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>140625</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexey Proskuryakov">ap</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>beidson</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>dbates</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>oliver</cc>
    
    <cc>wilander</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1100005</commentid>
    <comment_count>0</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2015-06-05 16:19:53 -0700</bug_when>
    <thetext>When mixed content blocking is enabled in WebKit, mixed content XMLHttpRequests just appear to stall - they forever remain in readyState 1, and don&apos;t get any final events.

I suspect that they likely leak at some level too.

Steps to reproduce:
1. Put any simple XMLHttpRequest test case into LayoutTests/tests/http that loads from http://127.0.0.1:8000

2. Run this command (it essentially runs the server for us, as run-webkit-httpd doesn&apos;t support https):

run-webkit-tests LayoutTests/http/tests/xmlhttprequest/readystatechange.html --repeat 100000

3. Open your test using https, observe that the load stalls.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1100009</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2015-06-05 16:28:01 -0700</bug_when>
    <thetext>security/mixedContent/resources/insecure-xhr-in-main-frame-window.html will be one such test to run once i update it in bug 145718.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1100364</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2015-06-08 08:10:50 -0700</bug_when>
    <thetext>Note that the WIP mixed content spec strongly implies that we should fire the XHR&apos;s onerror event when we block it, but it doesn&apos;t actually tell us to do so: it seems to presume that we&apos;re *already* doing it [1]. I couldn&apos;t find a specification for that anywhere, but is seems like the Right Thing.

I have a patch for this in bug #140793, but the patch is old and not completely right: it causes two mixed content warnings to be emitted for just one XHR. I think the spurious one is coming from the CachedResourceLoader. Unfortunately I don&apos;t plan to work on this more in the near future.

[1] http://www.w3.org/TR/mixed-content/#websockets-integration</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1100393</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2015-06-08 09:55:58 -0700</bug_when>
    <thetext>IIRC, Firefox raised an exception from send() in my testing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1141010</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2015-11-10 17:30:48 -0800</bug_when>
    <thetext>I wonder if this was fixed by bug #146706. TODO: test it out!

(In reply to comment #3)
&gt; IIRC, Firefox raised an exception from send() in my testing.

To be clear: the candidate recommendation strongly implies we should fire onerror and not throw an exception:

&quot;These changes together mean that we’ll no longer throw a SecurityError exception directly upon constructing a WebSocket object, but will instead rely upon blocking the connection and triggering the fail the WebSocket connection algorithm, which developers can catch by hooking a WebSocket object’s onerror handler. This is consistent with the behavior of XMLHttpRequest, EventSource, and Fetch.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1191660</commentid>
    <comment_count>5</comment_count>
      <attachid>278532</attachid>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2016-05-10 14:34:48 -0700</bug_when>
    <thetext>Created attachment 278532
test

While playing with HSTS, I came across this.  We call the onreadystatechange with readyState == 1 then readyState == 4 and status 0, then call the onerror.  Chrome and Firefox just call onreadystatechange  with readyState == 1 then stop.  I think our behavior is more correct, but I don&apos;t see it specified anywhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1191713</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-05-10 16:14:25 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; Created attachment 278532 [details]
&gt; test
&gt; 
&gt; While playing with HSTS, I came across this.  We call the onreadystatechange
&gt; with readyState == 1 then readyState == 4 and status 0, then call the
&gt; onerror. 

This seems like desirable behavior, and it&apos;s still implied by the candidate recommendation (see comment #2) that&apos;s being developed by Chrome folks. Alex, I think this is a duplicate of bug #146706, which is now fixed; do you agree?

&gt; Chrome and Firefox just call onreadystatechange  with readyState
&gt; == 1 then stop.  I think our behavior is more correct, but I don&apos;t see it
&gt; specified anywhere.

I guess this was our behavior prior to bug #146706. The old behavior broke YouTube for us with adblocker enabled; YouTube would wait for a horrible timeout before starting to play videos, because it thought the ad was still loading.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1216857</commentid>
    <comment_count>7</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2016-08-03 01:54:19 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; I wonder if this was fixed by bug #146706. TODO: test it out!
&gt; 
&gt; (In reply to comment #3)
&gt; &gt; IIRC, Firefox raised an exception from send() in my testing.
&gt; 
&gt; To be clear: the candidate recommendation strongly implies we should fire
&gt; onerror and not throw an exception:
&gt; 
&gt; &quot;These changes together mean that we’ll no longer throw a SecurityError
&gt; exception directly upon constructing a WebSocket object, but will instead
&gt; rely upon blocking the connection and triggering the fail the WebSocket
&gt; connection algorithm, which developers can catch by hooking a WebSocket
&gt; object’s onerror handler. This is consistent with the behavior of
&gt; XMLHttpRequest, EventSource, and Fetch.&quot;

This is described in https://fetch.spec.whatwg.org/#main-fetch, xhr being based on fetch in xhr.spec.whatwg.org</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1387006</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-01-08 17:09:32 -0800</bug_when>
    <thetext>I think this bug is a duplicate of bug #146706.

*** This bug has been marked as a duplicate of bug 146706 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>278532</attachid>
            <date>2016-05-10 14:34:48 -0700</date>
            <delta_ts>2016-05-10 14:35:33 -0700</delta_ts>
            <desc>test</desc>
            <filename>test.diff</filename>
            <type>text/plain</type>
            <size>2504</size>
            <attacher name="Alex Christensen">achristensen</attacher>
            
              <data encoding="base64">SW5kZXg6IExheW91dFRlc3RzL2h0dHAvdGVzdHMvc2VjdXJpdHkvaHN0cy9iYXNpYy1leHBlY3Rl
ZC50eHQKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PQotLS0gTGF5b3V0VGVzdHMvaHR0cC90ZXN0cy9zZWN1cml0eS9oc3Rz
L2Jhc2ljLWV4cGVjdGVkLnR4dAkocmV2aXNpb24gMCkKKysrIExheW91dFRlc3RzL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