Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Provides a way to implement POST requests via XMLHttpRequest. | 5 // Provides a way to implement POST requests via XMLHttpRequest. |
| 6 // Works around https://bugs.webkit.org/show_bug.cgi?id=145410 on WKWebView. | 6 // Works around https://bugs.webkit.org/show_bug.cgi?id=145410 on WKWebView. |
| 7 | 7 |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 goog.provide('__crPostRequestWorkaround'); | 10 goog.provide('__crPostRequestWorkaround'); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 request.send(blob); | 69 request.send(blob); |
| 70 if (request.status != 200) { | 70 if (request.status != 200) { |
| 71 throw request.status; | 71 throw request.status; |
| 72 } | 72 } |
| 73 return request.responseText; | 73 return request.responseText; |
| 74 } | 74 } |
| 75 | 75 |
| 76 document.open(); | 76 document.open(); |
| 77 try { | 77 try { |
| 78 document.write(createAndSendPostRequest(url, headers, body, contentType)); | 78 document.write(createAndSendPostRequest(url, headers, body, contentType)); |
| 79 window.webkit.messageHandlers.POSTSuccessHandler.postMessage(""); | 79 window.webkit.messageHandlers['POSTSuccessHandler'].postMessage(""); |
|
dpapad
2016/10/26 17:05:24
Can you add externs definitions for those? Then yo
Eugene But (OOO till 7-30)
2016/10/26 17:54:45
I would prefer not to. messageHandlers is an objec
dpapad
2016/10/26 18:18:35
It is a tradeoff between inconvenience and better
Eugene But (OOO till 7-30)
2016/10/26 20:58:53
Acknowledged.
| |
| 80 } catch(error) { | 80 } catch(error) { |
| 81 window.webkit.messageHandlers.POSTErrorHandler.postMessage(error); | 81 window.webkit.messageHandlers['POSTErrorHandler'].postMessage(error); |
| 82 } | 82 } |
| 83 document.close(); | 83 document.close(); |
| 84 } | 84 } |
| OLD | NEW |