Community
Participate
Working Groups
Here the steps to recreate this scenario: 1. Create a simple static web project, that contains the following: - A JS file/function that has five lines of code for example: console.log('Msg 1'); console.log('Msg 2'); console.log('Msg 3'); console.log('Msg 4'); console.log('Msg 5'); - An HTML that contains a button with onClick event to call the JS function above. 2. Deploy your web project in any web container. 3. Open the URL for the html page in Firefox (Firebug up and running and Crossfire already listening) 4. In Eclipse create a new Remote JavaScript configuration as follow: - In Connect tab, select "Crossfire - Remote Attach" and leave all defaults - In the Source tab, delete the Default "Source Lookup Path" and add your sample project (or workspace) instead. 5. Start to "Debug" 6. Go to Firebug, and select the script tab and set a break in the first console message. 7. Click in the button so then your JS breakpoint is reached. 8. Accept the Eclipse notification to go to debug mode (if not there already) 9. You will have the JS open with something like this path: SWPsampe/WebContent/js/testJsFile.js 10. In Eclipse, try to set breakpoints in any JS line and will notice two things: - Breakpoints are added to the breakpoints view - Breakpoints are not reflected in firebug. 11. In Eclipse, if you click on resume you won't stop in the next breakpoints as you set previously. This scenario works ok by leaving "Default" as the Source. However, this means to retrieve the resource again to the workspace. Firefox versions either 6 or 7 Firebug 1.8.3 Crossfire 0.3a8
Created attachment 206431 [details] work in progress This patch takes a swing at attempting to guess if two paths are equivalent based on how many segments match in the same ordering.
I was comparing this 2 paths: 1. local: /testproject2/WebContent/testscript2.js 2. remote: /testproject2/testscript2.js Didn't work at one. I changed this in order to compare all uri path parts to some local file path segment. if (bppath.segment(i).equals(uri.segment(last1))) { matched_segments++; last1--; } Hope it helps.
Created attachment 207169 [details] update This patch changes things slightly, it provides an extension point so contributors can do their own mapping and script path resolution. As well, it slightly changes the logic for the default matching, but it does not yet include your suggested changes Hernan - the reason being that adds quite a bit of fuzz-factor into the correctness of the match. The new extension point is call scriptResolvers and is available from the jsdt.debug.core.
Created attachment 207179 [details] update2 This update fixes an issue found for global suspend, and provides a toggle breakpoint adapter for HTML files (not quite working yet)
Created attachment 207338 [details] update This patch provides an implementation of getFile in the manager and HTML breakpoint hooks. It also changes the logic a bit to not have JSDT debug provide a script resolver, instead it uses the old logic of script resolution as a fall-back in the event there are no resolvers defined or none of the resolvers can determine script matches.
I've tested this patch extending the scriptResolver and seems to be working fine. My extension is being called when resource matching is required in breakpoint setting and script loading.
Thanks for the testing Hernan. I have released the new API with a slight change - rather than have consumers implement the IScriptResolver interface I added an abstract class for them to extend.