| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 /** @type {!Common.Object} */ | 59 /** @type {!Common.Object} */ |
| 60 this._breakpointResolvedEventTarget = new Common.Object(); | 60 this._breakpointResolvedEventTarget = new Common.Object(); |
| 61 | 61 |
| 62 this._isPausing = false; | 62 this._isPausing = false; |
| 63 Common.moduleSetting('pauseOnExceptionEnabled').addChangeListener(this._paus
eOnExceptionStateChanged, this); | 63 Common.moduleSetting('pauseOnExceptionEnabled').addChangeListener(this._paus
eOnExceptionStateChanged, this); |
| 64 Common.moduleSetting('pauseOnCaughtException').addChangeListener(this._pause
OnExceptionStateChanged, this); | 64 Common.moduleSetting('pauseOnCaughtException').addChangeListener(this._pause
OnExceptionStateChanged, this); |
| 65 Common.moduleSetting('disableAsyncStackTraces').addChangeListener(this._asyn
cStackTracesStateChanged, this); | 65 Common.moduleSetting('disableAsyncStackTraces').addChangeListener(this._asyn
cStackTracesStateChanged, this); |
| 66 | 66 |
| 67 /** @type {!Map<string, string>} */ | 67 /** @type {!Map<string, string>} */ |
| 68 this._fileURLToNodeJSPath = new Map(); | 68 this._fileURLToNodeJSPath = new Map(); |
| 69 this.enableDebugger(); | 69 this._enableDebugger(); |
| 70 | 70 |
| 71 /** @type {!Map<string, string>} */ | 71 /** @type {!Map<string, string>} */ |
| 72 this._stringMap = new Map(); | 72 this._stringMap = new Map(); |
| 73 this._sourceMapManager.setEnabled(Common.moduleSetting('jsSourceMapsEnabled'
).get()); | 73 this._sourceMapManager.setEnabled(Common.moduleSetting('jsSourceMapsEnabled'
).get()); |
| 74 Common.moduleSetting('jsSourceMapsEnabled') | 74 Common.moduleSetting('jsSourceMapsEnabled') |
| 75 .addChangeListener(event => this._sourceMapManager.setEnabled(/** @type
{boolean} */ (event.data))); | 75 .addChangeListener(event => this._sourceMapManager.setEnabled(/** @type
{boolean} */ (event.data))); |
| 76 } | 76 } |
| 77 | 77 |
| 78 /** | 78 /** |
| 79 * @param {string} executionContextId | 79 * @param {string} executionContextId |
| (...skipping 22 matching lines...) Expand all Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 /** | 104 /** |
| 105 * @return {boolean} | 105 * @return {boolean} |
| 106 */ | 106 */ |
| 107 debuggerEnabled() { | 107 debuggerEnabled() { |
| 108 return !!this._debuggerEnabled; | 108 return !!this._debuggerEnabled; |
| 109 } | 109 } |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * @param {function()=} callback | 112 * @return {!Promise} |
| 113 */ | 113 */ |
| 114 enableDebugger(callback) { | 114 _enableDebugger() { |
| 115 if (this._debuggerEnabled) { | 115 if (this._debuggerEnabled) |
| 116 if (callback) | 116 return Promise.resolve(); |
| 117 callback(); | |
| 118 return; | |
| 119 } | |
| 120 this._agent.enable(callback); | |
| 121 this._debuggerEnabled = true; | 117 this._debuggerEnabled = true; |
| 118 |
| 119 var enablePromise = new Promise(fulfill => this._agent.enable(fulfill)); |
| 122 this._pauseOnExceptionStateChanged(); | 120 this._pauseOnExceptionStateChanged(); |
| 123 this._asyncStackTracesStateChanged(); | 121 this._asyncStackTracesStateChanged(); |
| 124 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasEnabled, t
his); | 122 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasEnabled, t
his); |
| 123 return enablePromise; |
| 125 } | 124 } |
| 126 | 125 |
| 127 /** | 126 /** |
| 128 * @param {function()=} callback | 127 * @return {!Promise} |
| 129 */ | 128 */ |
| 130 disableDebugger(callback) { | 129 _disableDebugger() { |
| 131 if (!this._debuggerEnabled) { | 130 if (!this._debuggerEnabled) |
| 132 if (callback) | 131 return Promise.resolve(); |
| 133 callback(); | 132 this._debuggerEnabled = false; |
| 134 return; | |
| 135 } | |
| 136 | 133 |
| 137 this._agent.disable(callback); | 134 var disablePromise = new Promise(fulfill => this._agent.disable(fulfill)); |
| 138 this._debuggerEnabled = false; | |
| 139 this._isPausing = false; | 135 this._isPausing = false; |
| 140 this._asyncStackTracesStateChanged(); | 136 this._asyncStackTracesStateChanged(); |
| 141 this.globalObjectCleared(); | 137 this.globalObjectCleared(); |
| 142 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasDisabled); | 138 this.dispatchEventToListeners(SDK.DebuggerModel.Events.DebuggerWasDisabled); |
| 139 return disablePromise; |
| 143 } | 140 } |
| 144 | 141 |
| 145 /** | 142 /** |
| 146 * @param {boolean} skip | 143 * @param {boolean} skip |
| 147 */ | 144 */ |
| 148 _skipAllPauses(skip) { | 145 _skipAllPauses(skip) { |
| 149 if (this._skipAllPausesTimeout) { | 146 if (this._skipAllPausesTimeout) { |
| 150 clearTimeout(this._skipAllPausesTimeout); | 147 clearTimeout(this._skipAllPausesTimeout); |
| 151 delete this._skipAllPausesTimeout; | 148 delete this._skipAllPausesTimeout; |
| 152 } | 149 } |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 this._sourceMapManager.dispose(); | 846 this._sourceMapManager.dispose(); |
| 850 Common.moduleSetting('pauseOnExceptionEnabled').removeChangeListener(this._p
auseOnExceptionStateChanged, this); | 847 Common.moduleSetting('pauseOnExceptionEnabled').removeChangeListener(this._p
auseOnExceptionStateChanged, this); |
| 851 Common.moduleSetting('pauseOnCaughtException').removeChangeListener(this._pa
useOnExceptionStateChanged, this); | 848 Common.moduleSetting('pauseOnCaughtException').removeChangeListener(this._pa
useOnExceptionStateChanged, this); |
| 852 Common.moduleSetting('disableAsyncStackTraces').removeChangeListener(this._a
syncStackTracesStateChanged, this); | 849 Common.moduleSetting('disableAsyncStackTraces').removeChangeListener(this._a
syncStackTracesStateChanged, this); |
| 853 } | 850 } |
| 854 | 851 |
| 855 /** | 852 /** |
| 856 * @override | 853 * @override |
| 857 * @return {!Promise} | 854 * @return {!Promise} |
| 858 */ | 855 */ |
| 859 suspendModel() { | 856 async suspendModel() { |
| 860 return new Promise(promiseBody.bind(this)); | 857 await this._disableDebugger(); |
| 861 | |
| 862 /** | |
| 863 * @param {function()} fulfill | |
| 864 * @this {SDK.DebuggerModel} | |
| 865 */ | |
| 866 function promiseBody(fulfill) { | |
| 867 this.disableDebugger(fulfill); | |
| 868 } | |
| 869 } | 858 } |
| 870 | 859 |
| 871 /** | 860 /** |
| 872 * @override | 861 * @override |
| 873 * @return {!Promise} | 862 * @return {!Promise} |
| 874 */ | 863 */ |
| 875 resumeModel() { | 864 async resumeModel() { |
| 876 return new Promise(promiseBody.bind(this)); | 865 await this._enableDebugger(); |
| 877 | |
| 878 /** | |
| 879 * @param {function()} fulfill | |
| 880 * @this {SDK.DebuggerModel} | |
| 881 */ | |
| 882 function promiseBody(fulfill) { | |
| 883 this.enableDebugger(fulfill); | |
| 884 } | |
| 885 } | 866 } |
| 886 | 867 |
| 887 /** | 868 /** |
| 888 * @param {string} string | 869 * @param {string} string |
| 889 * @return {string} string | 870 * @return {string} string |
| 890 */ | 871 */ |
| 891 _internString(string) { | 872 _internString(string) { |
| 892 if (!this._stringMap.has(string)) | 873 if (!this._stringMap.has(string)) |
| 893 this._stringMap.set(string, string); | 874 this._stringMap.set(string, string); |
| 894 return this._stringMap.get(string); | 875 return this._stringMap.get(string); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 stack.callFrames.shift(); | 1443 stack.callFrames.shift(); |
| 1463 if (previous && (!stack.callFrames.length && !stack.promiseCreationFrame)) | 1444 if (previous && (!stack.callFrames.length && !stack.promiseCreationFrame)) |
| 1464 previous.parent = stack.parent; | 1445 previous.parent = stack.parent; |
| 1465 else | 1446 else |
| 1466 previous = stack; | 1447 previous = stack; |
| 1467 stack = stack.parent; | 1448 stack = stack.parent; |
| 1468 } | 1449 } |
| 1469 return asyncStackTrace; | 1450 return asyncStackTrace; |
| 1470 } | 1451 } |
| 1471 }; | 1452 }; |
| OLD | NEW |