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

Bug 318251

Summary: Scripts with no name do not get ordered correctly in the Scripts node
Product: [WebTools] JSDT Reporter: Michael Rennie <Michael_Rennie>
Component: DebugAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact: Simon Kaegi <simon_kaegi>
Severity: normal    
Priority: P3 CC: thatnitind
Version: 3.2Flags: simon_kaegi: review+
Target Milestone: 3.2.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
proposed fix
none
better patch
none
screen shot
none
even better
none
updated screen shot none

Description Michael Rennie CLA 2010-06-28 16:52:05 EDT
Created attachment 172960 [details]
proposed fix

code from HEAD

If we load a script with no name (a <script></script> block for example) it will not appear ordered correctly in the Scripts node in the debug view because it has no last segment in its URI.

We should account for this by given it a default name like "top-level" or the like.
Comment 1 Michael Rennie CLA 2010-06-28 16:53:03 EDT
Nitin, Simon, any thoughts on naming for scripts in this case?
Comment 2 Michael Rennie CLA 2010-06-28 16:59:58 EDT
Steps to test:

1. open Firefox
2. with the experimental Crossfire bundle installed launch the Crossfire Listening connector
3. in Firefox connect back to Eclipse with Crossfire
4. load www.google.ca

Expected

everything loads as expected all script ordered nicely

Happens

everything loads as expected and you see a blank named script loaded with the URL http://www.google.ca/ that is out of order
Comment 3 Michael Rennie CLA 2010-06-29 10:40:43 EDT
Created attachment 173007 [details]
better patch

This is a better patch. 

1. It makes IScripts' comparable 
2. Name resolution takes the last segment of the URI if present, the second last segment if no last segment, or the scheme specific part if the segment count equals 0.
3. will sub-sort based on the toString() of the URI if the resolved name equals another script.
Comment 4 Michael Rennie CLA 2010-06-29 10:45:23 EDT
Created attachment 173010 [details]
screen shot

this screen shot shows the improved sorting + script name resolution
Comment 5 Michael Rennie CLA 2010-06-29 16:24:03 EDT
Created attachment 173042 [details]
even better

This patch changes the display of the scripts slightly to not be <name> (<uri>) but instead just makes it <uri>. This feels cleaner, because now the sorting groups scripts with similar URIs, which feels more like how Firebug, etc. groups scripts.

The patch also adds a utility method to handle script URIs from a <script></script> block without blowing up.
Comment 6 Michael Rennie CLA 2010-06-29 16:26:22 EDT
Created attachment 173043 [details]
updated screen shot
Comment 7 Simon Kaegi CLA 2010-06-29 23:06:10 EDT
Yep, agree this is clean.
Comment 8 Michael Rennie CLA 2010-06-30 11:19:36 EDT
released to HEAD and 3.2.1