Instructions for Connect to Chrome??

241 views
Skip to first unread message

Jonathon Lamon

unread,
Nov 20, 2014, 7:49:19 PM11/20/14
to sd...@googlegroups.com
Are there any instructions or example setup for Connect to Chrome settings?  I specifically want to use this as I have my development spread across mulitple VMs and across multiple mobile devices.

My specific question is in regards to the "URL Filter" setting.  What is its syntax?

Jonathon Lamon

unread,
Nov 20, 2014, 11:16:01 PM11/20/14
to sd...@googlegroups.com
So I got this to work partially in localhost, but break points I set are not being triggered in eclipse.  However, I could tell that it was connecting because I set it to output stderr/prn and it did receive the console output.

Lubuntu 14.04
Chrome 39.0.2171.65 (64-bit)
Eclipse Luna 4.4.1 Build id 20140925-1800
SDBG  0.9.1.201410281834
GPE 3.8.0.v20141030215-rel-r44
GWT 2.6.1, running in sdm

Ivan Markov

unread,
Nov 21, 2014, 2:54:56 AM11/21/14
to sd...@googlegroups.com
There are no good instructions (yet) how to use connect to Chrome, but I advise against using it. Here's some info to get you started:

0. You have to watch the Video on the website first

1. I really suggest switching to GWT 2.7 if possible - if only for development. Using SuperDevMode and SDBG is much easier with GWT 2.7

2. For your PC, I really advise against using "Connect to to Chrome". There is just no benefit in using that over "Launch Chrome". If you really insist, I can provide some further insights but this option is really there just for completeness. Normally, it is not used.

3. For your mobile phone/tablet, you should use "Connect to Chrome for Mobile", which works very well. The "URL Filter" is also present there and it serves two purposes:
- To filter out the opened tabs in your Mobile Chrome (if any), and only show a subset of these - this subset, which is matching your URL FIlter. 
- If you check "Launch a new browser tab with this URL if there is none opened", then the URL Filter (which is automatically renamed to just "URL" then) is used to pre-populate the new Mobile Chrome instance. In any case, the URL/URL Filter should contain the URL of your web server app. I.e. something like http://localhost:<?8080?>/context-path. Note that this should NOT be the URL of the SDM code server. Again, if possible, switch to GWT 2.7 and watch the video on the website - in the video, you'll see with what I prepopulate the URL parameter.

4. Besides using "Connect to Chrome for Mobile", you may need to do some port forwarding, as normally your Mobile Chrome won't see your localhost, unless you do some special tricks. For these, you need to go to "Run Configurations..." and then select "Forward ports to Android Device". There, you need to enter two rules, one for your website, and another, for GWT's SuperDevMode code server:
Android Device         Website
==========================
localhost:<?8080?>  localhost:<?8080?>
localhost:9876          localhost:9876

This is no different from what you would do if you use the Chrome Dev Tools for debugging your localhost website with your mobile device: https://developer.chrome.com/devtools/docs/remote-debugging





Ivan Markov

unread,
Nov 21, 2014, 2:57:24 AM11/21/14
to sd...@googlegroups.com
OK you got it working with "Launch Chrome" or with "Connect to Chrome for Mobile"?
What breakpoints do not trigger? Could that be because these breakpoints are put in a code which triggers very early, i.e. your onModuleLoad() GWT module entry? These brekapoints are known not to trigger due to a race condition when loading the script from the browser.

Jonathon Lamon

unread,
Nov 21, 2014, 8:51:38 AM11/21/14
to sd...@googlegroups.com
1.  Launch to Chrome, yesterday, I was receiving a "Connection Refused Dialog" in Eclipse and the Launch would never complete.  However, attempting this again this morning, it appears to now be connecting on Launch to Chrome.

2. Connect to Chrome.  I am attempting to understand this process because I do alot of development across browser and vm.  So my eclipse may be running in a VM and the browser in another or the host machine.  I just want to understand if there is any special syntax to the URL Filter.  Everything else seems pretty self explanatory.

