| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 450 } |
| 451 | 451 |
| 452 /** | 452 /** |
| 453 * @param {string} domain | 453 * @param {string} domain |
| 454 * @param {string} methodName | 454 * @param {string} methodName |
| 455 * @param {function(*)} callback | 455 * @param {function(*)} callback |
| 456 */ | 456 */ |
| 457 _dispatchConnectionErrorResponse(domain, methodName, callback) { | 457 _dispatchConnectionErrorResponse(domain, methodName, callback) { |
| 458 var error = { | 458 var error = { |
| 459 message: 'Connection is closed, can\'t dispatch pending ' + methodName, | 459 message: 'Connection is closed, can\'t dispatch pending ' + methodName, |
| 460 code: InspectorBackendClass._DevToolsErrorCode, | 460 code: InspectorBackendClass._ConnectionClosedErrorCode, |
| 461 data: null | 461 data: null |
| 462 }; | 462 }; |
| 463 var messageObject = {error: error}; | 463 var messageObject = {error: error}; |
| 464 setTimeout( | 464 setTimeout( |
| 465 InspectorBackendClass._AgentPrototype.prototype.dispatchResponse.bind( | 465 InspectorBackendClass._AgentPrototype.prototype.dispatchResponse.bind( |
| 466 this._agent(domain), messageObject, methodName, callback), | 466 this._agent(domain), messageObject, methodName, callback), |
| 467 0); | 467 0); |
| 468 } | 468 } |
| 469 }; | 469 }; |
| 470 | 470 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 _invoke(method, args, callback) { | 627 _invoke(method, args, callback) { |
| 628 this._target._wrapCallbackAndSendMessageObject(this._domain, method, args, c
allback); | 628 this._target._wrapCallbackAndSendMessageObject(this._domain, method, args, c
allback); |
| 629 } | 629 } |
| 630 | 630 |
| 631 /** | 631 /** |
| 632 * @param {!Object} messageObject | 632 * @param {!Object} messageObject |
| 633 * @param {string} methodName | 633 * @param {string} methodName |
| 634 * @param {function(*)|function(?Protocol.Error, ?Object)} callback | 634 * @param {function(*)|function(?Protocol.Error, ?Object)} callback |
| 635 */ | 635 */ |
| 636 dispatchResponse(messageObject, methodName, callback) { | 636 dispatchResponse(messageObject, methodName, callback) { |
| 637 if (messageObject.error && messageObject.error.code !== InspectorBackendClas
s._DevToolsErrorCode && | 637 if (messageObject.error && messageObject.error.code !== InspectorBackendClas
s._ConnectionClosedErrorCode && |
| 638 messageObject.error.code !== InspectorBackendClass.DevToolsStubErrorCode
&& | 638 messageObject.error.code !== InspectorBackendClass.DevToolsStubErrorCode
&& |
| 639 !InspectorBackendClass.Options.suppressRequestErrors) { | 639 !InspectorBackendClass.Options.suppressRequestErrors) { |
| 640 var id = InspectorBackendClass.Options.dumpInspectorProtocolMessages ? ' w
ith id = ' + messageObject.id : ''; | 640 var id = InspectorBackendClass.Options.dumpInspectorProtocolMessages ? ' w
ith id = ' + messageObject.id : ''; |
| 641 console.error('Request ' + methodName + id + ' failed. ' + JSON.stringify(
messageObject.error)); | 641 console.error('Request ' + methodName + id + ' failed. ' + JSON.stringify(
messageObject.error)); |
| 642 } | 642 } |
| 643 | 643 |
| 644 var argumentsArray = []; | 644 var argumentsArray = []; |
| 645 argumentsArray[0] = messageObject.error ? messageObject.error.message : null
; | 645 argumentsArray[0] = messageObject.error ? messageObject.error.message : null
; |
| 646 | 646 |
| 647 if (this._hasErrorData[methodName]) | 647 if (this._hasErrorData[methodName]) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 if (InspectorBackendClass.Options.dumpInspectorTimeStats) | 719 if (InspectorBackendClass.Options.dumpInspectorTimeStats) |
| 720 console.timeEnd(timingLabel); | 720 console.timeEnd(timingLabel); |
| 721 } | 721 } |
| 722 }; | 722 }; |
| 723 | 723 |
| 724 InspectorBackendClass.Options = { | 724 InspectorBackendClass.Options = { |
| 725 dumpInspectorTimeStats: false, | 725 dumpInspectorTimeStats: false, |
| 726 dumpInspectorProtocolMessages: false, | 726 dumpInspectorProtocolMessages: false, |
| 727 suppressRequestErrors: false | 727 suppressRequestErrors: false |
| 728 }; | 728 }; |
| OLD | NEW |