mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WEB-13490 Debug for Meteor packages doesn't work
This commit is contained in:
+2
-1
@@ -49,9 +49,10 @@ public final class SourceMapDecoder {
|
||||
|
||||
public interface SourceResolverFactory {
|
||||
@NotNull
|
||||
SourceResolver create(@NotNull List<String> sourcesUrl, @Nullable List<String> sourcesContent);
|
||||
SourceResolver create(@NotNull List<String> sourceUrls, @Nullable List<String> sourceContents);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static SourceMap decode(@NotNull String contents, @NotNull SourceResolverFactory sourceResolverFactory) throws IOException {
|
||||
if (contents.isEmpty()) {
|
||||
throw new IOException("source map contents cannot be empty");
|
||||
|
||||
+10
-10
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
|
||||
public class SourceResolver {
|
||||
private final List<String> rawSources;
|
||||
@Nullable private final List<String> sourcesContent;
|
||||
@Nullable private final List<String> sourceContents;
|
||||
|
||||
final Url[] canonicalizedSources;
|
||||
private final ObjectIntHashMap<Url> canonicalizedSourcesMap;
|
||||
@@ -30,15 +30,15 @@ public class SourceResolver {
|
||||
// absoluteLocalPathToSourceIndex contains canonical paths too, but this map contains only used (specified in the source map) path
|
||||
private String[] sourceIndexToAbsoluteLocalPath;
|
||||
|
||||
public SourceResolver(@NotNull List<String> sourcesUrl, boolean trimFileScheme, @Nullable Url baseFileUrl, @Nullable List<String> sourcesContent) {
|
||||
rawSources = sourcesUrl;
|
||||
this.sourcesContent = sourcesContent;
|
||||
canonicalizedSources = new Url[sourcesUrl.size()];
|
||||
public SourceResolver(@NotNull List<String> sourceUrls, boolean trimFileScheme, @Nullable Url baseFileUrl, @Nullable List<String> sourceContents) {
|
||||
rawSources = sourceUrls;
|
||||
this.sourceContents = sourceContents;
|
||||
canonicalizedSources = new Url[sourceUrls.size()];
|
||||
canonicalizedSourcesMap = SystemInfo.isFileSystemCaseSensitive
|
||||
? new ObjectIntHashMap<Url>(canonicalizedSources.length)
|
||||
: new ObjectIntHashMap<Url>(canonicalizedSources.length, Urls.getCaseInsensitiveUrlHashingStrategy());
|
||||
for (int i = 0; i < sourcesUrl.size(); i++) {
|
||||
String rawSource = sourcesUrl.get(i);
|
||||
for (int i = 0; i < sourceUrls.size(); i++) {
|
||||
String rawSource = sourceUrls.get(i);
|
||||
Url url = canonicalizeUrl(rawSource, baseFileUrl, trimFileScheme, i);
|
||||
canonicalizedSources[i] = url;
|
||||
canonicalizedSourcesMap.put(url, i);
|
||||
@@ -50,7 +50,7 @@ public class SourceResolver {
|
||||
}
|
||||
|
||||
// see canonicalizeUri kotlin impl and https://trac.webkit.org/browser/trunk/Source/WebCore/inspector/front-end/ParsedURL.js completeURL
|
||||
private Url canonicalizeUrl(@NotNull String url, @Nullable Url baseUrl, boolean trimFileScheme, int sourceIndex) {
|
||||
protected Url canonicalizeUrl(@NotNull String url, @Nullable Url baseUrl, boolean trimFileScheme, int sourceIndex) {
|
||||
if (trimFileScheme && url.startsWith(StandardFileSystems.FILE_PROTOCOL_PREFIX)) {
|
||||
return Urls.newLocalFileUrl(FileUtil.toCanonicalPath(VfsUtilCore.toIdeaUrl(url, true).substring(StandardFileSystems.FILE_PROTOCOL_PREFIX.length()), '/'));
|
||||
}
|
||||
@@ -115,12 +115,12 @@ public class SourceResolver {
|
||||
|
||||
@Nullable
|
||||
public String getSourceContent(@NotNull MappingEntry entry) {
|
||||
if (ContainerUtil.isEmpty(sourcesContent)) {
|
||||
if (ContainerUtil.isEmpty(sourceContents)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int index = entry.getSource();
|
||||
return index < 0 || index >= sourcesContent.size() ? null : sourcesContent.get(index);
|
||||
return index < 0 || index >= sourceContents.size() ? null : sourceContents.get(index);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+5
-1
@@ -16,6 +16,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* Currently WIP implementation doesn't keep such map due to protocol issue. But V8 does.
|
||||
*/
|
||||
public abstract class ValueManager<VM extends Vm> {
|
||||
public static final RuntimeException OBSOLETE_CONTEXT_ERROR = Promise.createError("Obsolete context");
|
||||
public static final Promise<?> OBSOLETE_CONTEXT_PROMISE = Promise.reject(OBSOLETE_CONTEXT_ERROR);
|
||||
|
||||
private final AtomicInteger cacheStamp = new AtomicInteger();
|
||||
private volatile boolean obsolete;
|
||||
|
||||
@@ -61,7 +64,8 @@ public abstract class ValueManager<VM extends Vm> {
|
||||
|
||||
@NotNull
|
||||
public static <T> Promise<T> reject() {
|
||||
return Promise.reject("Obsolete context");
|
||||
//noinspection unchecked
|
||||
return (Promise<T>)OBSOLETE_CONTEXT_PROMISE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+4
-1
@@ -5,6 +5,7 @@ import com.intellij.xdebugger.XDebugSession;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.concurrency.Promise;
|
||||
import org.jetbrains.debugger.values.ValueManager;
|
||||
import org.jetbrains.rpc.CommandProcessor;
|
||||
|
||||
public final class RejectErrorReporter implements Consumer<Throwable> {
|
||||
@@ -25,6 +26,8 @@ public final class RejectErrorReporter implements Consumer<Throwable> {
|
||||
if (!(error instanceof Promise.MessageError)) {
|
||||
CommandProcessor.LOG.error(error);
|
||||
}
|
||||
session.reportError((description == null ? "" : description + ": ") + error.getMessage());
|
||||
if (error != ValueManager.OBSOLETE_CONTEXT_ERROR) {
|
||||
session.reportError((description == null ? "" : description + ": ") + error.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user