* This function is called by the iframe after it sends the log to the server. * @param {../proto/api_messages.Message=} message
(message)
| 8092 | * @param {../proto/api_messages.Message=} message |
| 8093 | */ |
| 8094 | afterLogging_(message) { |
| 8095 | const response = /** @type {!FinishedLoggingResponse} */ (message); |
| 8096 | const success = (response && response.getComplete()) || false; |
| 8097 | const error = (response && response.getError()) || 'Unknown logging Error'; |
| 8098 | const isTimeout = error === TIMEOUT_ERROR; |
| 8099 | |
| 8100 | if (!success) { |
| 8101 | log('Error when logging: ' + error); |
| 8102 | } |
| 8103 | |
| 8104 | this.unfinishedLogs_--; |
| 8105 | if (!isTimeout) { |
| 8106 | this.everFinishedLog_ = true; |
| 8107 | } |
| 8108 | |
| 8109 | // Nothing is waiting |
| 8110 | if (this.loggingResolver_ === null) { |
| 8111 | return; |
| 8112 | } |
| 8113 | |
| 8114 | if (this.unfinishedLogs_ === 0 || this.loggingBroken_ || isTimeout) { |
| 8115 | if (this.timeout_ !== null) { |
| 8116 | clearTimeout(this.timeout_); |
| 8117 | this.timeout_ = null; |
| 8118 | } |
| 8119 | this.loggingResolver_(success); |
| 8120 | this.promiseToLog_ = null; |
| 8121 | this.loggingResolver_ = null; |
| 8122 | } |
| 8123 | } |
| 8124 | |
| 8125 | /** |
| 8126 | * Please note that logs sent after getLoggingPromise is called are not |
no test coverage detected