<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[214285] trunk/Websites/perf.webkit.org</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/214285">214285</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2017-03-22 16:43:32 -0700 (Wed, 22 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>UploadedFile should support a callback for upload progress
https://bugs.webkit.org/show_bug.cgi?id=169977

Reviewed by Andreas Kling.

Added a new option dictionary to CommonRemoteAPI.sendHttpRequest with uploadProgressCallback

Moved request headers and responseHandler callback in NodeRemoteAPI to this dictionary,
and updated the tests which relied on this code.

* public/shared/common-remote.js:
(CommonRemoteAPI.prototype.postJSON):
(CommonRemoteAPI.prototype.postJSONWithStatus):
(CommonRemoteAPI.prototype.postFormData):
(CommonRemoteAPI.prototype.postFormDataWithStatus):
* public/v3/privileged-api.js:
(PrivilegedAPI.prototype.sendRequest):
* public/v3/remote.js:
(BrowserRemoteAPI.prototype.sendHttpRequest):
(BrowserRemoteAPI.prototype.sendHttpRequestWithFormData):
(BrowserRemoteAPI):
* server-tests/api-uploaded-file.js:
* tools/js/remote.js:
(NodeRemoteAPI.prototype.sendHttpRequest):
(NodeRemoteAPI.prototype.sendHttpRequestWithFormData):
(NodeRemoteAPI):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgChangeLog">trunk/Websites/perf.webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicsharedcommonremotejs">trunk/Websites/perf.webkit.org/public/shared/common-remote.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv3modelsuploadedfilejs">trunk/Websites/perf.webkit.org/public/v3/models/uploaded-file.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv3privilegedapijs">trunk/Websites/perf.webkit.org/public/v3/privileged-api.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv3remotejs">trunk/Websites/perf.webkit.org/public/v3/remote.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapiuploadedfilejs">trunk/Websites/perf.webkit.org/server-tests/api-uploaded-file.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgtoolsjsremotejs">trunk/Websites/perf.webkit.org/tools/js/remote.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebsitesperfwebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/ChangeLog (214284 => 214285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/ChangeLog        2017-03-22 23:21:38 UTC (rev 214284)
+++ trunk/Websites/perf.webkit.org/ChangeLog        2017-03-22 23:43:32 UTC (rev 214285)
</span><span class="lines">@@ -1,5 +1,34 @@
</span><span class="cx"> 2017-03-22  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><ins>+        UploadedFile should support a callback for upload progress
+        https://bugs.webkit.org/show_bug.cgi?id=169977
+
+        Reviewed by Andreas Kling.
+
+        Added a new option dictionary to CommonRemoteAPI.sendHttpRequest with uploadProgressCallback
+
+        Moved request headers and responseHandler callback in NodeRemoteAPI to this dictionary,
+        and updated the tests which relied on this code.
+
+        * public/shared/common-remote.js:
+        (CommonRemoteAPI.prototype.postJSON):
+        (CommonRemoteAPI.prototype.postJSONWithStatus):
+        (CommonRemoteAPI.prototype.postFormData):
+        (CommonRemoteAPI.prototype.postFormDataWithStatus):
+        * public/v3/privileged-api.js:
+        (PrivilegedAPI.prototype.sendRequest):
+        * public/v3/remote.js:
+        (BrowserRemoteAPI.prototype.sendHttpRequest):
+        (BrowserRemoteAPI.prototype.sendHttpRequestWithFormData):
+        (BrowserRemoteAPI):
+        * server-tests/api-uploaded-file.js:
+        * tools/js/remote.js:
+        (NodeRemoteAPI.prototype.sendHttpRequest):
+        (NodeRemoteAPI.prototype.sendHttpRequestWithFormData):
+        (NodeRemoteAPI):
+
+2017-03-22  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
</ins><span class="cx">         ComponentBase should enqueue itself to render when it becomes connected
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=169905
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicsharedcommonremotejs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/shared/common-remote.js (214284 => 214285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/shared/common-remote.js        2017-03-22 23:21:38 UTC (rev 214284)
+++ trunk/Websites/perf.webkit.org/public/shared/common-remote.js        2017-03-22 23:43:32 UTC (rev 214285)
</span><span class="lines">@@ -1,27 +1,27 @@
</span><span class="cx"> &quot;use strict&quot;;
</span><span class="cx"> 
</span><span class="cx"> class CommonRemoteAPI {
</span><del>-    postJSON(path, data)
</del><ins>+    postJSON(path, data, options)
</ins><span class="cx">     {
</span><del>-        return this._asJSON(this.sendHttpRequest(path, 'POST', 'application/json', JSON.stringify(data || {})));
</del><ins>+        return this._asJSON(this.sendHttpRequest(path, 'POST', 'application/json', JSON.stringify(data || {}), options));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    postJSONWithStatus(path, data)
</del><ins>+    postJSONWithStatus(path, data, options)
</ins><span class="cx">     {
</span><del>-        return this._checkStatus(this.postJSON(path, data));
</del><ins>+        return this._checkStatus(this.postJSON(path, data, options));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    postFormData(path, data)
</del><ins>+    postFormData(path, data, options)
</ins><span class="cx">     {
</span><span class="cx">         const formData = new FormData();
</span><span class="cx">         for (let key in data)
</span><span class="cx">             formData.append(key, data[key]);
</span><del>-        return this._asJSON(this.sendHttpRequestWithFormData(path, formData));
</del><ins>+        return this._asJSON(this.sendHttpRequestWithFormData(path, formData, options));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    postFormDataWithStatus(path, data)
</del><ins>+    postFormDataWithStatus(path, data, options)
</ins><span class="cx">     {
</span><del>-        return this._checkStatus(this.postFormData(path, data));
</del><ins>+        return this._checkStatus(this.postFormData(path, data, options));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     getJSON(path)
</span><span class="lines">@@ -34,12 +34,12 @@
</span><span class="cx">         return this._checkStatus(this.getJSON(path));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    sendHttpRequest(path, method, contentType, content)
</del><ins>+    sendHttpRequest(path, method, contentType, content, options = {})
</ins><span class="cx">     {
</span><span class="cx">         throw 'NotImplemented';
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    sendHttpRequestWithFormData(path, formData)
</del><ins>+    sendHttpRequestWithFormData(path, formData, options = {})
</ins><span class="cx">     {
</span><span class="cx">         throw 'NotImplemented';
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv3modelsuploadedfilejs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v3/models/uploaded-file.js (214284 => 214285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v3/models/uploaded-file.js        2017-03-22 23:21:38 UTC (rev 214284)
+++ trunk/Websites/perf.webkit.org/public/v3/models/uploaded-file.js        2017-03-22 23:43:32 UTC (rev 214285)
</span><span class="lines">@@ -12,9 +12,9 @@
</span><span class="cx">         this.ensureNamedStaticMap('sha256')[object.sha256] = this;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static uploadFile(file)
</del><ins>+    static uploadFile(file, uploadProgressCallback = null)
</ins><span class="cx">     {
</span><del>-        return PrivilegedAPI.sendRequest('upload-file', {'newFile': file}, {useFormData: true}).then((rawData) =&gt; {
</del><ins>+        return PrivilegedAPI.sendRequest('upload-file', {'newFile': file}, {useFormData: true, uploadProgressCallback}).then((rawData) =&gt; {
</ins><span class="cx">             return UploadedFile.ensureSingleton(rawData['uploadedFile'].id, rawData['uploadedFile']);
</span><span class="cx">         });
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv3privilegedapijs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v3/privileged-api.js (214284 => 214285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v3/privileged-api.js        2017-03-22 23:21:38 UTC (rev 214284)
+++ trunk/Websites/perf.webkit.org/public/v3/privileged-api.js        2017-03-22 23:43:32 UTC (rev 214285)
</span><span class="lines">@@ -10,8 +10,8 @@
</span><span class="cx"> 
</span><span class="cx">         const fullPath = '/privileged-api/' + path;
</span><span class="cx">         const post = options.useFormData
</span><del>-            ? () =&gt; RemoteAPI.postFormDataWithStatus(fullPath, clonedData)
-            : () =&gt; RemoteAPI.postJSONWithStatus(fullPath, clonedData);
</del><ins>+            ? () =&gt; RemoteAPI.postFormDataWithStatus(fullPath, clonedData, options)
+            : () =&gt; RemoteAPI.postJSONWithStatus(fullPath, clonedData, options);
</ins><span class="cx"> 
</span><span class="cx">         return this.requestCSRFToken().then((token) =&gt; {
</span><span class="cx">             clonedData['token'] = token;
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv3remotejs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v3/remote.js (214284 => 214285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v3/remote.js        2017-03-22 23:21:38 UTC (rev 214284)
+++ trunk/Websites/perf.webkit.org/public/v3/remote.js        2017-03-22 23:43:32 UTC (rev 214285)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> 
</span><span class="cx"> class BrowserRemoteAPI extends CommonRemoteAPI {
</span><span class="cx"> 
</span><del>-    sendHttpRequest(path, method, contentType, content)
</del><ins>+    sendHttpRequest(path, method, contentType, content, options = {})
</ins><span class="cx">     {
</span><span class="cx">         console.assert(!path.startsWith('http:') &amp;&amp; !path.startsWith('https:') &amp;&amp; !path.startsWith('file:'));
</span><span class="cx"> 
</span><span class="lines">@@ -26,6 +26,12 @@
</span><span class="cx">             xhr.onabort = onerror;
</span><span class="cx">             xhr.onerror = onerror;
</span><span class="cx"> 
</span><ins>+            if (content &amp;&amp; options.uploadProgressCallback) {
+                xhr.upload.onprogress = (event) =&gt; {
+                    options.uploadProgressCallback(event.lengthComputable ? {total: event.total, loaded: event.loaded} : null);
+                }
+            }
+
</ins><span class="cx">             xhr.open(method, path, true);
</span><span class="cx">             if (contentType)
</span><span class="cx">                 xhr.setRequestHeader('Content-Type', contentType);
</span><span class="lines">@@ -36,9 +42,9 @@
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    sendHttpRequestWithFormData(path, formData)
</del><ins>+    sendHttpRequestWithFormData(path, formData, options)
</ins><span class="cx">     {
</span><del>-        return this.sendHttpRequest(path, 'POST', null, formData); // Content-type is set by the browser.
</del><ins>+        return this.sendHttpRequest(path, 'POST', null, formData, options); // Content-type is set by the browser.
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapiuploadedfilejs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-uploaded-file.js (214284 => 214285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-uploaded-file.js        2017-03-22 23:21:38 UTC (rev 214284)
+++ trunk/Websites/perf.webkit.org/server-tests/api-uploaded-file.js        2017-03-22 23:43:32 UTC (rev 214285)
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">             return PrivilegedAPI.sendRequest('upload-file', {newFile: stream}, {useFormData: true});
</span><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const id = response['uploadedFile']['id'];
</span><del>-            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {'Range': 'bytes=5-'});
</del><ins>+            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {headers: {'Range': 'bytes=5-'}});
</ins><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const headers = response.headers;
</span><span class="cx">             assert.equal(response.statusCode, 206);
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx">             return PrivilegedAPI.sendRequest('upload-file', {newFile: stream}, {useFormData: true});
</span><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const id = response['uploadedFile']['id'];
</span><del>-            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {'Range': 'bytes=4-9'});
</del><ins>+            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {headers: {'Range': 'bytes=4-9'}});
</ins><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const headers = response.headers;
</span><span class="cx">             assert.equal(response.statusCode, 206);
</span><span class="lines">@@ -166,7 +166,7 @@
</span><span class="cx">             return PrivilegedAPI.sendRequest('upload-file', {newFile: stream}, {useFormData: true});
</span><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const id = response['uploadedFile']['id'];
</span><del>-            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {'Range': 'bytes=-4'});
</del><ins>+            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {headers: {'Range': 'bytes=-4'}});
</ins><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const headers = response.headers;
</span><span class="cx">             assert.equal(response.statusCode, 206);
</span><span class="lines">@@ -180,7 +180,7 @@
</span><span class="cx">             return PrivilegedAPI.sendRequest('upload-file', {newFile: stream}, {useFormData: true});
</span><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const id = response['uploadedFile']['id'];
</span><del>-            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {'Range': 'bytes=-100'});
</del><ins>+            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {headers: {'Range': 'bytes=-100'}});
</ins><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const headers = response.headers;
</span><span class="cx">             assert.equal(response.statusCode, 206);
</span><span class="lines">@@ -194,7 +194,7 @@
</span><span class="cx">             return PrivilegedAPI.sendRequest('upload-file', {newFile: stream}, {useFormData: true});
</span><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const id = response['uploadedFile']['id'];
</span><del>-            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {'Range': 'bytes=12-'})
</del><ins>+            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {headers: {'Range': 'bytes=12-'}})
</ins><span class="cx">                 .then(() =&gt; assert(false, 'should never be reached'), (error) =&gt; assert.equal(error, 416));
</span><span class="cx">         });
</span><span class="cx">     });
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx">             return PrivilegedAPI.sendRequest('upload-file', {newFile: stream}, {useFormData: true});
</span><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const id = response['uploadedFile']['id'];
</span><del>-            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {'Range': 'bytes=2-1'})
</del><ins>+            return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null, {headers: {'Range': 'bytes=2-1'}})
</ins><span class="cx">                 .then(() =&gt; assert(false, 'should never be reached'), (error) =&gt; assert.equal(error, 416));
</span><span class="cx">         });
</span><span class="cx">     });
</span><span class="lines">@@ -220,7 +220,7 @@
</span><span class="cx">             assert.equal(response.statusCode, 200);
</span><span class="cx">             assert.equal(response.responseText, 'some content');
</span><span class="cx">             return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null,
</span><del>-                {'Range': 'bytes = 9-10', 'If-Range': response.headers['last-modified']});
</del><ins>+                {headers: {'Range': 'bytes = 9-10', 'If-Range': response.headers['last-modified']}});
</ins><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const headers = response.headers;
</span><span class="cx">             assert.equal(response.statusCode, 206);
</span><span class="lines">@@ -240,7 +240,7 @@
</span><span class="cx">             assert.equal(response.statusCode, 200);
</span><span class="cx">             assert.equal(response.responseText, 'some content');
</span><span class="cx">             return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null,
</span><del>-                {'Range': 'bytes = 9-10', 'If-Range': response.headers['etag']});
</del><ins>+                {headers: {'Range': 'bytes = 9-10', 'If-Range': response.headers['etag']}});
</ins><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const headers = response.headers;
</span><span class="cx">             assert.equal(response.statusCode, 206);
</span><span class="lines">@@ -297,7 +297,7 @@
</span><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             id = response['uploadedFile']['id'];
</span><span class="cx">             return TestServer.remoteAPI().sendHttpRequest(`/api/uploaded-file/${id}`, 'GET', null, null,
</span><del>-                {'Range': `bytes = ${startByte}-${endByte}`}, responseHandler);
</del><ins>+                {headers: {'Range': `bytes = ${startByte}-${endByte}`}, responseHandler});
</ins><span class="cx">         }).then((response) =&gt; {
</span><span class="cx">             const headers = response.headers;
</span><span class="cx">             assert.equal(response.statusCode, 206);
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgtoolsjsremotejs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/tools/js/remote.js (214284 => 214285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/tools/js/remote.js        2017-03-22 23:21:38 UTC (rev 214284)
+++ trunk/Websites/perf.webkit.org/tools/js/remote.js        2017-03-22 23:43:32 UTC (rev 214285)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    sendHttpRequest(path, method, contentType, content, headers = {}, responseHandler = null)
</del><ins>+    sendHttpRequest(path, method, contentType, content, requestOptions = {})
</ins><span class="cx">     {
</span><span class="cx">         let server = this._server;
</span><span class="cx">         return new Promise((resolve, reject) =&gt; {
</span><span class="lines">@@ -78,8 +78,8 @@
</span><span class="cx"> 
</span><span class="cx">             let request = (server.scheme == 'http' ? http : https).request(options, (response) =&gt; {
</span><span class="cx">                 let responseText = '';
</span><del>-                if (responseHandler)
-                    responseHandler(response);
</del><ins>+                if (requestOptions.responseHandler)
+                    requestOptions.responseHandler(response);
</ins><span class="cx">                 else {
</span><span class="cx">                     response.setEncoding('utf8');
</span><span class="cx">                     response.on('data', (chunk) =&gt; { responseText += chunk; });
</span><span class="lines">@@ -106,8 +106,11 @@
</span><span class="cx">             if (this._cookies.size)
</span><span class="cx">                 request.setHeader('Cookie', Array.from(this._cookies.keys()).map((key) =&gt; `${key}=${this._cookies.get(key)}`).join('; '));
</span><span class="cx"> 
</span><del>-            for (let headerName in headers)
-                request.setHeader(headerName, headers[headerName]);
</del><ins>+            if (requestOptions.headers) {
+                const requestHeaders = requestOptions.headers;
+                for (let headerName in requestHeaders)
+                    request.setHeader(headerName, requestHeaders[headerName]);
+            }
</ins><span class="cx"> 
</span><span class="cx">             if (content instanceof Function)
</span><span class="cx">                 content(request);
</span><span class="lines">@@ -119,11 +122,11 @@
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    sendHttpRequestWithFormData(path, formData)
</del><ins>+    sendHttpRequestWithFormData(path, formData, options)
</ins><span class="cx">     {
</span><span class="cx">         return this.sendHttpRequest(path, 'POST', `multipart/form-data; boundary=${formData.getBoundary()}`, (request) =&gt; {
</span><span class="cx">             formData.pipe(request);
</span><del>-        });
</del><ins>+        }, options);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>