| 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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 /** | 1007 /** |
| 1008 * @param {string} code | 1008 * @param {string} code |
| 1009 * @param {string} description | 1009 * @param {string} description |
| 1010 * @return {!Extensions.ExtensionStatus.Record} | 1010 * @return {!Extensions.ExtensionStatus.Record} |
| 1011 */ | 1011 */ |
| 1012 function makeStatus(code, description) { | 1012 function makeStatus(code, description) { |
| 1013 var details = Array.prototype.slice.call(arguments, 2); | 1013 var details = Array.prototype.slice.call(arguments, 2); |
| 1014 var status = {code: code, description: description, details: details}; | 1014 var status = {code: code, description: description, details: details}; |
| 1015 if (code !== 'OK') { | 1015 if (code !== 'OK') { |
| 1016 status.isError = true; | 1016 status.isError = true; |
| 1017 console.log('Extension server error: ' + String.vsprintf(description, de
tails)); | 1017 console.error('Extension server error: ' + String.vsprintf(description,
details)); |
| 1018 } | 1018 } |
| 1019 return status; | 1019 return status; |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 this.OK = makeStatus.bind(null, 'OK', 'OK'); | 1022 this.OK = makeStatus.bind(null, 'OK', 'OK'); |
| 1023 this.E_EXISTS = makeStatus.bind(null, 'E_EXISTS', 'Object already exists: %s
'); | 1023 this.E_EXISTS = makeStatus.bind(null, 'E_EXISTS', 'Object already exists: %s
'); |
| 1024 this.E_BADARG = makeStatus.bind(null, 'E_BADARG', 'Invalid argument %s: %s')
; | 1024 this.E_BADARG = makeStatus.bind(null, 'E_BADARG', 'Invalid argument %s: %s')
; |
| 1025 this.E_BADARGTYPE = makeStatus.bind(null, 'E_BADARGTYPE', 'Invalid type for
argument %s: got %s, expected %s'); | 1025 this.E_BADARGTYPE = makeStatus.bind(null, 'E_BADARGTYPE', 'Invalid type for
argument %s: got %s, expected %s'); |
| 1026 this.E_NOTFOUND = makeStatus.bind(null, 'E_NOTFOUND', 'Object not found: %s'
); | 1026 this.E_NOTFOUND = makeStatus.bind(null, 'E_NOTFOUND', 'Object not found: %s'
); |
| 1027 this.E_NOTSUPPORTED = makeStatus.bind(null, 'E_NOTSUPPORTED', 'Object does n
ot support requested operation: %s'); | 1027 this.E_NOTSUPPORTED = makeStatus.bind(null, 'E_NOTSUPPORTED', 'Object does n
ot support requested operation: %s'); |
| 1028 this.E_PROTOCOLERROR = makeStatus.bind(null, 'E_PROTOCOLERROR', 'Inspector p
rotocol error: %s'); | 1028 this.E_PROTOCOLERROR = makeStatus.bind(null, 'E_PROTOCOLERROR', 'Inspector p
rotocol error: %s'); |
| 1029 this.E_FAILED = makeStatus.bind(null, 'E_FAILED', 'Operation failed: %s'); | 1029 this.E_FAILED = makeStatus.bind(null, 'E_FAILED', 'Operation failed: %s'); |
| 1030 } | 1030 } |
| 1031 }; | 1031 }; |
| 1032 | 1032 |
| 1033 /** | 1033 /** |
| 1034 * @typedef {{code: string, description: string, details: !Array.<*>}} | 1034 * @typedef {{code: string, description: string, details: !Array.<*>}} |
| 1035 */ | 1035 */ |
| 1036 Extensions.ExtensionStatus.Record; | 1036 Extensions.ExtensionStatus.Record; |
| 1037 | 1037 |
| 1038 Extensions.extensionAPI = {}; | 1038 Extensions.extensionAPI = {}; |
| 1039 defineCommonExtensionSymbols(Extensions.extensionAPI); | 1039 defineCommonExtensionSymbols(Extensions.extensionAPI); |
| 1040 | 1040 |
| 1041 /** @type {!Extensions.ExtensionServer} */ | 1041 /** @type {!Extensions.ExtensionServer} */ |
| 1042 Extensions.extensionServer; | 1042 Extensions.extensionServer; |
| OLD | NEW |