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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 var warnings = WebInspector.console.warnings; | 186 var warnings = WebInspector.console.warnings; |
187 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings); | 187 WebInspector.inspectorView.setErrorAndWarningCounts(errors, warnings); |
188 }, | 188 }, |
189 | 189 |
190 inspectedPageDomain: function() | 190 inspectedPageDomain: function() |
191 { | 191 { |
192 var parsedURL = WebInspector.inspectedPageURL && WebInspector.inspectedP ageURL.asParsedURL(); | 192 var parsedURL = WebInspector.inspectedPageURL && WebInspector.inspectedP ageURL.asParsedURL(); |
193 return parsedURL ? parsedURL.host : ""; | 193 return parsedURL ? parsedURL.host : ""; |
194 }, | 194 }, |
195 | 195 |
196 _initializeCapability: function(name, callback, error, result) | |
197 { | |
198 Capabilities[name] = result; | |
199 if (callback) | |
200 callback(); | |
201 }, | |
202 | |
203 _debuggerPaused: function() | 196 _debuggerPaused: function() |
204 { | 197 { |
205 this.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events .DebuggerPaused, this._debuggerPaused, this); | 198 this.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events .DebuggerPaused, this._debuggerPaused, this); |
206 WebInspector.showPanel("sources"); | 199 WebInspector.showPanel("sources"); |
207 } | 200 } |
208 } | 201 } |
209 | 202 |
210 WebInspector.Events = { | 203 WebInspector.Events = { |
211 InspectorLoaded: "InspectorLoaded" | 204 InspectorLoaded: "InspectorLoaded" |
212 } | 205 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 var ws; | 263 var ws; |
271 if ("ws" in WebInspector.queryParamsObject) | 264 if ("ws" in WebInspector.queryParamsObject) |
272 ws = "ws://" + WebInspector.queryParamsObject.ws; | 265 ws = "ws://" + WebInspector.queryParamsObject.ws; |
273 else if ("page" in WebInspector.queryParamsObject) { | 266 else if ("page" in WebInspector.queryParamsObject) { |
274 var page = WebInspector.queryParamsObject.page; | 267 var page = WebInspector.queryParamsObject.page; |
275 var host = "host" in WebInspector.queryParamsObject ? WebInspector.query ParamsObject.host : window.location.host; | 268 var host = "host" in WebInspector.queryParamsObject ? WebInspector.query ParamsObject.host : window.location.host; |
276 ws = "ws://" + host + "/devtools/page/" + page; | 269 ws = "ws://" + host + "/devtools/page/" + page; |
277 } | 270 } |
278 | 271 |
279 if (ws) { | 272 if (ws) { |
280 WebInspector.socket = new WebSocket(ws); | 273 WebInspector.socket = new WebSocket(ws); |
pfeldman
2014/03/08 16:10:00
What about web socket connection? It is not a main
| |
281 WebInspector.socket.onmessage = function(message) { InspectorBackend.con nection().dispatch(message.data); } | 274 WebInspector.socket.onmessage = function(message) { InspectorBackend.con nection().dispatch(message.data); } |
282 WebInspector.socket.onerror = function(error) { console.error(error); } | 275 WebInspector.socket.onerror = function(error) { console.error(error); } |
283 WebInspector.socket.onopen = function() { | 276 WebInspector.socket.onopen = function() { |
284 InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.sen d.bind(WebInspector.socket); | 277 InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.sen d.bind(WebInspector.socket); |
285 WebInspector.doLoadedDone(); | 278 WebInspector.doLoadedDone(); |
286 } | 279 } |
287 WebInspector.socket.onclose = function() { | 280 WebInspector.socket.onclose = function() { |
288 if (!WebInspector.socket._detachReason) | 281 if (!WebInspector.socket._detachReason) |
289 (new WebInspector.RemoteDebuggingTerminatedScreen("websocket_clo sed")).showModal(); | 282 (new WebInspector.RemoteDebuggingTerminatedScreen("websocket_clo sed")).showModal(); |
290 } | 283 } |
291 return; | 284 return; |
292 } | 285 } |
293 | 286 |
294 WebInspector.doLoadedDone(); | 287 WebInspector.doLoadedDone(); |
295 | 288 |
296 // In case of loading as a web page with no bindings / harness, kick off ini tialization manually. | 289 if (InspectorFrontendHost.isStub) |
297 if (InspectorFrontendHost.isStub) { | |
298 InspectorFrontendAPI.dispatchQueryParameters(WebInspector.queryParamsObj ect); | 290 InspectorFrontendAPI.dispatchQueryParameters(WebInspector.queryParamsObj ect); |
299 WebInspector._doLoadedDoneWithCapabilities(); | |
300 } | |
301 } | 291 } |
302 | 292 |
303 WebInspector.doLoadedDone = function() | 293 WebInspector.doLoadedDone = function() |
304 { | 294 { |
305 // Install styles and themes | 295 // Install styles and themes |
306 WebInspector.installPortStyles(); | 296 WebInspector.installPortStyles(); |
307 if (WebInspector.socket) | 297 if (WebInspector.socket) |
308 document.body.classList.add("remote"); | 298 document.body.classList.add("remote"); |
309 | 299 |
310 if (WebInspector.queryParamsObject.toolbarColor && WebInspector.queryParamsO bject.textColor) | 300 if (WebInspector.queryParamsObject.toolbarColor && WebInspector.queryParamsO bject.textColor) |
311 WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbarColo r, WebInspector.queryParamsObject.textColor); | 301 WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbarColo r, WebInspector.queryParamsObject.textColor); |
312 | 302 |
313 var workerId = WebInspector.queryParamsObject["dedicatedWorkerId"]; | 303 var workerId = WebInspector.queryParamsObject["dedicatedWorkerId"]; |
314 if (workerId) | 304 if (workerId) |
315 this._initializeDedicatedWorkerFrontend(workerId); | 305 this._initializeDedicatedWorkerFrontend(workerId); |
316 | 306 |
317 var connection = workerId ? new WebInspector.WorkerConnection(workerId) : ne w InspectorBackendClass.MainConnection(); | 307 var connection = workerId ? new WebInspector.WorkerConnection(workerId) : ne w InspectorBackendClass.MainConnection(); |
318 InspectorBackend.setConnection(connection); | 308 InspectorBackend.setConnection(connection); |
319 | 309 |
320 PageAgent.canScreencast(WebInspector._initializeCapability.bind(WebInspector , "canScreencast", null)); | 310 WebInspector.targetManager = new WebInspector.TargetManager(); |
321 WorkerAgent.canInspectWorkers(WebInspector._initializeCapability.bind(WebIns pector, "canInspectWorkers", WebInspector._doLoadedDoneWithCapabilities.bind(Web Inspector))); | 311 WebInspector.targetManager.createTarget(connection, WebInspector._doLoadedDo neWithCapabilities.bind(WebInspector)); |
322 } | 312 } |
323 | 313 |
324 WebInspector._doLoadedDoneWithCapabilities = function() | 314 WebInspector._doLoadedDoneWithCapabilities = function(mainTarget) |
325 { | 315 { |
326 new WebInspector.VersionController().updateVersion(); | 316 new WebInspector.VersionController().updateVersion(); |
327 | |
328 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); | 317 WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen(); |
329 this._registerShortcuts(); | 318 this._registerShortcuts(); |
330 | 319 |
331 // set order of some sections explicitly | 320 // set order of some sections explicitly |
332 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); | 321 WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); |
333 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel") ); | 322 WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel") ); |
334 WebInspector.ShortcutsScreen.registerShortcuts(); | 323 WebInspector.ShortcutsScreen.registerShortcuts(); |
335 | 324 |
336 this.console = new WebInspector.ConsoleModel(); | |
337 this.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleare d, this._resetErrorAndWarningCounts, this); | 325 this.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleare d, this._resetErrorAndWarningCounts, this); |
338 this.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._updateErrorAndWarningCounts, this); | 326 this.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._updateErrorAndWarningCounts, this); |
339 this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUp dated, this._updateErrorAndWarningCounts, this); | 327 this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUp dated, this._updateErrorAndWarningCounts, this); |
340 this.networkManager = new WebInspector.NetworkManager(); | 328 |
341 this.resourceTreeModel = new WebInspector.ResourceTreeModel(this.networkMana ger); | |
342 this.debuggerModel = new WebInspector.DebuggerModel(); | |
343 this.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debugg erPaused, this._debuggerPaused, this); | 329 this.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Debugg erPaused, this._debuggerPaused, this); |
344 this.networkLog = new WebInspector.NetworkLog(); | 330 this.networkLog = new WebInspector.NetworkLog(); |
345 this.domAgent = new WebInspector.DOMAgent(); | |
346 this.workerManager = new WebInspector.WorkerManager(Capabilities.canInspectW orkers); | |
347 this.runtimeModel = new WebInspector.RuntimeModel(this.resourceTreeModel); | |
348 | 331 |
349 this.zoomManager = new WebInspector.ZoomManager(); | 332 this.zoomManager = new WebInspector.ZoomManager(); |
350 | 333 |
351 this.advancedSearchController = new WebInspector.AdvancedSearchController(); | 334 this.advancedSearchController = new WebInspector.AdvancedSearchController(); |
352 this.consoleView = new WebInspector.ConsoleView(WebInspector.isWorkerFronten d()); | 335 this.consoleView = new WebInspector.ConsoleView(WebInspector.isWorkerFronten d()); |
353 | 336 |
354 InspectorBackend.registerInspectorDispatcher(this); | 337 InspectorBackend.registerInspectorDispatcher(this); |
355 | 338 |
356 this.isolatedFileSystemManager = new WebInspector.IsolatedFileSystemManager( ); | 339 this.isolatedFileSystemManager = new WebInspector.IsolatedFileSystemManager( ); |
357 this.isolatedFileSystemDispatcher = new WebInspector.IsolatedFileSystemDispa tcher(this.isolatedFileSystemManager); | 340 this.isolatedFileSystemDispatcher = new WebInspector.IsolatedFileSystemDispa tcher(this.isolatedFileSystemManager); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 new WebInspector.PresentationConsoleMessageHelper(this.workspace); | 379 new WebInspector.PresentationConsoleMessageHelper(this.workspace); |
397 | 380 |
398 // Create settings before loading modules. | 381 // Create settings before loading modules. |
399 WebInspector.settings.initializeBackendSettings(); | 382 WebInspector.settings.initializeBackendSettings(); |
400 | 383 |
401 this._registerModules(); | 384 this._registerModules(); |
402 | 385 |
403 this.panels = {}; | 386 this.panels = {}; |
404 this.inspectorView = new WebInspector.InspectorView(); | 387 this.inspectorView = new WebInspector.InspectorView(); |
405 // Screencast controller creates a root view itself. | 388 // Screencast controller creates a root view itself. |
406 if (Capabilities.canScreencast) | 389 if (mainTarget.canScreencast) |
407 this._screencastController = new WebInspector.ScreencastController(); | 390 this._screencastController = new WebInspector.ScreencastController(); |
408 else | 391 else |
409 this._createRootView(); | 392 this._createRootView(); |
410 this._createGlobalStatusBarItems(); | 393 this._createGlobalStatusBarItems(); |
411 | 394 |
412 this.addMainEventListeners(document); | 395 this.addMainEventListeners(document); |
413 | 396 |
414 window.addEventListener("resize", this.windowResize.bind(this), true); | 397 window.addEventListener("resize", this.windowResize.bind(this), true); |
415 | 398 |
416 var errorWarningCount = document.getElementById("error-warning-count"); | 399 var errorWarningCount = document.getElementById("error-warning-count"); |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
910 this._fontFamily = "'Lucida Grande', sans-serif"; | 893 this._fontFamily = "'Lucida Grande', sans-serif"; |
911 break; | 894 break; |
912 case "windows": | 895 case "windows": |
913 this._fontFamily = "'Segoe UI', Tahoma, sans-serif"; | 896 this._fontFamily = "'Segoe UI', Tahoma, sans-serif"; |
914 break; | 897 break; |
915 } | 898 } |
916 return WebInspector._fontFamily; | 899 return WebInspector._fontFamily; |
917 } | 900 } |
918 | 901 |
919 window.DEBUG = true; | 902 window.DEBUG = true; |
OLD | NEW |