This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 203899 - Replace Netscape by Chrome
Summary: Replace Netscape by Chrome
Status: RESOLVED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Extbrowser (show other bugs)
Version: 7.1
Hardware: PC Linux
: P2 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords:
: 205569 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-18 12:54 UTC by Marian Mirilovic
Modified: 2012-09-03 12:54 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch that fixes launching Chrome on Mac (1.52 KB, patch)
2012-03-05 14:15 UTC, Petr Jiricka
Details | Diff
Returning correct BrowserId from SystemDefaultBrowser (3.17 KB, text/plain)
2012-03-08 21:25 UTC, Petr Jiricka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Mirilovic 2011-10-18 12:54:56 UTC
NB 7.1 (20111017)

If you open Tools | Options you'll see Firefox, Mozilla and Netscape ... I think it's time to replace Netscape by Chrome.
Comment 1 Antonin Nebuzelsky 2011-10-18 13:07:32 UTC
Nice enhancement for ide/extbrowser component.
Comment 2 Petr Jiricka 2011-12-21 15:42:48 UTC
Agreed.
Comment 3 Petr Jiricka 2012-02-14 16:30:53 UTC
-> DEFECT
Comment 4 Denis Anisimov 2012-02-27 13:19:14 UTC
fixed in easel_css_72  branch web-main#290487d391fd
Comment 5 David Konecny 2012-03-05 01:33:56 UTC
On Ubuntu there are two versions of Chrome (see for example http://code.google.com/p/chromium/wiki/ChromiumBrowserVsGoogleChrome ) and we should try to detect both of them.
Comment 6 David Konecny 2012-03-05 01:53:22 UTC
Something else is wrong. I installed (on my Ubuntu) google-chrome in addition to chromium-browser and I can see now Chrome option in IDE options. Selecting it and testing the browser (eg. Help -> About -> click the www.netbeans.org link) opens the browser but closing the browser results into Warning dialog in the IDE saying "Cannot execute /usr/bin/google-chrome. Check external browser configuration." Trying to do that I opened IDE options and clicked Edit on Chrome browser but dialog "Web Browsers" does not contain Chrome.
Comment 7 Petr Jiricka 2012-03-05 14:15:37 UTC
Created attachment 116352 [details]
Patch that fixes launching Chrome on Mac

I am also facing a problem - Chrome does not open at all on Mac when I choose Chrome in the IDE options - because for some reason, calling /usr/bin/open -a chrome <someurl> prints out "Unable to find application named 'chrome'". Also I noticed that the Chrome plugin version in the code is incorrect. The attached patch fixes this problem for me - see https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/open.1.html for background. I can push the patch - should I?
Comment 8 Denis Anisimov 2012-03-05 18:18:59 UTC
(In reply to comment #7)
> Created attachment 116352 [details]
> Patch that fixes launching Chrome on Mac
> 
> I am also facing a problem - Chrome does not open at all on Mac when I choose
> Chrome in the IDE options - because for some reason, calling /usr/bin/open -a
> chrome <someurl> prints out "Unable to find application named 'chrome'". Also I
> noticed that the Chrome plugin version in the code is incorrect. The attached
> patch fixes this problem for me - see
> https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/open.1.html
> for background. I can push the patch - should I?

Yes please. 
I will correct the version access method ( to read the version right from 
plugin installation file ) later.
Comment 9 David Konecny 2012-03-05 19:53:57 UTC
Denis, if you do not have Ubuntu I can look into it myself. Just let me know.
Comment 10 Denis Anisimov 2012-03-06 09:50:39 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > Created attachment 116352 [details]
> > Patch that fixes launching Chrome on Mac
> > 
> > I am also facing a problem - Chrome does not open at all on Mac when I choose
> > Chrome in the IDE options - because for some reason, calling /usr/bin/open -a
> > chrome <someurl> prints out "Unable to find application named 'chrome'". Also I
> > noticed that the Chrome plugin version in the code is incorrect. The attached
> > patch fixes this problem for me - see
> > https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/open.1.html
> > for background. I can push the patch - should I?
> 
> Yes please. 
> I will correct the version access method ( to read the version right from 
> plugin installation file ) later.

Please ignore this comment.
I've corrected the Chrome case with your proposition and also I've changed the 
current plugin version method.

Thanks for you help.
Comment 11 Denis Anisimov 2012-03-06 13:29:51 UTC
(In reply to comment #5)
> On Ubuntu there are two versions of Chrome (see for example
> http://code.google.com/p/chromium/wiki/ChromiumBrowserVsGoogleChrome ) and we
> should try to detect both of them.

Do you suggest to recognize Chromium and Chrome as one option item ?
By the way I cannot understand how Chromium could be installed.
Could you please send me a link with information how to do it ?
Comment 12 Denis Anisimov 2012-03-06 13:36:40 UTC
(In reply to comment #6)
> Something else is wrong. I installed (on my Ubuntu) google-chrome in addition
> to chromium-browser and I can see now Chrome option in IDE options. Selecting
> it and testing the browser (eg. Help -> About -> click the www.netbeans.org
> link) opens the browser but closing the browser results into Warning dialog in
> the IDE saying "Cannot execute /usr/bin/google-chrome. Check external browser
> configuration." Trying to do that I opened IDE options and clicked Edit on
> Chrome browser but dialog "Web Browsers" does not contain Chrome.

That's very strange behavior.
The presence of browser is detected by existed FS path .
From your description I see that it has been detected once.
The absence Chrome item means the FS path is not available on the system.
This could be result of external change.
I did a minor corrections : web-main#bfb7c8e8c2ec .
Could you please test how it works now ?
Comment 13 David Konecny 2012-03-06 19:15:22 UTC
(In reply to comment #11)
> (In reply to comment #5)
> > On Ubuntu there are two versions of Chrome (see for example
> > http://code.google.com/p/chromium/wiki/ChromiumBrowserVsGoogleChrome ) and we
> > should try to detect both of them.
> 
> Do you suggest to recognize Chromium and Chrome as one option item ?

There are two different browsers which you can have installed in parallel so I would give each its own option.

> By the way I cannot understand how Chromium could be installed.

chromium is part of unix distribution and can be installed via Ubuntu Software Center app - just type "chromium" there. google-chrome installation is more complicated (eg. http://www.liberiangeek.net/2011/12/install-google-chrome-using-apt-get-in-ubuntu-11-10-oneiric-ocelot/)
Comment 14 David Konecny 2012-03-06 19:16:18 UTC
(In reply to comment #12)
> I did a minor corrections : web-main#bfb7c8e8c2ec .
> Could you please test how it works now ?

Thanks. May take me day or two - too many live changes right now.
Comment 15 David Konecny 2012-03-07 03:18:47 UTC
There were two problems which I fixed: ChromeBrowser.isHidden was wrong and HINT_ChromeBrowserName key was missing in the bundle.

I fixed this as part of other changes I was doing as I needed to configure Chrome for some testing. Unfortunately my changes (web-main#d959d4bb9899, web-main#bd90713bf62e, web-main#3ab38e0edb69) conflicted little bit with your one and I had to hotfix it in web-main#91ffa6db4573: I've started using BrowserId (which we should rename to BrowserFamilyId) in browser implementations itself (ExtWebBrowser.getBrowserFamilyId needs to be still fully implemented). But from now on most of my changes will be outside of browser modules so there should not be more conflicts. Sorry.

Btw. ChromeManagerAccessor in web.plugins will also need to take into account chromium browser in addition to chrome.
Comment 16 Petr Jiricka 2012-03-07 08:45:47 UTC
David, regarding this addition to SystemDefaultBrowser:

    @Override
    public BrowserId getBrowserFamilyId() {
        return BrowserId.UNKNOWN;
    }

Shouldn't this be smarter? Denis is working on improvements that will allow us to figure out which browser is set as the system default (on most platforms). If you want to tell the users that "JavaScript debugging is only supported on Chrome" and the user has Chrome set as the default browser in the system, and is using the <System Default> setting in the IDE, shouldn't we accept it as well?
Comment 17 David Konecny 2012-03-07 19:06:18 UTC
Yeah sure. It is work in progress.
Comment 18 Petr Jiricka 2012-03-08 21:25:48 UTC
Created attachment 116492 [details]
Returning correct BrowserId from SystemDefaultBrowser

I must say I can not imagine how this method can be implemented without changing some other code as well - I am attaching a patch that works for me on Mac, which also changes other code. 

I am not sure how significant the 'url' parameter is, because right now it is "lost in translation" and we always pass null. Do we need the url parameter, and if so, how can we pass it?
Comment 19 Petr Jiricka 2012-03-12 10:53:31 UTC
I committed the latest patch: http://hg.netbeans.org/web-main/rev/ac919e19a304
We should still check regarding the meaning and purpose of the url parameter.
Comment 20 Denis Anisimov 2012-03-12 14:50:05 UTC
(In reply to comment #19)
> I committed the latest patch: http://hg.netbeans.org/web-main/rev/ac919e19a304
> We should still check regarding the meaning and purpose of the url parameter.

I've introduced it as parameter based on the output you provide for 
command "defaults read com.apple.LaunchServices" :
{
    LSHandlers =     (
                {
            LSHandlerRoleAll = "com.google.chrome";
            LSHandlerURLScheme = http;
        },
                {
            LSHandlerRoleAll = "com.google.chrome";
            LSHandlerURLScheme = https;
        },
                {
            LSHandlerContentType = "public.html";
            LSHandlerRoleViewer = "com.google.chrome";
        },
                {
            LSHandlerContentType = "public.url";
            LSHandlerRoleViewer = "com.google.chrome";
        },

I'm not sure ( I'm not an expert in Mac and I don't have it to check ) 
that Mac uses the same browser for any URL type.
The output shows at least two URL schemas : "http" and "https" , HTML
 content  type and any other URL .
So it seems there could be different applications used for various schemas, 
content types and default application. 
So there is no "default browser" on the system but result application depends 
on URL . That's just an assumption. The implementation has been based on 
this assumption.
Current code state doesn't assume URL-dependent application.

If we decide to keep previous decision based on URL then it could be done 
via reintroducing method "getPluginId" back instead of 
"getSystemDefaultPluginId" for ExtBrowserImpl and using it for delegate from 
ExtWebBrowser factories implementations.
Comment 21 Denis Anisimov 2012-03-12 14:51:45 UTC
chromium is added : web-main#27b18f01e7a8
Comment 22 Petr Jiricka 2012-03-12 15:18:39 UTC
I would just keep it simple and not worry about the URL. Just pretend that there is a global system default. We can always add the url parameter later if we need to and do it properly.
And I would clean up the code and remove the url parameter from ExtBrowserImpl.getSystemDefaultPluginId(). 
Also, shouldn't this method be renamed to getSystemDefaultBrowserFamilyId?
Comment 23 Denis Anisimov 2012-03-22 13:19:24 UTC
Fix in trunk for Chrome browser
web-main#5bd9e668bc47
Comment 24 Quality Engineering 2012-03-23 10:36:47 UTC
Integrated into 'main-golden', will be available in build *201203230400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/5bd9e668bc47
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#203899 - Replace Netscape by Chrome.
Comment 25 Jesse Glick 2012-04-16 22:49:22 UTC
*** Bug 205569 has been marked as a duplicate of this bug. ***
Comment 26 Quality Engineering 2012-09-03 12:54:02 UTC
Integrated into 'main-golden', will be available in build *201209031048* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/290487d391fd
User: Denis Anisimov <ads@netbeans.org>
Log: Fixes for BZ#203899 - Replace Netscape by Chrome  and BZ#208896 - java.io.FileNotFoundException