GitHub PullRequestReviewCommentEvent at 2014-03-07 18:46:40
Repository: emscripten
Actor: kripken
Payload: {"comment":{"url":"https://api.github.com/repos/kripken/emscripten/pulls/comments/10394278","id":10394278,"diff_hunk":"@@ -657,8 +657,60 @@ mergeInto(LibraryManager.library, {\n \n     // PROGRESS\n     http.onprogress = function http_onprogress(e) {\n-      var percentComplete = (e.position / e.totalSize)*100;\n-      if (onprogress) Runtime.dynCall('vii', onprogress, [arg, percentComplete]);\n+      if (e.lengthComputable)\n+      {\n+        var percentComplete = (e.position / e.totalSize)*100;\n+        if (onprogress) Runtime.dynCall('vii', onprogress, [arg, percentComplete]);\n+      }\n+    };\n+\n+    // Useful because the browser can limit the number of redirection\n+    try {\n+      if (http.channel instanceof Ci.nsIHttpChannel)\n+      http.channel.redirectionLimit = 0;\n+    } catch (ex) { /* whatever */ }\n+\n+    if (_request == \"POST\") {\n+      //Send the proper header information along with the request\n+      http.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n+      http.setRequestHeader(\"Content-length\", _param.length);\n+      http.setRequestHeader(\"Connection\", \"close\");\n+      http.send(_param);\n+    } else {\n+      http.send(null);\n+    }\n+  },\n+\n+  emscripten_async_wget2_data: function(url, request, param, arg, free, onload, onerror, onprogress) {\n+    var _url = Pointer_stringify(url);\n+    var _request = Pointer_stringify(request);\n+    var _param = Pointer_stringify(param);\n+\n+    var http = new XMLHttpRequest();\n+    http.open(_request, _url, true);\n+    http.responseType = 'arraybuffer';\n+\n+    // LOAD\n+    http.onload = function http_onload(e) {\n+      if (http.status == 200 || _url.substr(0,4).toLowerCase() != \"http\") {\n+        var byteArray = new Uint8Array(http.response);\n+        var buffer = _malloc(byteArray.length);\n+        HEAPU8.set(byteArray, buffer);\n+        if (onload) Runtime.dynCall('viii', onload, [arg, buffer, byteArray.length]);\n+        if (free) _free(buffer);\n+      } else {\n+        if (onerror) Runtime.dynCall('viii', onerror, [arg, http.status, http.statusText]);\n+      }\n+    };\n+\n+    // ERROR\n+    http.onerror = function http_onerror(e) {\n+      if (onerror) Runtime.dynCall('viii', onerror, [arg, http.status, http.statusText]);\n+    };\n+\n+    // PROGRESS\n+    http.onprogress = function http_onprogress(e) {\n+      if (onprogress) Runtime.dynCall('viii', onprogress, [arg, e.loaded, e.lengthComputable ? e.total : 0]);","path":"src/library_browser.js","position":59,"original_position":59,"commit_id":"f13f3bc4d74187915520ed3178b90c49f1b3db6f","original_commit_id":"f13f3bc4d74187915520ed3178b90c49f1b3db6f","user":{"login":"kripken","id":173661,"avatar_url":"https://gravatar.com/avatar/cb9f8cd8da97fa3a92e46ebe576e8050?d=https%3A%2F%2Fidenticons.github.com%2F1281e3a93c7808e67d7544cf0bd3e78c.png&r=x","gravatar_id":"cb9f8cd8da97fa3a92e46ebe576e8050","url":"https://api.github.com/users/kripken","html_url":"https://github.com/kripken","followers_url":"https://api.github.com/users/kripken/followers","following_url":"https://api.github.com/users/kripken/following{/other_user}","gists_url":"https://api.github.com/users/kripken/gists{/gist_id}","starred_url":"https://api.github.com/users/kripken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kripken/subscriptions","organizations_url":"https://api.github.com/users/kripken/orgs","repos_url":"https://api.github.com/users/kripken/repos","events_url":"https://api.github.com/users/kripken/events{/privacy}","received_events_url":"https://api.github.com/users/kripken/received_events","type":"User","site_admin":false},"body":"same issue here","created_at":"2014-03-07T18:46:40Z","updated_at":"2014-03-07T18:46:40Z","html_url":"https://github.com/kripken/emscripten/pull/2180#discussion_r10394278","pull_request_url":"https://api.github.com/repos/kripken/emscripten/pulls/2180","_links":{"self":{"href":"https://api.github.com/repos/kripken/emscripten/pulls/comments/10394278"},"html":{"href":"https://github.com/kripken/emscripten/pull/2180#discussion_r10394278"},"pull_request":{"href":"https://api.github.com/repos/kripken/emscripten/pulls/2180"}}}}