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

Bug 458570

Summary: Error computing hover tooltip while typing <string>.substring
Product: [ECD] Orion Reporter: Grant Gayed <grant_gayed>
Component: ClientAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, emoffatt, Michael_Rennie
Version: unspecified   
Target Milestone: 9.0   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Grant Gayed CLA 2015-01-27 13:53:23 EST
- in an open JS editor type "hi". (type the quotes)
  -> a content assist "window" is shown
- now type "substring(" (no quotes), and as you're typing it there's a good chance that the trace below will be written to the browser console (seems to be timing-dependent but is frequent)

Error computing hover tooltip tooltip.js:376
Cancel: Cancel
    at cancel (http://self-host.orion.eclipse.org:9000/orion/Deferred.js:210:35)
    at Object.cancel (http://self-host.orion.eclipse.org:9000/orion/Deferred.js:275:17)
    at http://self-host.orion.eclipse.org:9000/orion/editor/tooltip.js:165:11
    at Array.forEach (native)
    at Object.Tooltip.hide (http://self-host.orion.eclipse.org:9000/orion/editor/tooltip.js:164:21)
    at Object.objects.mixin.install._listener.onSelection (http://self-host.orion.eclipse.org:9000/orion/editor/editor.js:856:29)
    at Object.EventTarget._dispatchEvent (http://self-host.orion.eclipse.org:9000/orion/editor/eventTarget.js:76:12)
    at Object.EventTarget.dispatchEvent (http://self-host.orion.eclipse.org:9000/orion/editor/eventTarget.js:62:9)
    at Object.TextView.onSelection (http://self-host.orion.eclipse.org:9000/orion/editor/textView.js:2755:16)
    at Object.TextView._setSelection (http://self-host.orion.eclipse.org:9000/orion/editor/textView.js:6854:11)
Comment 1 Curtis Windatt CLA 2015-02-26 16:59:14 EST
I can't reproduce the problem but the tooltip logging any problem to the console is often obnoxious.  It should be improved as a side effect of Bug 450188.
Comment 2 Curtis Windatt CLA 2015-03-31 16:19:26 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=5af985faa64d6abb7d226d530f827d475ce5fdfb
Fixed in master

The problem is that while processing the hover promise we may call hide which will attempt to cancel any outstanding promises.  Under normal circumstances, the ordering will be such that the promise will be marked as resolved, but sometimes (especially when the plug-ins are first loading), this fails.  The cancel throws an error and the hover promise interprets that as a problem creating the hover content, printing it to the console.

Not sure if there is a more elegant solution, but this fix removes the promise from the list of pending promises as soon as it starts to execute.