OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 InspectorBackend.setConnection(connection); | 300 InspectorBackend.setConnection(connection); |
301 WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), c
onnection, this._mainTargetCreated.bind(this)); | 301 WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), c
onnection, this._mainTargetCreated.bind(this)); |
302 }, | 302 }, |
303 | 303 |
304 /** | 304 /** |
305 * @param {?WebInspector.Target} target | 305 * @param {?WebInspector.Target} target |
306 */ | 306 */ |
307 _mainTargetCreated: function(target) | 307 _mainTargetCreated: function(target) |
308 { | 308 { |
309 console.timeStamp("Main._mainTargetCreated"); | 309 console.timeStamp("Main._mainTargetCreated"); |
310 | 310 this._mainTarget = /** @type {!WebInspector.Target} */(target); |
311 var mainTarget = /** @type {!WebInspector.Target} */(target); | |
312 this._registerShortcuts(); | 311 this._registerShortcuts(); |
313 | 312 |
314 WebInspector.workerTargetManager = new WebInspector.WorkerTargetManager(
mainTarget, WebInspector.targetManager); | 313 WebInspector.workerTargetManager = new WebInspector.WorkerTargetManager(
this._mainTarget, WebInspector.targetManager); |
315 | 314 |
316 mainTarget.registerInspectorDispatcher(this); | 315 this._mainTarget.registerInspectorDispatcher(this); |
317 | 316 |
318 if (WebInspector.isWorkerFrontend()) { | 317 if (WebInspector.isWorkerFrontend()) { |
319 mainTarget.runtimeAgent().run(); | 318 this._mainTarget.runtimeAgent().run(); |
320 mainTarget.workerManager.addEventListener(WebInspector.WorkerManager
.Events.WorkerDisconnected, onWorkerDisconnected); | 319 this._mainTarget.workerManager.addEventListener(WebInspector.WorkerM
anager.Events.WorkerDisconnected, onWorkerDisconnected.bind(this)); |
321 } | 320 } |
322 | 321 |
| 322 /** |
| 323 * @this {WebInspector.Main} |
| 324 */ |
323 function onWorkerDisconnected() | 325 function onWorkerDisconnected() |
324 { | 326 { |
325 var screen = new WebInspector.WorkerTerminatedScreen(); | 327 var screen = new WebInspector.WorkerTerminatedScreen(); |
326 var listener = hideScreen.bind(null, screen); | 328 var listener = hideScreen.bind(this, screen); |
327 mainTarget.debuggerModel.addEventListener(WebInspector.DebuggerModel
.Events.GlobalObjectCleared, listener); | 329 this._mainTarget.debuggerModel.addEventListener(WebInspector.Debugge
rModel.Events.GlobalObjectCleared, listener); |
328 | 330 |
329 /** | 331 /** |
330 * @param {!WebInspector.WorkerTerminatedScreen} screen | 332 * @param {!WebInspector.WorkerTerminatedScreen} screen |
| 333 * @this {WebInspector.Main} |
331 */ | 334 */ |
332 function hideScreen(screen) | 335 function hideScreen(screen) |
333 { | 336 { |
334 mainTarget.debuggerModel.removeEventListener(WebInspector.Debugg
erModel.Events.GlobalObjectCleared, listener); | 337 this._mainTarget.debuggerModel.removeEventListener(WebInspector.
DebuggerModel.Events.GlobalObjectCleared, listener); |
335 screen.hide(); | 338 screen.hide(); |
336 } | 339 } |
337 | 340 |
338 screen.showModal(); | 341 screen.showModal(); |
339 } | 342 } |
340 | 343 |
341 target.inspectorAgent().enable(inspectorAgentEnableCallback); | 344 target.inspectorAgent().enable(inspectorAgentEnableCallback); |
342 | 345 |
343 function inspectorAgentEnableCallback() | 346 function inspectorAgentEnableCallback() |
344 { | 347 { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(anchor.line
Number || 0, anchor.columnNumber || 0)); | 410 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(anchor.line
Number || 0, anchor.columnNumber || 0)); |
408 return; | 411 return; |
409 } | 412 } |
410 | 413 |
411 var resource = WebInspector.resourceForURL(anchor.href); | 414 var resource = WebInspector.resourceForURL(anchor.href); |
412 if (resource) { | 415 if (resource) { |
413 WebInspector.Revealer.reveal(resource); | 416 WebInspector.Revealer.reveal(resource); |
414 return; | 417 return; |
415 } | 418 } |
416 | 419 |
417 var request = WebInspector.networkLog.requestForURL(anchor.href); | 420 var request = WebInspector.NetworkLog.requestForURL(anchor.href); |
418 if (request) { | 421 if (request) { |
419 WebInspector.Revealer.reveal(request); | 422 WebInspector.Revealer.reveal(request); |
420 return; | 423 return; |
421 } | 424 } |
422 InspectorFrontendHost.openInNewTab(anchor.href); | 425 InspectorFrontendHost.openInNewTab(anchor.href); |
423 } | 426 } |
424 | 427 |
425 if (WebInspector.followLinkTimeout) | 428 if (WebInspector.followLinkTimeout) |
426 clearTimeout(WebInspector.followLinkTimeout); | 429 clearTimeout(WebInspector.followLinkTimeout); |
427 | 430 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 document.addEventListener("click", this._documentClick.bind(this), false
); | 549 document.addEventListener("click", this._documentClick.bind(this), false
); |
547 }, | 550 }, |
548 | 551 |
549 /** | 552 /** |
550 * @override | 553 * @override |
551 * @param {!RuntimeAgent.RemoteObject} payload | 554 * @param {!RuntimeAgent.RemoteObject} payload |
552 * @param {!Object=} hints | 555 * @param {!Object=} hints |
553 */ | 556 */ |
554 inspect: function(payload, hints) | 557 inspect: function(payload, hints) |
555 { | 558 { |
556 var object = WebInspector.runtimeModel.createRemoteObject(payload); | 559 var object = this._mainTarget.runtimeModel.createRemoteObject(payload); |
557 if (object.isNode()) { | 560 if (object.isNode()) { |
558 WebInspector.Revealer.revealPromise(object).then(object.release.bind
(object)); | 561 WebInspector.Revealer.revealPromise(object).then(object.release.bind
(object)); |
559 return; | 562 return; |
560 } | 563 } |
561 | 564 |
562 if (object.type === "function") { | 565 if (object.type === "function") { |
563 object.functionDetails(didGetDetails); | 566 object.functionDetails(didGetDetails); |
564 return; | 567 return; |
565 } | 568 } |
566 | 569 |
(...skipping 24 matching lines...) Expand all Loading... |
591 WebInspector._disconnectedScreenWithReasonWasShown = true; | 594 WebInspector._disconnectedScreenWithReasonWasShown = true; |
592 new WebInspector.RemoteDebuggingTerminatedScreen(reason).showModal(); | 595 new WebInspector.RemoteDebuggingTerminatedScreen(reason).showModal(); |
593 }, | 596 }, |
594 | 597 |
595 /** | 598 /** |
596 * @override | 599 * @override |
597 */ | 600 */ |
598 targetCrashed: function() | 601 targetCrashed: function() |
599 { | 602 { |
600 (new WebInspector.HelpScreenUntilReload( | 603 (new WebInspector.HelpScreenUntilReload( |
| 604 this._mainTarget, |
601 WebInspector.UIString("Inspected target crashed"), | 605 WebInspector.UIString("Inspected target crashed"), |
602 WebInspector.UIString("Inspected target has crashed. Once it reloads
we will attach to it automatically."))).showModal(); | 606 WebInspector.UIString("Inspected target has crashed. Once it reloads
we will attach to it automatically."))).showModal(); |
603 }, | 607 }, |
604 | 608 |
605 /** | 609 /** |
606 * @override | 610 * @override |
607 * @param {number} callId | 611 * @param {number} callId |
608 * @param {string} script | 612 * @param {string} script |
609 */ | 613 */ |
610 evaluateForTestInFrontend: function(callId, script) | 614 evaluateForTestInFrontend: function(callId, script) |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 p.classList.add("help-section"); | 928 p.classList.add("help-section"); |
925 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once
it restarts we will attach to it automatically."); | 929 p.textContent = WebInspector.UIString("Inspected worker has terminated. Once
it restarts we will attach to it automatically."); |
926 } | 930 } |
927 | 931 |
928 WebInspector.WorkerTerminatedScreen.prototype = { | 932 WebInspector.WorkerTerminatedScreen.prototype = { |
929 | 933 |
930 __proto__: WebInspector.HelpScreen.prototype | 934 __proto__: WebInspector.HelpScreen.prototype |
931 } | 935 } |
932 | 936 |
933 new WebInspector.Main(); | 937 new WebInspector.Main(); |
OLD | NEW |