Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Sources.DebuggerPausedMessage = class { | 7 Sources.DebuggerPausedMessage = class { |
| 8 constructor() { | 8 constructor() { |
| 9 this._element = createElementWithClass('div', 'paused-message flex-none'); | 9 this._element = createElementWithClass('div', 'paused-message flex-none'); |
| 10 var root = UI.createShadowRootWithCoreStyles(this._element, 'sources/debugge rPausedMessage.css'); | 10 var root = UI.createShadowRootWithCoreStyles(this._element, 'sources/debugge rPausedMessage.css'); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 var descriptionFirstLine = description.split('\n', 1)[0]; | 44 var descriptionFirstLine = description.split('\n', 1)[0]; |
| 45 messageWrapper = buildWrapper(Common.UIString('Paused on exception'), desc riptionFirstLine, description); | 45 messageWrapper = buildWrapper(Common.UIString('Paused on exception'), desc riptionFirstLine, description); |
| 46 } else if (details.reason === SDK.DebuggerModel.BreakReason.PromiseRejection ) { | 46 } else if (details.reason === SDK.DebuggerModel.BreakReason.PromiseRejection ) { |
| 47 var description = details.auxData['description'] || details.auxData['value '] || ''; | 47 var description = details.auxData['description'] || details.auxData['value '] || ''; |
| 48 var descriptionFirstLine = description.split('\n', 1)[0]; | 48 var descriptionFirstLine = description.split('\n', 1)[0]; |
| 49 messageWrapper = buildWrapper(Common.UIString('Paused on promise rejection '), descriptionFirstLine, description); | 49 messageWrapper = buildWrapper(Common.UIString('Paused on promise rejection '), descriptionFirstLine, description); |
| 50 } else if (details.reason === SDK.DebuggerModel.BreakReason.Assert) { | 50 } else if (details.reason === SDK.DebuggerModel.BreakReason.Assert) { |
| 51 messageWrapper = buildWrapper(Common.UIString('Paused on assertion')); | 51 messageWrapper = buildWrapper(Common.UIString('Paused on assertion')); |
| 52 } else if (details.reason === SDK.DebuggerModel.BreakReason.DebugCommand) { | 52 } else if (details.reason === SDK.DebuggerModel.BreakReason.DebugCommand) { |
| 53 messageWrapper = buildWrapper(Common.UIString('Paused on debugged function ')); | 53 messageWrapper = buildWrapper(Common.UIString('Paused on debugged function ')); |
| 54 } else if (details.reason === SDK.DebuggerModel.BreakReason.OOM) { | |
| 55 messageWrapper = buildWrapper(Common.UIString('Paused before potential OOM ')); | |
|
dgozman
2017/01/12 23:48:20
... out-of-memory crash
kozy
2017/01/25 02:52:06
Done.
| |
| 54 } else if (details.callFrames.length) { | 56 } else if (details.callFrames.length) { |
| 55 var uiLocation = debuggerWorkspaceBinding.rawLocationToUILocation(details. callFrames[0].location()); | 57 var uiLocation = debuggerWorkspaceBinding.rawLocationToUILocation(details. callFrames[0].location()); |
| 56 var breakpoint = uiLocation ? | 58 var breakpoint = uiLocation ? |
| 57 breakpointManager.findBreakpoint(uiLocation.uiSourceCode, uiLocation.l ineNumber, uiLocation.columnNumber) : | 59 breakpointManager.findBreakpoint(uiLocation.uiSourceCode, uiLocation.l ineNumber, uiLocation.columnNumber) : |
| 58 null; | 60 null; |
| 59 var defaultText = breakpoint ? Common.UIString('Paused on breakpoint') : C ommon.UIString('Debugger paused'); | 61 var defaultText = breakpoint ? Common.UIString('Paused on breakpoint') : C ommon.UIString('Debugger paused'); |
| 60 messageWrapper = buildWrapper(defaultText); | 62 messageWrapper = buildWrapper(defaultText); |
| 61 } else { | 63 } else { |
| 62 console.warn( | 64 console.warn( |
| 63 'ScriptsPanel paused, but callFrames.length is zero.'); // TODO remov e this once we understand this case better | 65 'ScriptsPanel paused, but callFrames.length is zero.'); // TODO remov e this once we understand this case better |
| 64 } | 66 } |
| 65 | 67 |
| 66 var errorLike = details.reason === SDK.DebuggerModel.BreakReason.Exception | | | 68 var errorLike = details.reason === SDK.DebuggerModel.BreakReason.Exception | | |
| 67 details.reason === SDK.DebuggerModel.BreakReason.PromiseRejection || | 69 details.reason === SDK.DebuggerModel.BreakReason.PromiseRejection || |
| 68 details.reason === SDK.DebuggerModel.BreakReason.Assert; | 70 details.reason === SDK.DebuggerModel.BreakReason.Assert || |
| 71 details.reason === SDK.DebuggerModel.BreakReason.OOM; | |
| 69 status.classList.toggle('error-reason', errorLike); | 72 status.classList.toggle('error-reason', errorLike); |
| 70 if (messageWrapper) | 73 if (messageWrapper) |
| 71 status.appendChild(messageWrapper); | 74 status.appendChild(messageWrapper); |
| 72 | 75 |
| 73 /** | 76 /** |
| 74 * @param {string} mainText | 77 * @param {string} mainText |
| 75 * @param {string=} subText | 78 * @param {string=} subText |
| 76 * @param {string=} title | 79 * @param {string=} title |
| 77 * @return {!Element} | 80 * @return {!Element} |
| 78 */ | 81 */ |
| 79 function buildWrapper(mainText, subText, title) { | 82 function buildWrapper(mainText, subText, title) { |
| 80 var messageWrapper = createElement('span'); | 83 var messageWrapper = createElement('span'); |
| 81 var mainElement = messageWrapper.createChild('div', 'status-main'); | 84 var mainElement = messageWrapper.createChild('div', 'status-main'); |
| 82 mainElement.appendChild(UI.Icon.create('smallicon-info', 'status-icon')); | 85 mainElement.appendChild(UI.Icon.create('smallicon-info', 'status-icon')); |
| 83 mainElement.appendChild(createTextNode(mainText)); | 86 mainElement.appendChild(createTextNode(mainText)); |
| 84 if (subText) { | 87 if (subText) { |
| 85 var subElement = messageWrapper.createChild('div', 'status-sub monospace '); | 88 var subElement = messageWrapper.createChild('div', 'status-sub monospace '); |
| 86 subElement.textContent = subText; | 89 subElement.textContent = subText; |
| 87 } | 90 } |
| 88 if (title) | 91 if (title) |
| 89 messageWrapper.title = title; | 92 messageWrapper.title = title; |
| 90 return messageWrapper; | 93 return messageWrapper; |
| 91 } | 94 } |
| 92 } | 95 } |
| 93 }; | 96 }; |
| OLD | NEW |