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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 WebInspector.warnings += msg.repeatDelta; | 285 WebInspector.warnings += msg.repeatDelta; |
286 break; | 286 break; |
287 case WebInspector.ConsoleMessage.MessageLevel.Error: | 287 case WebInspector.ConsoleMessage.MessageLevel.Error: |
288 WebInspector.errors += msg.repeatDelta; | 288 WebInspector.errors += msg.repeatDelta; |
289 break; | 289 break; |
290 } | 290 } |
291 }, | 291 }, |
292 | 292 |
293 requestClearMessages: function() | 293 requestClearMessages: function() |
294 { | 294 { |
295 InjectedScriptAccess.clearConsoleMessages(function() {}); | 295 InjectedScriptAccess.getDefault().clearConsoleMessages(function() {}); |
296 }, | 296 }, |
297 | 297 |
298 clearMessages: function() | 298 clearMessages: function() |
299 { | 299 { |
300 if (WebInspector.panels.resources) | 300 if (WebInspector.panels.resources) |
301 WebInspector.panels.resources.clearMessages(); | 301 WebInspector.panels.resources.clearMessages(); |
302 | 302 |
303 this.messages = []; | 303 this.messages = []; |
304 | 304 |
305 this.groupLevel = 0; | 305 this.groupLevel = 0; |
(...skipping 21 matching lines...) Expand all Loading... |
327 expressionString = expressionString.substr(0, lastIndex); | 327 expressionString = expressionString.substr(0, lastIndex); |
328 | 328 |
329 var prefix = wordRange.toString(); | 329 var prefix = wordRange.toString(); |
330 if (!expressionString && !prefix) | 330 if (!expressionString && !prefix) |
331 return; | 331 return; |
332 | 332 |
333 var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly
, completionsReadyCallback, dotNotation, bracketNotation, prefix); | 333 var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly
, completionsReadyCallback, dotNotation, bracketNotation, prefix); |
334 // Collect comma separated object properties for the completion. | 334 // Collect comma separated object properties for the completion. |
335 | 335 |
336 var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation); | 336 var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation); |
337 if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) | 337 var injectedScriptAccess; |
| 338 if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { |
338 var callFrameId = WebInspector.panels.scripts.selectedCallFrameId(); | 339 var callFrameId = WebInspector.panels.scripts.selectedCallFrameId(); |
339 InjectedScriptAccess.getCompletions(expressionString, includeInspectorCo
mmandLineAPI, callFrameId, reportCompletions); | 340 var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFram
e; |
| 341 injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.in
jectedScriptId); |
| 342 } else |
| 343 injectedScriptAccess = InjectedScriptAccess.getDefault(); |
| 344 injectedScriptAccess.get(injectedScriptId).getCompletions(expressionStri
ng, includeInspectorCommandLineAPI, callFrameId, reportCompletions); |
340 }, | 345 }, |
341 | 346 |
342 _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNot
ation, bracketNotation, prefix, result, isException) { | 347 _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNot
ation, bracketNotation, prefix, result, isException) { |
343 if (isException) | 348 if (isException) |
344 return; | 349 return; |
345 | 350 |
346 if (bracketNotation) { | 351 if (bracketNotation) { |
347 if (prefix.length && prefix[0] === "'") | 352 if (prefix.length && prefix[0] === "'") |
348 var quoteUsed = "'"; | 353 var quoteUsed = "'"; |
349 else | 354 else |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 { | 458 { |
454 if (!expression) { | 459 if (!expression) { |
455 // There is no expression, so the completion should happen against g
lobal properties. | 460 // There is no expression, so the completion should happen against g
lobal properties. |
456 expression = "this"; | 461 expression = "this"; |
457 } | 462 } |
458 | 463 |
459 function evalCallback(result) | 464 function evalCallback(result) |
460 { | 465 { |
461 callback(result.value, result.isException); | 466 callback(result.value, result.isException); |
462 }; | 467 }; |
463 InjectedScriptAccess.evaluate(expression, objectGroup, evalCallback); | 468 InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, eval
Callback); |
464 }, | 469 }, |
465 | 470 |
466 _enterKeyPressed: function(event) | 471 _enterKeyPressed: function(event) |
467 { | 472 { |
468 if (event.altKey) | 473 if (event.altKey) |
469 return; | 474 return; |
470 | 475 |
471 event.preventDefault(); | 476 event.preventDefault(); |
472 event.stopPropagation(); | 477 event.stopPropagation(); |
473 | 478 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 return; | 531 return; |
527 var treeOutline = new WebInspector.ElementsTreeOutline(); | 532 var treeOutline = new WebInspector.ElementsTreeOutline(); |
528 treeOutline.showInElementsPanelEnabled = true; | 533 treeOutline.showInElementsPanelEnabled = true; |
529 treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(nodeId); | 534 treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(nodeId); |
530 treeOutline.element.addStyleClass("outline-disclosure"); | 535 treeOutline.element.addStyleClass("outline-disclosure"); |
531 if (!treeOutline.children[0].hasChildren) | 536 if (!treeOutline.children[0].hasChildren) |
532 treeOutline.element.addStyleClass("single-node"); | 537 treeOutline.element.addStyleClass("single-node"); |
533 elem.appendChild(treeOutline.element); | 538 elem.appendChild(treeOutline.element); |
534 } | 539 } |
535 | 540 |
536 InjectedScriptAccess.pushNodeToFrontend(object, printNode); | 541 InjectedScriptAccess.get(object.injectedScriptId).pushNodeToFrontend(obj
ect, printNode); |
537 }, | 542 }, |
538 | 543 |
539 _formatarray: function(arr, elem) | 544 _formatarray: function(arr, elem) |
540 { | 545 { |
541 InjectedScriptAccess.getProperties(arr, false, false, this._printArray.b
ind(this, elem)); | 546 InjectedScriptAccess.get(arr.injectedScriptId).getProperties(arr, false,
false, this._printArray.bind(this, elem)); |
542 }, | 547 }, |
543 | 548 |
544 _formatstring: function(output, elem) | 549 _formatstring: function(output, elem) |
545 { | 550 { |
546 var span = document.createElement("span"); | 551 var span = document.createElement("span"); |
547 span.className = "console-formatted-string source-code"; | 552 span.className = "console-formatted-string source-code"; |
548 span.appendChild(WebInspector.linkifyStringAsFragment(output.description
)); | 553 span.appendChild(WebInspector.linkifyStringAsFragment(output.description
)); |
549 | 554 |
550 // Make black quotes. | 555 // Make black quotes. |
551 elem.removeStyleClass("console-formatted-string"); | 556 elem.removeStyleClass("console-formatted-string"); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 groupElement.removeStyleClass("collapsed"); | 1018 groupElement.removeStyleClass("collapsed"); |
1014 else | 1019 else |
1015 groupElement.addStyleClass("collapsed"); | 1020 groupElement.addStyleClass("collapsed"); |
1016 groupTitleElement.scrollIntoViewIfNeeded(true); | 1021 groupTitleElement.scrollIntoViewIfNeeded(true); |
1017 } | 1022 } |
1018 | 1023 |
1019 event.stopPropagation(); | 1024 event.stopPropagation(); |
1020 event.preventDefault(); | 1025 event.preventDefault(); |
1021 } | 1026 } |
1022 } | 1027 } |
OLD | NEW |