| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 if (dotNotation || bracketNotation) | 352 if (dotNotation || bracketNotation) |
| 353 expressionString = expressionString.substr(0, lastIndex); | 353 expressionString = expressionString.substr(0, lastIndex); |
| 354 | 354 |
| 355 var prefix = wordRange.toString(); | 355 var prefix = wordRange.toString(); |
| 356 if (!expressionString && !prefix) | 356 if (!expressionString && !prefix) |
| 357 return; | 357 return; |
| 358 | 358 |
| 359 var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly
, completionsReadyCallback, dotNotation, bracketNotation, prefix); | 359 var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly
, completionsReadyCallback, dotNotation, bracketNotation, prefix); |
| 360 // Collect comma separated object properties for the completion. | 360 // Collect comma separated object properties for the completion. |
| 361 | 361 |
| 362 var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation); | 362 var includeCommandLineAPI = (!dotNotation && !bracketNotation); |
| 363 var injectedScriptAccess; | 363 var injectedScriptAccess; |
| 364 if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) | 364 if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) |
| 365 InspectorBackend.getCompletionsOnCallFrame(WebInspector.panels.scrip
ts.selectedCallFrameId(), expressionString, includeInspectorCommandLineAPI, repo
rtCompletions); | 365 InspectorBackend.getCompletionsOnCallFrame(WebInspector.panels.scrip
ts.selectedCallFrameId(), expressionString, includeCommandLineAPI, reportComplet
ions); |
| 366 else | 366 else |
| 367 InspectorBackend.getCompletions(expressionString, includeInspectorCo
mmandLineAPI, reportCompletions); | 367 InspectorBackend.getCompletions(expressionString, includeCommandLine
API, reportCompletions); |
| 368 }, | 368 }, |
| 369 | 369 |
| 370 _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNot
ation, bracketNotation, prefix, result, isException) { | 370 _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNot
ation, bracketNotation, prefix, result, isException) { |
| 371 if (isException) | 371 if (isException) |
| 372 return; | 372 return; |
| 373 | 373 |
| 374 if (bracketNotation) { | 374 if (bracketNotation) { |
| 375 if (prefix.length && prefix[0] === "'") | 375 if (prefix.length && prefix[0] === "'") |
| 376 var quoteUsed = "'"; | 376 var quoteUsed = "'"; |
| 377 else | 377 else |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 var handler = this._shortcuts[shortcut]; | 503 var handler = this._shortcuts[shortcut]; |
| 504 if (handler) { | 504 if (handler) { |
| 505 if (!this._shortcuts[shortcut].isMacOnly || WebInspector.isMac()) { | 505 if (!this._shortcuts[shortcut].isMacOnly || WebInspector.isMac()) { |
| 506 handler(); | 506 handler(); |
| 507 event.preventDefault(); | 507 event.preventDefault(); |
| 508 return; | 508 return; |
| 509 } | 509 } |
| 510 } | 510 } |
| 511 }, | 511 }, |
| 512 | 512 |
| 513 evalInInspectedWindow: function(expression, objectGroup, callback) | 513 evalInInspectedWindow: function(expression, objectGroup, includeCommandLineA
PI, callback) |
| 514 { | 514 { |
| 515 if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { | 515 if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { |
| 516 WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression,
false, objectGroup, callback); | 516 WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression,
false, objectGroup, includeCommandLineAPI, callback); |
| 517 return; | 517 return; |
| 518 } | 518 } |
| 519 this.doEvalInWindow(expression, objectGroup, callback); | |
| 520 }, | |
| 521 | 519 |
| 522 doEvalInWindow: function(expression, objectGroup, callback) | |
| 523 { | |
| 524 if (!expression) { | 520 if (!expression) { |
| 525 // There is no expression, so the completion should happen against g
lobal properties. | 521 // There is no expression, so the completion should happen against g
lobal properties. |
| 526 expression = "this"; | 522 expression = "this"; |
| 527 } | 523 } |
| 528 | 524 |
| 529 function evalCallback(result) | 525 function evalCallback(result) |
| 530 { | 526 { |
| 531 callback(WebInspector.RemoteObject.fromPayload(result)); | 527 callback(WebInspector.RemoteObject.fromPayload(result)); |
| 532 } | 528 } |
| 533 InspectorBackend.evaluate(expression, objectGroup, evalCallback); | 529 InspectorBackend.evaluate(expression, objectGroup, includeCommandLineAPI
, evalCallback); |
| 534 }, | 530 }, |
| 535 | 531 |
| 536 _enterKeyPressed: function(event) | 532 _enterKeyPressed: function(event) |
| 537 { | 533 { |
| 538 if (event.altKey || event.ctrlKey || event.shiftKey) | 534 if (event.altKey || event.ctrlKey || event.shiftKey) |
| 539 return; | 535 return; |
| 540 | 536 |
| 541 event.preventDefault(); | 537 event.preventDefault(); |
| 542 event.stopPropagation(); | 538 event.stopPropagation(); |
| 543 | 539 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 554 function printResult(result) | 550 function printResult(result) |
| 555 { | 551 { |
| 556 self.prompt.history.push(str); | 552 self.prompt.history.push(str); |
| 557 self.prompt.historyOffset = 0; | 553 self.prompt.historyOffset = 0; |
| 558 self.prompt.text = ""; | 554 self.prompt.text = ""; |
| 559 | 555 |
| 560 WebInspector.settings.consoleHistory = self.prompt.history.slice(-30
); | 556 WebInspector.settings.consoleHistory = self.prompt.history.slice(-30
); |
| 561 | 557 |
| 562 self.addMessage(new WebInspector.ConsoleCommandResult(result, comman
dMessage)); | 558 self.addMessage(new WebInspector.ConsoleCommandResult(result, comman
dMessage)); |
| 563 } | 559 } |
| 564 this.evalInInspectedWindow(str, "console", printResult); | 560 this.evalInInspectedWindow(str, "console", true, printResult); |
| 565 }, | 561 }, |
| 566 | 562 |
| 567 _format: function(output, forceObjectFormat) | 563 _format: function(output, forceObjectFormat) |
| 568 { | 564 { |
| 569 var isProxy = (output != null && typeof output === "object"); | 565 var isProxy = (output != null && typeof output === "object"); |
| 570 var type = (forceObjectFormat ? "object" : WebInspector.RemoteObject.typ
e(output)); | 566 var type = (forceObjectFormat ? "object" : WebInspector.RemoteObject.typ
e(output)); |
| 571 | 567 |
| 572 var formatter = this._customFormatters[type]; | 568 var formatter = this._customFormatters[type]; |
| 573 if (!formatter || !isProxy) { | 569 if (!formatter || !isProxy) { |
| 574 formatter = this._formatvalue; | 570 formatter = this._formatvalue; |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 else | 1146 else |
| 1151 groupElement.addStyleClass("collapsed"); | 1147 groupElement.addStyleClass("collapsed"); |
| 1152 groupTitleElement.scrollIntoViewIfNeeded(true); | 1148 groupTitleElement.scrollIntoViewIfNeeded(true); |
| 1153 } | 1149 } |
| 1154 | 1150 |
| 1155 event.stopPropagation(); | 1151 event.stopPropagation(); |
| 1156 event.preventDefault(); | 1152 event.preventDefault(); |
| 1157 } | 1153 } |
| 1158 } | 1154 } |
| 1159 | 1155 |
| OLD | NEW |