Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2001)

Unified Diff: editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/util/BrowserManager.java

Issue 9724017: Editor debugger fixes to support Windows. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/util/BrowserManager.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/util/BrowserManager.java (revision 5604)
+++ editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/util/BrowserManager.java (working copy)
@@ -114,6 +114,9 @@
Process process = browserProcesses.get(browserName);
if (!isProcessTerminated(process)) {
+ // TODO(devoncarew): try and us an OS mechanism to send it a graceful shutdown request?
+ // This could avoid the problem w/ Chrome displaying the crashed message on the next run.
+
process.destroy();
// The process needs time to exit.
@@ -228,13 +231,20 @@
// avg: 46ms
timer.startTask("open WIP connection");
- if (tabs.size() == 0 || tabs.get(0).getWebSocketDebuggerUrl() == null) {
+ if (tabs.size() == 0) {
throw new DebugException(new Status(IStatus.ERROR, DartDebugCorePlugin.PLUGIN_ID,
"Unable to connect to Dartium"));
}
- WebkitConnection connection = new WebkitConnection(tabs.get(0).getWebSocketDebuggerUrl());
+ ChromiumTabInfo chromiumTab = findTargetTab(tabs);
+ if (chromiumTab == null || chromiumTab.getWebSocketDebuggerUrl() == null) {
+ throw new DebugException(new Status(IStatus.ERROR, DartDebugCorePlugin.PLUGIN_ID,
+ "Unable to connect to Chromium"));
+ }
+
+ WebkitConnection connection = new WebkitConnection(chromiumTab.getWebSocketDebuggerUrl());
+
DartiumDebugTarget debugTarget = new DartiumDebugTarget(browserName, connection, launch,
runtimeProcess, resourceResolver);
@@ -296,7 +306,7 @@
if (enableDebugging) {
// Start up with a blank page.
- arguments.add("--homepage=about:blank");
+ arguments.add("about:blank");
} else {
arguments.add(url);
}
@@ -304,6 +314,26 @@
return arguments;
}
+ private ChromiumTabInfo findTargetTab(List<ChromiumTabInfo> tabs) {
+ final String aboutBlank = "about:blank";
+
+ for (ChromiumTabInfo tab : tabs) {
+ if (tab.getTitle().contains(aboutBlank)) {
+ return tab;
+ }
+
+ if (tab.getUrl().contains(aboutBlank)) {
+ return tab;
+ }
+ }
+
+ if (tabs.size() == 0) {
+ return tabs.get(0);
+ }
+
+ return null;
+ }
+
private List<ChromiumTabInfo> getChromiumTabs(Process runtimeProcess) throws IOException,
CoreException {
// Give Chromium a maximum of 10 seconds to start up.

Powered by Google App Engine
This is Rietveld 408576698