Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 480461

Summary: TypeError: block is undefined (in TextStyler.js)
Product: [ECD] Orion Reporter: Grant Gayed <grant_gayed>
Component: EditorAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 13.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Grant Gayed CLA 2015-10-22 16:02:23 EDT
The following was logged with GA runtime error tracking from a Firefox user:

_getStyles: function(block, model, text, offset, startIndex) {
	var end = offset + text.length;
	var styles = [];
	var start = offset + startIndex, blocks = block.getBlocks(); // <-----

The received 'block' arg can be undefined.  The logged stack indicates this was called from _onLineStyle(), so 'this._rootBlock' was undefined at the time (either called too early or after disposal).  The full stack:

l.prototype._getStyles@/code/edit/edit.js:32:27774 l.prototype._onLineStyle@/code/edit/edit.js:32:29040 l/this._listener.onLineStyle@/code/edit/edit.js:32:10643 e.prototype._dispatchEvent@/code/edit/edit.js:7:594 e.prototype.dispatchEvent@/code/edit/edit.js:7:335 S.prototype.onLineStyle@/code/edit/edit.js:23:23159 b.prototype._createLine@/code/edit/edit.js:23:3857 b.prototype.create@/code/edit/edit.js:23:3639 b.prototype._ensureCreated@/code/edit/edit.js:23:6994 b.prototype.getOffset@/code/edit/edit.js:23:13734 S.prototype._setSelectionTo@/code/edit/edit.js:26:1107 S.prototype._handleMouseMove@/code/edit/edit.js:24:7676 S.prototype._hookEvents/<.handler@/code/edit/edit.js:25:21606
Comment 1 Grant Gayed CLA 2016-08-25 10:45:33 EDT
Was not able to reproduce this, but the logged stack is clear, so added a check to ensure that this._rootBlock is valid.  Commit: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=3c8232fe31b8c4e5558508022a48eb706b3a5488 .