Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Issue 945033002: Updated XHR API so call sites are more descriptive. (Closed)

Created:
5 years, 10 months ago by John Williams
Modified:
5 years, 9 months ago
Reviewers:
Jamie
CC:
chromium-reviews, chromoting-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@xhr-test
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Updated XHR API so call sites are more descriptive. This CL mainly converts from using positional parameters to a single struct, but there are various other changes as well. The functions corresponding to different HTTP methods have been eliminated, and the "doMethod" function has been renamed "start". Saving one parameter at each call site seemed like a poor tradeoff for having four functions that differ only in the HTTP method they use. The core logic of creating an XHR and arranging for the onDone function to be called has been factored out into a separate function, startInternal_. The "parameters" argument has been replaced by separate urlParams and content arguments. This eliminates the need to heuristically decide what to do with the parmameters based on the HTTP method, and it allows URL parameters and body content to be included in the same call, a case which occurs in practice in host_controller.js. There are now three parameters for sepecifying different types of body content: textContent, formContent, and jsonContent. They have different data types, and the formContent and jsonContent parameters implicitly set the Content-type header to the correct value. A new parameter, oauthToken, is a convenience for adding a correctly-formatted Authorization header. This formatting was previously duplicated at five seperate call sites. The string "OAuth" in Authorization headers has been replaced with "Bearer". The OAuth 2 spec supports the use of "Bearer" but not "OAuth". There are no longer any instances where headers are specified explicitly, but the ability to do so still exists in the API. Finally, headers and urlParameters with the value null are accepted but not included in the HTTP request. This simplifies the logic of the doRegisterHost function in host_controller.js. BUG= Committed: https://crrev.com/b6a2d047d85499cc95b1d203a073c270a149ecbf Cr-Commit-Position: refs/heads/master@{#318151}

Patch Set 1 #

Total comments: 10

Patch Set 2 : Requested changes. #

Patch Set 3 : Reparented branch. #

Patch Set 4 : #

Patch Set 5 : Promise API for XHR. #

Patch Set 6 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+585 lines, -416 lines) Patch
M remoting/webapp/crd/js/dns_blackhole_checker.js View 1 2 3 4 5 4 chunks +11 lines, -11 lines 0 comments Download
M remoting/webapp/crd/js/host_controller.js View 1 2 3 4 3 chunks +8 lines, -9 lines 0 comments Download
M remoting/webapp/crd/js/host_list_api_impl.js View 1 2 3 4 5 chunks +12 lines, -15 lines 0 comments Download
M remoting/webapp/crd/js/oauth2.js View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M remoting/webapp/crd/js/oauth2_api_impl.js View 1 2 3 4 6 chunks +36 lines, -40 lines 0 comments Download
M remoting/webapp/crd/js/session_connector_impl.js View 1 2 3 4 5 2 chunks +3 lines, -1 line 0 comments Download
M remoting/webapp/crd/js/third_party_token_fetcher.js View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M remoting/webapp/crd/js/xhr.js View 1 2 3 4 5 5 chunks +203 lines, -112 lines 0 comments Download
M remoting/webapp/js_proto/qunit_proto.js View 1 2 3 4 5 3 chunks +25 lines, -3 lines 0 comments Download
M remoting/webapp/unittests/dns_blackhole_checker_unittest.js View 1 2 3 4 2 chunks +148 lines, -90 lines 0 comments Download
M remoting/webapp/unittests/xhr_unittest.js View 1 2 3 4 1 chunk +137 lines, -133 lines 0 comments Download

Messages

Total messages: 24 (11 generated)
John Williams
This is a rewrite of the XHR changes I had in my GCD support CL. ...
5 years, 10 months ago (2015-02-21 00:22:45 UTC) #2
Jamie
https://codereview.chromium.org/945033002/diff/1/remoting/webapp/crd/js/host_controller.js File remoting/webapp/crd/js/host_controller.js (left): https://codereview.chromium.org/945033002/diff/1/remoting/webapp/crd/js/host_controller.js#oldcode290 remoting/webapp/crd/js/host_controller.js:290: if (hostClientId) { You've deleted this conditional. Was that ...
5 years, 10 months ago (2015-02-21 01:35:48 UTC) #3
John Williams
https://codereview.chromium.org/945033002/diff/1/remoting/webapp/crd/js/host_controller.js File remoting/webapp/crd/js/host_controller.js (left): https://codereview.chromium.org/945033002/diff/1/remoting/webapp/crd/js/host_controller.js#oldcode290 remoting/webapp/crd/js/host_controller.js:290: if (hostClientId) { On 2015/02/21 01:35:48, Jamie wrote: > ...
5 years, 10 months ago (2015-02-23 23:00:55 UTC) #4
Jamie
lgtm
5 years, 10 months ago (2015-02-23 23:15:54 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/945033002/20001
5 years, 10 months ago (2015-02-24 01:34:16 UTC) #7
commit-bot: I haz the power
Try jobs failed on following builders: android_aosp on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_aosp/builds/61368)
5 years, 10 months ago (2015-02-24 01:39:53 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/945033002/20001
5 years, 10 months ago (2015-02-24 03:35:43 UTC) #11
commit-bot: I haz the power
Try jobs failed on following builders: android_aosp on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_aosp/builds/61410)
5 years, 10 months ago (2015-02-24 03:40:51 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/945033002/40001
5 years, 10 months ago (2015-02-24 18:48:43 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/28828)
5 years, 10 months ago (2015-02-24 22:32:13 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/945033002/60001
5 years, 10 months ago (2015-02-25 23:07:58 UTC) #22
commit-bot: I haz the power
Committed patchset #4 (id:60001)
5 years, 10 months ago (2015-02-26 00:04:21 UTC) #23
commit-bot: I haz the power
5 years, 10 months ago (2015-02-26 00:05:17 UTC) #24
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/b6a2d047d85499cc95b1d203a073c270a149ecbf
Cr-Commit-Position: refs/heads/master@{#318151}

Powered by Google App Engine
This is Rietveld 408576698