<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - WKWebView and WebView no longer allow async XMLHttpRequest timeout to exceed 60 seconds"
   href="https://bugs.webkit.org/show_bug.cgi?id=163814">163814</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>WKWebView and WebView no longer allow async XMLHttpRequest timeout to exceed 60 seconds
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>macOS 10.12
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>WebCore JavaScript
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dasau&#64;microsoft.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>WKWebView and WebView control do not allow XMLHttpRequest timeout to be greater than 60 seconds. The below code can repro, this was not an issue with the version of WebKit that was shipped in OSX 10.11.5, but it does not work in 10.12.1.
var xhr = new XMLHttpRequest();
var startTime = new Date();
xhr.open('GET', url, true);

xhr.timeout = 120000; // time in milliseconds

xhr.onload = function () {
};

xhr.ontimeout = function (e) {
  console.error((new Date() - startTime) + &quot; milliseconds timeout.&quot;); // 60000 milliseconds timeout.
};

xhr.send(null);


I believe the relevant code in WebKit is below, for asynchronous requests m_timeoutInterval is not getting set so it is using NSUrlRequest default timeoutInterval of 60 seconds.

XMLHttpRequest::createRequest(ExceptionCode&amp; ec)

    if (m_timeoutMilliseconds) {
        if (!m_async)
            request.setTimeoutInterval(m_timeoutMilliseconds / 1000.0);
        else {
            m_sendingTime = std::chrono::steady_clock::now();
            m_timeoutTimer.startOneShot(std::chrono::milliseconds { m_timeoutMilliseconds });
        }
    }

ResourceRequest::doUpdatePlatformRequest

    double timeoutInterval = ResourceRequestBase::timeoutInterval();
    if (timeoutInterval)
        [nsRequest setTimeoutInterval:timeoutInterval];</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>