Fix opening URLs in new window with recent Firefox under Windows.

Don't fail if we can't replace "-1" in the WWW_OpenURL topic value stored in
the registry with "0", it can be already "0" for the recent Firefox versions.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72417 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-08-30 20:25:46 +00:00
parent 9ecc6bc2f1
commit 22d00dbb82

View File

@@ -92,16 +92,17 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int f
if ( ok ) if ( ok )
{ {
// for WWW_OpenURL, the index of the window to open the URL // for WWW_OpenURL, the index of the window to open the URL
// in is -1 (meaning "current") by default, replace it with // in may be -1 (meaning "current") by default, replace it
// 0 which means "new" (see KB article 160957) // with 0 which means "new" (see KB article 160957), but
ok = ddeCmd.Replace(wxT("-1"), wxT("0"), // don't fail if there is no -1 as at least for recent
false /* only first occurrence */) == 1; // Firefox versions the default value already is 0
} ddeCmd.Replace(wxT("-1"), wxT("0"),
false /* only first occurrence */);
if ( ok )
{
// and also replace the parameters: the topic should // and also replace the parameters: the topic should
// contain a placeholder for the URL // contain a placeholder for the URL and we should fail if
// we didn't find it as this would mean that we have no way
// of passing the URL to the browser
ok = ddeCmd.Replace(wxT("%1"), url, false) == 1; ok = ddeCmd.Replace(wxT("%1"), url, false) == 1;
} }