Skip to content

Commit

Permalink
JS CDT Debugger: Improve handling of paths
Browse files Browse the repository at this point in the history
Breaking change: URL fields in CDT protocol may hold urls and "names",
the latter are incompatible with URLs

Closes: #7797
  • Loading branch information
matthiasblaesing committed Nov 1, 2024
1 parent 1efc17e commit 8d789ca
Show file tree
Hide file tree
Showing 19 changed files with 229 additions and 293 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ javac.release=11
javadoc.arch=${basedir}/arch.xml

is.eager=true
spec.version.base=1.3.0
spec.version.base=1.4.0
4 changes: 2 additions & 2 deletions webcommon/javascript.cdtdebug.ui/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.0</specification-version>
<release-version>2</release-version>
<specification-version>2.0</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void notifyCurrentFrame(CallFrame cf) {
return ;
}
topFrameShown = false;
EditorUtils.showFrameLine(dbg, cf, true);
annotationProcessor.execute(() -> EditorUtils.showFrameLine(dbg, cf, true));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import java.awt.datatransfer.Transferable;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import org.netbeans.lib.chrome_devtools_protocol.debugger.CallFrame;
import org.netbeans.modules.javascript.cdtdebug.CDTDebugger;
Expand Down Expand Up @@ -189,7 +191,16 @@ public String getDisplayName(Object node) throws UnknownTypeException {
static String getScriptName(ScriptsHandler scriptsHandler, CallFrame cf) {
CDTScript script = scriptsHandler.getScript(cf.getLocation().getScriptId());
if (script != null) {
String scriptName = script.getUrl().getPath();
String urlString = script.getUrl();
String scriptName = urlString;
try {
URI url = new URI(urlString);
if(url.getPath() != null) {
scriptName = url.getPath();
}
} catch (URISyntaxException ex) {
return urlString;
}
if (scriptName == null) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion webcommon/javascript.cdtdebug/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ javac.release=11
javadoc.arch=${basedir}/arch.xml

is.autoload=true
spec.version.base=1.3.0
spec.version.base=1.4.0
4 changes: 2 additions & 2 deletions webcommon/javascript.cdtdebug/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.0</specification-version>
<release-version>2</release-version>
<specification-version>2.0</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
package org.netbeans.modules.javascript.cdtdebug;

import java.net.URI;
import java.util.Objects;
import org.netbeans.lib.chrome_devtools_protocol.debugger.ScriptFailedToParse;
import org.netbeans.lib.chrome_devtools_protocol.debugger.ScriptParsed;

public class CDTScript {
private final String scriptId;
private final URI url;
private final String url;
private final int startLine;
private final int startColumn;
private final int endLine;
Expand Down Expand Up @@ -59,7 +58,7 @@ public String getScriptId() {
return scriptId;
}

public URI getUrl() {
public String getUrl() {
return url;
}

Expand Down
Loading

0 comments on commit 8d789ca

Please sign in to comment.