Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318251 - Scripts with no name do not get ordered correctly in the Scripts node
Summary: Scripts with no name do not get ordered correctly in the Scripts node
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: Debug (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2.1   Edit
Assignee: Michael Rennie CLA
QA Contact: Simon Kaegi CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-28 16:52 EDT by Michael Rennie CLA
Modified: 2010-06-30 11:19 EDT (History)
1 user (show)

See Also:
simon_kaegi: review+


Attachments
proposed fix (1.75 KB, patch)
2010-06-28 16:52 EDT, Michael Rennie CLA
no flags Details | Diff
better patch (5.07 KB, patch)
2010-06-29 10:40 EDT, Michael Rennie CLA
no flags Details | Diff
screen shot (133.25 KB, image/png)
2010-06-29 10:45 EDT, Michael Rennie CLA
no flags Details
even better (10.82 KB, patch)
2010-06-29 16:24 EDT, Michael Rennie CLA
no flags Details | Diff
updated screen shot (66.52 KB, image/png)
2010-06-29 16:26 EDT, Michael Rennie CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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