| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 if (this.scriptId) { | 68 if (this.scriptId) { |
| 69 // Script failed to parse. | 69 // Script failed to parse. |
| 70 DebuggerAgent.getScriptSource(this.scriptId, didGetScriptSource.bind
(this)); | 70 DebuggerAgent.getScriptSource(this.scriptId, didGetScriptSource.bind
(this)); |
| 71 } else | 71 } else |
| 72 callback(""); | 72 callback(""); |
| 73 }, | 73 }, |
| 74 | 74 |
| 75 /** | 75 /** |
| 76 * @param {string} query | 76 * @param {string} query |
| 77 * @param {boolean} caseSensitive |
| 78 * @param {boolean} isRegex |
| 77 * @param {function(Array.<PageAgent.SearchMatch>)} callback | 79 * @param {function(Array.<PageAgent.SearchMatch>)} callback |
| 78 */ | 80 */ |
| 79 searchInContent: function(query, callback) | 81 searchInContent: function(query, caseSensitive, isRegex, callback) |
| 80 { | 82 { |
| 81 /** | 83 /** |
| 82 * @this {WebInspector.Script} | 84 * @this {WebInspector.Script} |
| 83 * @param {?Protocol.Error} error | 85 * @param {?Protocol.Error} error |
| 84 * @param {Array.<PageAgent.SearchMatch>} searchMatches | 86 * @param {Array.<PageAgent.SearchMatch>} searchMatches |
| 85 */ | 87 */ |
| 86 function innerCallback(error, searchMatches) | 88 function innerCallback(error, searchMatches) |
| 87 { | 89 { |
| 88 if (error) | 90 if (error) |
| 89 console.error(error); | 91 console.error(error); |
| 90 callback(searchMatches || []); | 92 var result = []; |
| 93 for (var i = 0; i < searchMatches.length; ++i) { |
| 94 var searchMatch = new WebInspector.ContentProvider.SearchMatch(s
earchMatches[i].lineNumber, searchMatches[i].lineContent); |
| 95 result.push(searchMatch); |
| 96 } |
| 97 callback(result || []); |
| 91 } | 98 } |
| 92 | 99 |
| 93 if (this.scriptId) { | 100 if (this.scriptId) { |
| 94 // Script failed to parse. | 101 // Script failed to parse. |
| 95 DebuggerAgent.searchInContent(this.scriptId, query, innerCallback.bi
nd(this)); | 102 DebuggerAgent.searchInContent(this.scriptId, query, caseSensitive, i
sRegex, innerCallback.bind(this)); |
| 96 } else | 103 } else |
| 97 callback([]); | 104 callback([]); |
| 98 }, | 105 }, |
| 99 | 106 |
| 100 /** | 107 /** |
| 101 * @param {string} newSource | 108 * @param {string} newSource |
| 102 * @param {function(?Protocol.Error, Array.<DebuggerAgent.CallFrame>=)} call
back | 109 * @param {function(?Protocol.Error, Array.<DebuggerAgent.CallFrame>=)} call
back |
| 103 */ | 110 */ |
| 104 editSource: function(newSource, callback) | 111 editSource: function(newSource, callback) |
| 105 { | 112 { |
| 106 /** | 113 /** |
| 107 * @this {WebInspector.Script} | 114 * @this {WebInspector.Script} |
| 108 * @param {?Protocol.Error} error | 115 * @param {?Protocol.Error} error |
| 109 * @param {Array.<DebuggerAgent.CallFrame>|undefined} callFrames | 116 * @param {Array.<DebuggerAgent.CallFrame>|undefined} callFrames |
| 110 */ | 117 */ |
| 111 function didEditScriptSource(error, callFrames) | 118 function didEditScriptSource(error, callFrames) |
| 112 { | 119 { |
| 113 if (!error) | 120 if (!error) |
| 114 this._source = newSource; | 121 this._source = newSource; |
| 115 callback(error, callFrames); | 122 callback(error, callFrames); |
| 116 } | 123 } |
| 117 if (this.scriptId) { | 124 if (this.scriptId) { |
| 118 // Script failed to parse. | 125 // Script failed to parse. |
| 119 DebuggerAgent.setScriptSource(this.scriptId, newSource, undefined, d
idEditScriptSource.bind(this)); | 126 DebuggerAgent.setScriptSource(this.scriptId, newSource, undefined, d
idEditScriptSource.bind(this)); |
| 120 } else | 127 } else |
| 121 callback("Script failed to parse"); | 128 callback("Script failed to parse"); |
| 122 } | 129 } |
| 123 } | 130 } |
| OLD | NEW |