OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /* eslint-disable indent */ | 5 /* eslint-disable indent */ |
6 (function(window) { | 6 (function(window) { |
7 | 7 |
8 // DevToolsAPI ---------------------------------------------------------------- | 8 // DevToolsAPI ---------------------------------------------------------------- |
9 | 9 |
10 /** | 10 /** |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 * @param {string} panelName | 296 * @param {string} panelName |
297 */ | 297 */ |
298 showPanel: function(panelName) | 298 showPanel: function(panelName) |
299 { | 299 { |
300 this._dispatchOnInspectorFrontendAPI("showPanel", [panelName]); | 300 this._dispatchOnInspectorFrontendAPI("showPanel", [panelName]); |
301 }, | 301 }, |
302 | 302 |
303 /** | 303 /** |
304 * @param {number} id | 304 * @param {number} id |
305 * @param {string} chunk | 305 * @param {string} chunk |
| 306 * @param {boolean} encoded |
306 */ | 307 */ |
307 streamWrite: function(id, chunk) | 308 streamWrite: function(id, chunk, encoded) |
308 { | 309 { |
309 this._dispatchOnInspectorFrontendAPI("streamWrite", [id, chunk]); | 310 this._dispatchOnInspectorFrontendAPI("streamWrite", [id, encoded ? this.
_decodeBase64(chunk) : chunk]); |
| 311 }, |
| 312 |
| 313 /** |
| 314 * @param {string} chunk |
| 315 * @return {string} |
| 316 */ |
| 317 _decodeBase64: function(chunk) |
| 318 { |
| 319 var request = new XMLHttpRequest(); |
| 320 request.open("GET", "data:text/plain;base64," + chunk, false); |
| 321 request.send(null); |
| 322 if (request.status === 200) { |
| 323 return request.responseText; |
| 324 } else { |
| 325 console.error("Error while decoding chunk in streamWrite"); |
| 326 return ""; |
| 327 } |
310 } | 328 } |
311 } | 329 } |
312 | 330 |
313 var DevToolsAPI = new DevToolsAPIImpl(); | 331 var DevToolsAPI = new DevToolsAPIImpl(); |
314 window.DevToolsAPI = DevToolsAPI; | 332 window.DevToolsAPI = DevToolsAPI; |
315 | 333 |
316 // InspectorFrontendHostImpl -------------------------------------------------- | 334 // InspectorFrontendHostImpl -------------------------------------------------- |
317 | 335 |
318 /** | 336 /** |
319 * @constructor | 337 * @constructor |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 | 1071 |
1054 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { | 1072 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { |
1055 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype
.toggle; | 1073 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype
.toggle; |
1056 DOMTokenList.prototype.toggle = function(token, force) | 1074 DOMTokenList.prototype.toggle = function(token, force) |
1057 { | 1075 { |
1058 if (arguments.length === 1) | 1076 if (arguments.length === 1) |
1059 force = !this.contains(token); | 1077 force = !this.contains(token); |
1060 return this.__originalDOMTokenListToggle(token, !!force); | 1078 return this.__originalDOMTokenListToggle(token, !!force); |
1061 } | 1079 } |
1062 } | 1080 } |
OLD | NEW |