| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2011 Google Inc. All rights reserved. |    2  * Copyright (C) 2011 Google Inc. All rights reserved. | 
|    3  * |    3  * | 
|    4  * Redistribution and use in source and binary forms, with or without |    4  * Redistribution and use in source and binary forms, with or without | 
|    5  * modification, are permitted provided that the following conditions are |    5  * modification, are permitted provided that the following conditions are | 
|    6  * met: |    6  * met: | 
|    7  * |    7  * | 
|    8  *     * Redistributions of source code must retain the above copyright |    8  *     * Redistributions of source code must retain the above copyright | 
|    9  * notice, this list of conditions and the following disclaimer. |    9  * notice, this list of conditions and the following disclaimer. | 
|   10  *     * Redistributions in binary form must reproduce the above |   10  *     * Redistributions in binary form must reproduce the above | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   69   /** |   69   /** | 
|   70    * @param {?string} text |   70    * @param {?string} text | 
|   71    * @return {!Promise<?Network.ParsedJSON>} |   71    * @return {!Promise<?Network.ParsedJSON>} | 
|   72    */ |   72    */ | 
|   73   static parseJSON(text) { |   73   static parseJSON(text) { | 
|   74     var returnObj = null; |   74     var returnObj = null; | 
|   75     if (text) |   75     if (text) | 
|   76       returnObj = Network.JSONView._extractJSON(/** @type {string} */ (text)); |   76       returnObj = Network.JSONView._extractJSON(/** @type {string} */ (text)); | 
|   77     if (!returnObj) |   77     if (!returnObj) | 
|   78       return Promise.resolve(/** @type {?Network.ParsedJSON} */ (null)); |   78       return Promise.resolve(/** @type {?Network.ParsedJSON} */ (null)); | 
|   79     return Common.formatterWorkerPool.runTask('relaxedJSONParser', {content: ret
     urnObj.data}).then(handleReturnedJSON); |   79     return Common.formatterWorkerPool.relaxedJSONParser(returnObj.data).then(han
     dleReturnedJSON); | 
|   80  |   80  | 
|   81     /** |   81     /** | 
|   82      * @param {?MessageEvent} event |   82      * @param {?Object} data | 
|   83      * @return {?Network.ParsedJSON} |   83      * @return {?Network.ParsedJSON} | 
|   84      */ |   84      */ | 
|   85     function handleReturnedJSON(event) { |   85     function handleReturnedJSON(data) { | 
|   86       if (!event || !event.data) |   86       if (!data) | 
|   87         return null; |   87         return null; | 
|   88       returnObj.data = event.data; |   88       returnObj.data = data; | 
|   89       return returnObj; |   89       return returnObj; | 
|   90     } |   90     } | 
|   91   } |   91   } | 
|   92  |   92  | 
|   93   /** |   93   /** | 
|   94    * @param {string} text |   94    * @param {string} text | 
|   95    * @return {?Network.ParsedJSON} |   95    * @return {?Network.ParsedJSON} | 
|   96    */ |   96    */ | 
|   97   static _extractJSON(text) { |   97   static _extractJSON(text) { | 
|   98     // Do not treat HTML as JSON. |   98     // Do not treat HTML as JSON. | 
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  290    * @param {*} data |  290    * @param {*} data | 
|  291    * @param {string} prefix |  291    * @param {string} prefix | 
|  292    * @param {string} suffix |  292    * @param {string} suffix | 
|  293    */ |  293    */ | 
|  294   constructor(data, prefix, suffix) { |  294   constructor(data, prefix, suffix) { | 
|  295     this.data = data; |  295     this.data = data; | 
|  296     this.prefix = prefix; |  296     this.prefix = prefix; | 
|  297     this.suffix = suffix; |  297     this.suffix = suffix; | 
|  298   } |  298   } | 
|  299 }; |  299 }; | 
| OLD | NEW |