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

Bug 466625

Summary: [nav] ScriptResolver uses a constant for the git repo name
Product: [ECD] Orion Reporter: Eric Moffatt <emoffatt>
Component: JS ToolsAssignee: Eric Moffatt <emoffatt>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P1 CC: curtis.windatt.public, Michael_Rennie
Version: unspecified   
Target Milestone: 10.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Eric Moffatt CLA 2015-05-06 14:21:16 EDT
Right now there's a constant '/org.eclipse.orion.client/' used to construct the complete path to a file found through the FileMap. There's also a call to 'loadWorkspace' in order to get the WS's id.

After talking with Silenio I'll be creating a patch 'emoffatt/ScriptResolverFix' that will move this functionality into the FileMap code...
Comment 1 Eric Moffatt CLA 2015-05-06 14:25:05 EDT
I've pushed the first version. This replaces the original code with some that sets the prefix on the first call to getWSPath by finding the location of the fileMap.js file itself. It also eliminates the necessity of calling 'getWorkspace' multiple times...

This fixes my require problems at least...
Comment 2 Eric Moffatt CLA 2015-05-12 14:36:26 EDT
I've pushed a (temporary) fix for this to master:

commit: 6c237ecea2d7378cf690418a41704cc51a1a8e67

It uses the fileClient.search API to find the FileMap.js file and parses the necessary prefix out of the returned path.

Two problems here:

1) It's possible that you make have two different 'client' repos in the same workspace and we arbitrarily take the first FileMap found.

2) We know that we want to rework this code to combine the current FileMap and the javascript's 'scriptResolver' into a new service (capable of handling more than one FileMap...)
Comment 3 Michael Rennie CLA 2015-06-04 13:51:22 EDT
There is a bit of a snag with the fix, if fileMap.js is not in the workspace the following exception is reported and no resolution happens (nav hover is busted, for example):

tooltip.js:322 TypeError: Cannot read property 'Location' of undefined
    at Object.internalRegistry.handleServiceError (https://beta3.hub.jazz.net/code/orion/pluginregistry.js:1160:29)
    at Object._messageHandler [as handler] (https://beta3.hub.jazz.net/code/orion/pluginregistry.js:392:55)
    at _channelHandler (https://beta3.hub.jazz.net/code/orion/pluginregistry.js:1202:25)
    at https://beta3.hub.jazz.net/code/orion/pluginregistry.js:1212:21
    at Array.some (native)
    at _messageHandler (https://beta3.hub.jazz.net/code/orion/pluginregistry.js:1210:23)

Looks like we need a check in fileMap.js#getFilePrefix, that if fileMap is not found in the workspace ignore it and return null.
Comment 4 Eric Moffatt CLA 2015-06-04 13:54:26 EDT
Yes, also if it's not found then we know that the orion client isn't in the WS so the getWSPath method should just return null...
Comment 5 Eric Moffatt CLA 2015-06-05 10:21:43 EDT
Just safed up the call so that we capture teh fact that we've tried (and failed) to get the FileMap...

commit: 0205bf96a740cb5791e1691909917f492d3bee06
Comment 6 Michael Rennie CLA 2015-07-16 10:05:39 EDT
marking fixed.