| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 if (target.hasJSCapability()) | 42 if (target.hasJSCapability()) |
| 43 this._agent.enable(); | 43 this._agent.enable(); |
| 44 /** @type {!Map<number, !WebInspector.ExecutionContext>} */ | 44 /** @type {!Map<number, !WebInspector.ExecutionContext>} */ |
| 45 this._executionContextById = new Map(); | 45 this._executionContextById = new Map(); |
| 46 this._executionContextComparator = WebInspector.ExecutionContext.comparator; | 46 this._executionContextComparator = WebInspector.ExecutionContext.comparator; |
| 47 | 47 |
| 48 if (WebInspector.moduleSetting("customFormatters").get()) | 48 if (WebInspector.moduleSetting("customFormatters").get()) |
| 49 this._agent.setCustomObjectFormatterEnabled(true); | 49 this._agent.setCustomObjectFormatterEnabled(true); |
| 50 | 50 |
| 51 WebInspector.moduleSetting("customFormatters").addChangeListener(this._custo
mFormattersStateChanged.bind(this)); | 51 WebInspector.moduleSetting("customFormatters").addChangeListener(this._custo
mFormattersStateChanged.bind(this)); |
| 52 } | 52 }; |
| 53 | 53 |
| 54 /** @enum {symbol} */ | 54 /** @enum {symbol} */ |
| 55 WebInspector.RuntimeModel.Events = { | 55 WebInspector.RuntimeModel.Events = { |
| 56 ExecutionContextCreated: Symbol("ExecutionContextCreated"), | 56 ExecutionContextCreated: Symbol("ExecutionContextCreated"), |
| 57 ExecutionContextDestroyed: Symbol("ExecutionContextDestroyed"), | 57 ExecutionContextDestroyed: Symbol("ExecutionContextDestroyed"), |
| 58 ExecutionContextChanged: Symbol("ExecutionContextChanged"), | 58 ExecutionContextChanged: Symbol("ExecutionContextChanged"), |
| 59 ExecutionContextOrderChanged: Symbol("ExecutionContextOrderChanged") | 59 ExecutionContextOrderChanged: Symbol("ExecutionContextOrderChanged") |
| 60 } | 60 }; |
| 61 | 61 |
| 62 WebInspector.RuntimeModel._privateScript = "private script"; | 62 WebInspector.RuntimeModel._privateScript = "private script"; |
| 63 | 63 |
| 64 WebInspector.RuntimeModel.prototype = { | 64 WebInspector.RuntimeModel.prototype = { |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * @return {!Array.<!WebInspector.ExecutionContext>} | 67 * @return {!Array.<!WebInspector.ExecutionContext>} |
| 68 */ | 68 */ |
| 69 executionContexts: function() | 69 executionContexts: function() |
| 70 { | 70 { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return subtype + ""; | 337 return subtype + ""; |
| 338 try { | 338 try { |
| 339 return JSON.stringify(this, null, " "); | 339 return JSON.stringify(this, null, " "); |
| 340 } catch (e) { | 340 } catch (e) { |
| 341 return "" + this; | 341 return "" + this; |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 }, | 344 }, |
| 345 | 345 |
| 346 __proto__: WebInspector.SDKModel.prototype | 346 __proto__: WebInspector.SDKModel.prototype |
| 347 } | 347 }; |
| 348 | 348 |
| 349 /** | 349 /** |
| 350 * @constructor | 350 * @constructor |
| 351 * @implements {RuntimeAgent.Dispatcher} | 351 * @implements {RuntimeAgent.Dispatcher} |
| 352 * @param {!WebInspector.RuntimeModel} runtimeModel | 352 * @param {!WebInspector.RuntimeModel} runtimeModel |
| 353 */ | 353 */ |
| 354 WebInspector.RuntimeDispatcher = function(runtimeModel) | 354 WebInspector.RuntimeDispatcher = function(runtimeModel) |
| 355 { | 355 { |
| 356 this._runtimeModel = runtimeModel; | 356 this._runtimeModel = runtimeModel; |
| 357 } | 357 }; |
| 358 | 358 |
| 359 WebInspector.RuntimeDispatcher.prototype = { | 359 WebInspector.RuntimeDispatcher.prototype = { |
| 360 /** | 360 /** |
| 361 * @override | 361 * @override |
| 362 * @param {!RuntimeAgent.ExecutionContextDescription} context | 362 * @param {!RuntimeAgent.ExecutionContextDescription} context |
| 363 */ | 363 */ |
| 364 executionContextCreated: function(context) | 364 executionContextCreated: function(context) |
| 365 { | 365 { |
| 366 this._runtimeModel._executionContextCreated(context); | 366 this._runtimeModel._executionContextCreated(context); |
| 367 }, | 367 }, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 466 |
| 467 /** | 467 /** |
| 468 * @override | 468 * @override |
| 469 * @param {!RuntimeAgent.RemoteObject} payload | 469 * @param {!RuntimeAgent.RemoteObject} payload |
| 470 * @param {!Object=} hints | 470 * @param {!Object=} hints |
| 471 */ | 471 */ |
| 472 inspectRequested: function(payload, hints) | 472 inspectRequested: function(payload, hints) |
| 473 { | 473 { |
| 474 this._runtimeModel._inspectRequested(payload, hints); | 474 this._runtimeModel._inspectRequested(payload, hints); |
| 475 } | 475 } |
| 476 } | 476 }; |
| 477 | 477 |
| 478 /** | 478 /** |
| 479 * @constructor | 479 * @constructor |
| 480 * @extends {WebInspector.SDKObject} | 480 * @extends {WebInspector.SDKObject} |
| 481 * @param {!WebInspector.Target} target | 481 * @param {!WebInspector.Target} target |
| 482 * @param {number} id | 482 * @param {number} id |
| 483 * @param {string} name | 483 * @param {string} name |
| 484 * @param {string} origin | 484 * @param {string} origin |
| 485 * @param {boolean} isDefault | 485 * @param {boolean} isDefault |
| 486 * @param {string=} frameId | 486 * @param {string=} frameId |
| 487 */ | 487 */ |
| 488 WebInspector.ExecutionContext = function(target, id, name, origin, isDefault, fr
ameId) | 488 WebInspector.ExecutionContext = function(target, id, name, origin, isDefault, fr
ameId) |
| 489 { | 489 { |
| 490 WebInspector.SDKObject.call(this, target); | 490 WebInspector.SDKObject.call(this, target); |
| 491 this.id = id; | 491 this.id = id; |
| 492 this.name = name; | 492 this.name = name; |
| 493 this.origin = origin; | 493 this.origin = origin; |
| 494 this.isDefault = isDefault; | 494 this.isDefault = isDefault; |
| 495 this.runtimeModel = target.runtimeModel; | 495 this.runtimeModel = target.runtimeModel; |
| 496 this.debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 496 this.debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| 497 this.frameId = frameId; | 497 this.frameId = frameId; |
| 498 | 498 |
| 499 this._label = name; | 499 this._label = name; |
| 500 var parsedUrl = origin.asParsedURL(); | 500 var parsedUrl = origin.asParsedURL(); |
| 501 if (!this._label && parsedUrl) | 501 if (!this._label && parsedUrl) |
| 502 this._label = parsedUrl.lastPathComponentWithFragment(); | 502 this._label = parsedUrl.lastPathComponentWithFragment(); |
| 503 } | 503 }; |
| 504 | 504 |
| 505 /** | 505 /** |
| 506 * @param {!WebInspector.ExecutionContext} a | 506 * @param {!WebInspector.ExecutionContext} a |
| 507 * @param {!WebInspector.ExecutionContext} b | 507 * @param {!WebInspector.ExecutionContext} b |
| 508 * @return {number} | 508 * @return {number} |
| 509 */ | 509 */ |
| 510 WebInspector.ExecutionContext.comparator = function(a, b) | 510 WebInspector.ExecutionContext.comparator = function(a, b) |
| 511 { | 511 { |
| 512 /** | 512 /** |
| 513 * @param {!WebInspector.Target} target | 513 * @param {!WebInspector.Target} target |
| (...skipping 11 matching lines...) Expand all Loading... |
| 525 var weightDiff = targetWeight(a.target()) - targetWeight(b.target()); | 525 var weightDiff = targetWeight(a.target()) - targetWeight(b.target()); |
| 526 if (weightDiff) | 526 if (weightDiff) |
| 527 return -weightDiff; | 527 return -weightDiff; |
| 528 | 528 |
| 529 // Main world context should always go first. | 529 // Main world context should always go first. |
| 530 if (a.isDefault) | 530 if (a.isDefault) |
| 531 return -1; | 531 return -1; |
| 532 if (b.isDefault) | 532 if (b.isDefault) |
| 533 return +1; | 533 return +1; |
| 534 return a.name.localeCompare(b.name); | 534 return a.name.localeCompare(b.name); |
| 535 } | 535 }; |
| 536 | 536 |
| 537 WebInspector.ExecutionContext.prototype = { | 537 WebInspector.ExecutionContext.prototype = { |
| 538 /** | 538 /** |
| 539 * @param {string} expression | 539 * @param {string} expression |
| 540 * @param {string} objectGroup | 540 * @param {string} objectGroup |
| 541 * @param {boolean} includeCommandLineAPI | 541 * @param {boolean} includeCommandLineAPI |
| 542 * @param {boolean} silent | 542 * @param {boolean} silent |
| 543 * @param {boolean} returnByValue | 543 * @param {boolean} returnByValue |
| 544 * @param {boolean} generatePreview | 544 * @param {boolean} generatePreview |
| 545 * @param {boolean} userGesture | 545 * @param {boolean} userGesture |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 /** | 819 /** |
| 820 * @param {string} label | 820 * @param {string} label |
| 821 */ | 821 */ |
| 822 setLabel: function(label) | 822 setLabel: function(label) |
| 823 { | 823 { |
| 824 this._label = label; | 824 this._label = label; |
| 825 this.runtimeModel.dispatchEventToListeners(WebInspector.RuntimeModel.Eve
nts.ExecutionContextChanged, this); | 825 this.runtimeModel.dispatchEventToListeners(WebInspector.RuntimeModel.Eve
nts.ExecutionContextChanged, this); |
| 826 }, | 826 }, |
| 827 | 827 |
| 828 __proto__: WebInspector.SDKObject.prototype | 828 __proto__: WebInspector.SDKObject.prototype |
| 829 } | 829 }; |
| 830 | 830 |
| 831 /** | 831 /** |
| 832 * @constructor | 832 * @constructor |
| 833 * @extends {WebInspector.SDKObject} | 833 * @extends {WebInspector.SDKObject} |
| 834 * @param {!WebInspector.Target} target | 834 * @param {!WebInspector.Target} target |
| 835 * @param {!WebInspector.RemoteObject} eventTarget | 835 * @param {!WebInspector.RemoteObject} eventTarget |
| 836 * @param {string} type | 836 * @param {string} type |
| 837 * @param {boolean} useCapture | 837 * @param {boolean} useCapture |
| 838 * @param {boolean} passive | 838 * @param {boolean} passive |
| 839 * @param {?WebInspector.RemoteObject} handler | 839 * @param {?WebInspector.RemoteObject} handler |
| 840 * @param {?WebInspector.RemoteObject} originalHandler | 840 * @param {?WebInspector.RemoteObject} originalHandler |
| 841 * @param {!WebInspector.DebuggerModel.Location} location | 841 * @param {!WebInspector.DebuggerModel.Location} location |
| 842 * @param {?WebInspector.RemoteObject} removeFunction | 842 * @param {?WebInspector.RemoteObject} removeFunction |
| 843 * @param {string=} listenerType | 843 * @param {string=} listenerType |
| 844 */ | 844 */ |
| 845 WebInspector.EventListener = function(target, eventTarget, type, useCapture, pas
sive, handler, originalHandler, location, removeFunction, listenerType) | 845 WebInspector.EventListener = function(target, eventTarget, type, useCapture, pas
sive, handler, originalHandler, location, removeFunction, listenerType) |
| 846 { | 846 { |
| 847 WebInspector.SDKObject.call(this, target); | 847 WebInspector.SDKObject.call(this, target); |
| 848 this._eventTarget = eventTarget; | 848 this._eventTarget = eventTarget; |
| 849 this._type = type; | 849 this._type = type; |
| 850 this._useCapture = useCapture; | 850 this._useCapture = useCapture; |
| 851 this._passive = passive; | 851 this._passive = passive; |
| 852 this._handler = handler; | 852 this._handler = handler; |
| 853 this._originalHandler = originalHandler || handler; | 853 this._originalHandler = originalHandler || handler; |
| 854 this._location = location; | 854 this._location = location; |
| 855 var script = location.script(); | 855 var script = location.script(); |
| 856 this._sourceURL = script ? script.contentURL() : ""; | 856 this._sourceURL = script ? script.contentURL() : ""; |
| 857 this._removeFunction = removeFunction; | 857 this._removeFunction = removeFunction; |
| 858 this._listenerType = listenerType || "normal"; | 858 this._listenerType = listenerType || "normal"; |
| 859 } | 859 }; |
| 860 | 860 |
| 861 WebInspector.EventListener.prototype = { | 861 WebInspector.EventListener.prototype = { |
| 862 /** | 862 /** |
| 863 * @return {string} | 863 * @return {string} |
| 864 */ | 864 */ |
| 865 type: function() | 865 type: function() |
| 866 { | 866 { |
| 867 return this._type; | 867 return this._type; |
| 868 }, | 868 }, |
| 869 | 869 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 | 1013 |
| 1014 /** | 1014 /** |
| 1015 * @return {boolean} | 1015 * @return {boolean} |
| 1016 */ | 1016 */ |
| 1017 isNormalListenerType: function() | 1017 isNormalListenerType: function() |
| 1018 { | 1018 { |
| 1019 return this._listenerType === "normal"; | 1019 return this._listenerType === "normal"; |
| 1020 }, | 1020 }, |
| 1021 | 1021 |
| 1022 __proto__: WebInspector.SDKObject.prototype | 1022 __proto__: WebInspector.SDKObject.prototype |
| 1023 } | 1023 }; |
| OLD | NEW |