-
Notifications
You must be signed in to change notification settings - Fork 613
Fix for launching Chrome with temporary profile in OSX. #339
Conversation
@fungl164 Thanks for submitting this pull request! You'll need to agree to the Brackets CLA before I can merge this. |
@fungl164 This doesn't seem to work how I was expecting it to. On Windows, you can open a Chrome browser window and have some Tabs open in that window. Then in Brackets, when you start Live Development, it opens a second Chrome browser window. On MacOS 10.8, Live Dev tries to open a new Tab in existing window, fails, and then prompts me to Relaunch Chrome. With this code, can you open Live Dev in the scenario above without getting the Relaunch Chrome prompt? If so, is Live Dev opened in a new window, or just a new Tab? |
@fungl164 I've been playing around with this and I can get it to work when I type in the args on the command line, but not in Brackets, so I guess it must have something to do with how the command is getting built in brackets-shell. If you get a chance to work on this some more, we want the user data dir to go the app support folder, and use a different name to be consistent with other platforms, which needs to be quoted since there are spaces in the path, so something like:
And one other flag for those that have a default browser other than Chrome:
|
@redmunds so I made a few changes to make chrome startup and terminate based on proper process ids (fungl164@8e0fa25). I've also added your comments as a separate commit (fungl164@44b8b79). I still cannot get Brackets to issue a CloseLiveBrowser() call when clicking on the Live Dev icon. I believe its somewhere in the js code, but I don't know the proper place to put it. Once that's done, it should terminate correctly. Disabling Live Dev from the toolbar just closes the tab but leaves the chrome instance running right now because of the missing call to CloseLiveBrowser(). To enable Live Dev, you'll need to close the second instance of Chrome and click the icon in Brackets. |
amended last commit to account for common profile path in process id look-up. |
@fungl164 Can you push your changes to the same branch so I can pull them and take a look? |
@redmunds ok. try it now. |
Awesome! This is getting very close. It's not critical that Chrome app stays open with no windows open because that's how it behaves now, but yes it would be nice. If you want to mess with it, the next function in the brackets-shell code is The main problem I am seeing is that a Tab with the "interstitial" page (LiveDevelopment/launch.html) is staying open on the first launch. If no Chrome window is open, then the tab is in the live-dev-profile window. If there is already a default Chrome window open, then the Tab is in the default window. Any ideas on that? |
Also, is |
@redmunds |
@redmunds added fix for brackets source to call native impl of CloseLiveBrowser(). |
} else if (apps.count > 0 && !LiveBrowserMgrMac::GetInstance()->GetTerminateObserver()) { | ||
} | ||
|
||
if (!LiveBrowserMgrMac::GetInstance()->GetTerminateObserver()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few places where LiveBrowserMgrMac::GetInstance()
can be repplaced with liveBrowserMgr
.
@fungl164 This seems to work great! Brackets Mac users will be very happy about this. I'm going to bang on it a little more and make one more pass through the code. |
/* Note location of current '\0'. */ | ||
np = cp; | ||
|
||
if (!show_args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how the value of show_args
can ever change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. I just tweaked the code to get what I needed for the moment. I made no optimizations attempts. Do you want it taken out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can think of a good reason that we might need it someday then add a comment explaining it, otherwise just pull it out.
Found a bug:
Results |
@redmunds Hmmm. I can't replicate it over here. I works for me. Can you download the latest code and test with it? |
also make sure you have the modifications I made to brackets |
No, I did not see the change you made to the brackets repo. Please submit a pull request so I can test & then merge both pull requests together. Thanks. |
Done. |
I'm out for the eve. I'll try it again tom. |
@fungl164 did you run |
Note to self:
Thank you @gruehle |
@fungl164 you can also run (I always run |
(I always do a |
From
So, yes, |
Thank you fellas. |
Can anyone tell me the intended lifecycle of |
|
@redmunds can you go over the latest |
@redmunds any ideas on what would be the best way to ensure the |
To test that LiveDevelopement is connected, use: Or were you asking how to deal with when it's not in this state? If so, what particular states are you seeing? |
I'm hitting the compile error with |
Arrrrgh! I'm trying to protect against the ScriptingBridge since it is known to throw up every once in a while. |
@fungl164 I can't figure this out. I have some time to mess with this. Can you come to the IRC #brackets channel so we can chat? Or maybe somewhere else? |
@redmunds So I think I found the secret sauce and have it working with the latest brackets master branch w/ minor modifications to the LD module (which I'm thinking of force pushing to my repo fork). Or should I just create a new pull request? |
Cool! I think starting new branch(es) with a new pull request(s) is a good idea. |
New Brackets pull request created to go along with this one (see adobe/brackets#5569) |
@redmunds I have a version that does real-time detection of the LiveBrowser process running in debug mode. This is useful for the corner case when chrome is already running in debug mode before Brackets starts (so no need to re-start). Before I commit it though, I just want to know what's your take on using locks with |
I haven't had the time to research why those won't compile for me in Xcode 4. Once that's figured out, I don't have anything against them. |
Ok. Discussion moved to pull request #359. |
@peterflynn Yes, #359 supercedes this. Thanks. |
Thanks -- closing then. |
Prevents Brackets from interfering with end-user sessions in Chrome (i.e. history, open tabs, etc.).
See related: adobe/brackets#2998.
This requires brackets pull request: adobe/brackets#5392