3. I am placing a breakpoint in Eclipse within a callback handled by click handler.  However, the break point is never triggered.  I think this may not be a problem with SDBG after further investigation.  I think the problem is in Chrome's source mapping.  There are multiple inner classes in the class in question and it seems that Chrome or GWT is not appropriately mapping the JS -> Java.  The breakpoints don't trigger appropriately in the Chrome JS inspector either where I am placing them.  If I place them further down in the code, in the same method though, they do break, but they don't map to the Java file, they break on the generated .js file.  So I'll file a bug report for that where appropriate after a bit of investigation.  Perhaps after I test with GWT 2.7.0, which upgrading to is our goal, but will take a bit of testing

I apologize for the multiple posts, I was very distracted last evening.

So, I guess back to the original question then, does the URL Filter have any specific syntax?  Is it a regex match?

Ivan Markov

unread,
Nov 21, 2014, 10:07:28 AM11/21/14
to sd...@googlegroups.com
1.  Launch to Chrome, yesterday, I was receiving a "Connection Refused Dialog" in Eclipse and the Launch would never complete.  However, attempting this again this morning, it appears to now be connecting on Launch to Chrome.

Very good. I consider this resolved then, even though I don't like magical resolutions in general. :)

 
2. Connect to Chrome.  I am attempting to understand this process because I do alot of development across browser and vm.  So my eclipse may be running in a VM and the browser in another or the host machine.  I just want to understand if there is any special syntax to the URL Filter.  Everything else seems pretty self explanatory.

Whenever you try to connect to a running Chrome instance, you are presented by SDBG with a dialog box where all opened tabs of the Chrome browser are listed. You are then supposed to pick the tab you would like to debug/connect to. The URL Filter is just a way to filter out some tabs, if you know that you are e.g. interested only in tabs which have url which starts with e.g. http://localhost:8080/whatever
By the way, you can just leave the URL Filter empty and everything would still work.

The URL Filter is not a regexp. It is treated as a URL prefix; i.e. if the URL Filter is e.g. http://localhost:8080 and there is a tab displaying URL http://localhost:8080/blah, then this tab will NOT be filtered out.

Finally: whenever you try to connect to a Chrome instance, always always first check if Chrome is really listening on the port you have instructed it to listen. E.g. "telnet localhost <chrome-debug-port>" and then Ctrl+] to quit. In 90% of the cases, that's the reason connecting to Chrome does not work - it simply does NOT listen to the port, even though you instructed it to. Typical reason why - when you launched your Chrome instance, there were already running old Chrome instances which were not in debugging mode. This leads to your instance also not listening to the debug port. By the way, the "Launch Chrome" configuration solved this problem for you by launching Chrome with another user profile. In that case the already running Chrome instances do not interfere with your one.

 

3. I am placing a breakpoint in Eclipse within a callback handled by click handler.  However, the break point is never triggered.  I think this may not be a problem with SDBG after further investigation.  I think the problem is in Chrome's source mapping.  There are multiple inner classes in the class in question and it seems that Chrome or GWT is not appropriately mapping the JS -> Java.  The breakpoints don't trigger appropriately in the Chrome JS inspector either where I am placing them.  If I place them further down in the code, in the same method though, they do break, but they don't map to the Java file, they break on the generated .js file.  So I'll file a bug report for that where appropriate after a bit of investigation.  Perhaps after I test with GWT 2.7.0, which upgrading to is our goal, but will take a bit of testing

Very good. If you can post the link to the bug report here once you have it - that would be appreciated.
(By the way, the upcoming SDBG version (http://sdbg.github.io/p2beta/) has very good tracing capabilities which may help diagnosing this (and other problems) further. You may wish to download it from the SDBG Beta repo and play with those in Eclipse/Peferences/Tracing)


 
I apologize for the multiple posts, I was very distracted last evening.

No worries.
 
So, I guess back to the original question then, does the URL Filter have any specific syntax?  Is it a regex match?

It is not, see above. Hope that helps.
 
Reply all
Reply to author
Forward
0 new messages