Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnProtocolExecution Page goes blank after link click #2715

Open
magreenblatt opened this issue Jul 10, 2019 · 8 comments
Open

OnProtocolExecution Page goes blank after link click #2715

magreenblatt opened this issue Jul 10, 2019 · 8 comments
Labels
bug Bug report Framework Related to framework code or APIs

Comments

@magreenblatt
Copy link
Collaborator

Original report by Alex Maitland (Bitbucket: a-maitland).


What steps will reproduce the problem?

  1. Modify cefclient to allow mailto protocol (change spotify: to mailto:)
  2. Open cefclient
  3. Open http://cefsharp.github.io/cefmailtodemo.html
  4. Click the mailto link

Change the following two lines

https://bitbucket.org/chromiumembedded/cef/src/2c92fcd3cdf1983adc25bd7806886c9e07a7375b/tests/cefclient/browser/client_handler.cc#lines-652

https://bitbucket.org/chromiumembedded/cef/src/2c92fcd3cdf1983adc25bd7806886c9e07a7375b/tests/cefclient/browser/client_handler.cc#lines-850

What is the expected output? What do you see instead?

Default mail application should load and the page should stay visible

Mail application loads, then the page goes blank. No errors in the Log, disabling network service doesn’t appear to make any difference.

What version of the product are you using? On what operating system?

75.0.13+g2c92fcd+chromium-75.0.3770.100

Windows 10 x64 Pro

Does the problem reproduce with the cefclient or cefsimple sample application at the same version? How about with a newer or older version?

Yes, tested using modified version of 75.0.13+g2c92fcd+chromium-75.0.3770.100

Does the problem reproduce with Google Chrome at the same version? How about with a newer or older version?

Chrome works as expected

@magreenblatt
Copy link
Collaborator Author

Original comment by Alex Maitland (Bitbucket: a-maitland).


It’s possible that Spotify links also trigger the problem, I just didn’t have an example.

Happy to submit a PR that enables mailto in addition to spotify for testing purposes, allowing mailto seems reasonable for cefclient. Let me know.

@magreenblatt
Copy link
Collaborator Author

Allowing mailto support in cefclient seems reasonable, but lets do that at the same time this issue is fixed.

@magreenblatt
Copy link
Collaborator Author

  • changed component from "Unclassified" to "Framework"

@magreenblatt
Copy link
Collaborator Author

Original comment by Thomas Treutlein (Bitbucket: Thomas Treutlein).


This problem still occurs with the latest version (CEF 80.1.2+g9d2a31e+chromium-80.0.3987.149) and is a bit painful for end users in feedback forms or in business scenarios (stateful applications).
My observations are a bit different. With versions < 77 I was successful by doing the following:

OnProtocolExecution(....)
{
  if (urlStr.find("mailto:") == 0)
  {
    browser->StopLoad();
    allow_os_execution = true;
  }  
}

Since version 77.1.4+gf3890be+chromium-77.0.3865.90 this workaround does not help anymore and I got the same blank page as described initially.

@magreenblatt
Copy link
Collaborator Author

Navigation to a “mailto:” URI can currently be blocked in OnBeforeBrowse (check the request->GetURL() value). In that case the OnProtocolExecution method won't be called and you'll need to launch the OS handler from your own code. That’s probably the best workaround currently.

I’m not sure what we can do about the navigation in Chromium if you allow the request to proceed. By the point that OnProtocolExecution is called the navigation has already been initiated and the request has already failed with ERR_UNKNOWN_URL_SCHEME.

@magreenblatt
Copy link
Collaborator Author

Original comment by Anil Achary (Bitbucket: acharyanil, GitHub: acharyanil).


@{5d1a096cb3e96d0d1b9a1596} We have a similar problem. We made a change like below code snippet.

OnProtocolExecution(....)
{
  if (urlStr.find("mailto:") == 0)
  {
    browser->StopLoad();
    allow_os_execution = false;
  }  
}

making allow_os_execution = false; is working for us, but for >v77 it does not work in all the cases.
@thomas Treutlein Could you please share if you have used any other workaround to make it work in version >77?

@magreenblatt
Copy link
Collaborator Author

Original comment by Anil Achary (Bitbucket: acharyanil, GitHub: acharyanil).


We have tried below code in OnBeforeBrowse for versions >v77, it is working for us.

OnBeforeBrowse(...)
{
  if (urlStr.find("mailto:") == 0)
  {
    browser->StopLoad();
    ShellExecute(NULL, L"open", urlStr.c_str(), NULL, NULL, SW_HIDE);
    allow_os_execution = false;
  }  
}

@magreenblatt
Copy link
Collaborator Author

Original comment by Alex Maitland (Bitbucket: a-maitland).


I’m not sure what we can do about the navigation in Chromium if you allow the request to proceed. By the point that OnProtocolExecution is called the navigation has already been initiated and the request has already failed with ERR_UNKNOWN_URL_SCHEME.

Do we need to proceed with the request? Can we move this into OnBeforeRequest? If the request is_external then call OnProtocolExecution, if execution allowed then cancel navigation and defer to OS to open link.

Alternatively remove OnProtocolExecution and add a CefIsExternalScheme(url) method to and leave it up to users to validate and handle the urls themselves.

Other suggestions/possibilities?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report Framework Related to framework code or APIs
Projects
None yet
Development

No branches or pull requests

1 participant