| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 if (constructor) | 169 if (constructor) |
| 170 clientCallback(new constructor(value)); | 170 clientCallback(new constructor(value)); |
| 171 else | 171 else |
| 172 clientCallback(value); | 172 clientCallback(value); |
| 173 } | 173 } |
| 174 return callbackWrapper; | 174 return callbackWrapper; |
| 175 } | 175 } |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 InspectorBackendClass._DevToolsErrorCode = -32000; | 178 InspectorBackendClass._ConnectionClosedErrorCode = -32000; |
| 179 InspectorBackendClass.DevToolsStubErrorCode = -32015; | 179 InspectorBackendClass.DevToolsStubErrorCode = -32015; |
| 180 | 180 |
| 181 | 181 |
| 182 var InspectorBackend = new InspectorBackendClass(); | 182 var InspectorBackend = new InspectorBackendClass(); |
| 183 | 183 |
| 184 /** | 184 /** |
| 185 * @interface | 185 * @interface |
| 186 */ | 186 */ |
| 187 InspectorBackendClass.Connection = function() {}; | 187 InspectorBackendClass.Connection = function() {}; |
| 188 | 188 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 453 } |
| 454 | 454 |
| 455 /** | 455 /** |
| 456 * @param {string} domain | 456 * @param {string} domain |
| 457 * @param {string} methodName | 457 * @param {string} methodName |
| 458 * @param {function(*)} callback | 458 * @param {function(*)} callback |
| 459 */ | 459 */ |
| 460 _dispatchConnectionErrorResponse(domain, methodName, callback) { | 460 _dispatchConnectionErrorResponse(domain, methodName, callback) { |
| 461 var error = { | 461 var error = { |
| 462 message: 'Connection is closed, can\'t dispatch pending ' + methodName, | 462 message: 'Connection is closed, can\'t dispatch pending ' + methodName, |
| 463 code: InspectorBackendClass._DevToolsErrorCode, | 463 code: InspectorBackendClass._ConnectionClosedErrorCode, |
| 464 data: null | 464 data: null |
| 465 }; | 465 }; |
| 466 var messageObject = {error: error}; | 466 var messageObject = {error: error}; |
| 467 setTimeout( | 467 setTimeout( |
| 468 InspectorBackendClass._AgentPrototype.prototype.dispatchResponse.bind( | 468 InspectorBackendClass._AgentPrototype.prototype.dispatchResponse.bind( |
| 469 this._agent(domain), messageObject, methodName, callback), | 469 this._agent(domain), messageObject, methodName, callback), |
| 470 0); | 470 0); |
| 471 } | 471 } |
| 472 }; | 472 }; |
| 473 | 473 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 _invoke(method, args, callback) { | 630 _invoke(method, args, callback) { |
| 631 this._target._wrapCallbackAndSendMessageObject(this._domain, method, args, c
allback); | 631 this._target._wrapCallbackAndSendMessageObject(this._domain, method, args, c
allback); |
| 632 } | 632 } |
| 633 | 633 |
| 634 /** | 634 /** |
| 635 * @param {!Object} messageObject | 635 * @param {!Object} messageObject |
| 636 * @param {string} methodName | 636 * @param {string} methodName |
| 637 * @param {function(*)|function(?Protocol.Error, ?Object)} callback | 637 * @param {function(*)|function(?Protocol.Error, ?Object)} callback |
| 638 */ | 638 */ |
| 639 dispatchResponse(messageObject, methodName, callback) { | 639 dispatchResponse(messageObject, methodName, callback) { |
| 640 if (messageObject.error && messageObject.error.code !== InspectorBackendClas
s._DevToolsErrorCode && | 640 if (messageObject.error && messageObject.error.code !== InspectorBackendClas
s._ConnectionClosedErrorCode && |
| 641 messageObject.error.code !== InspectorBackendClass.DevToolsStubErrorCode
&& | 641 messageObject.error.code !== InspectorBackendClass.DevToolsStubErrorCode
&& |
| 642 !InspectorBackendClass.Options.suppressRequestErrors) { | 642 !InspectorBackendClass.Options.suppressRequestErrors) { |
| 643 var id = InspectorBackendClass.Options.dumpInspectorProtocolMessages ? ' w
ith id = ' + messageObject.id : ''; | 643 var id = InspectorBackendClass.Options.dumpInspectorProtocolMessages ? ' w
ith id = ' + messageObject.id : ''; |
| 644 console.error('Request ' + methodName + id + ' failed. ' + JSON.stringify(
messageObject.error)); | 644 console.error('Request ' + methodName + id + ' failed. ' + JSON.stringify(
messageObject.error)); |
| 645 } | 645 } |
| 646 | 646 |
| 647 var argumentsArray = []; | 647 var argumentsArray = []; |
| 648 argumentsArray[0] = messageObject.error ? messageObject.error.message : null
; | 648 argumentsArray[0] = messageObject.error ? messageObject.error.message : null
; |
| 649 | 649 |
| 650 if (this._hasErrorData[methodName]) | 650 if (this._hasErrorData[methodName]) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 if (InspectorBackendClass.Options.dumpInspectorTimeStats) | 722 if (InspectorBackendClass.Options.dumpInspectorTimeStats) |
| 723 console.log('time-stats: ' + messageObject.method + ' = ' + (Date.now() -
processingStartTime)); | 723 console.log('time-stats: ' + messageObject.method + ' = ' + (Date.now() -
processingStartTime)); |
| 724 } | 724 } |
| 725 }; | 725 }; |
| 726 | 726 |
| 727 InspectorBackendClass.Options = { | 727 InspectorBackendClass.Options = { |
| 728 dumpInspectorTimeStats: false, | 728 dumpInspectorTimeStats: false, |
| 729 dumpInspectorProtocolMessages: false, | 729 dumpInspectorProtocolMessages: false, |
| 730 suppressRequestErrors: false | 730 suppressRequestErrors: false |
| 731 }; | 731 }; |
| OLD | NEW |