mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Block popups in the in-app browser
This commit is contained in:
parent
3a6aaee06b
commit
9343d38047
@ -1,5 +1,10 @@
|
||||
### Changelog
|
||||
|
||||
#### Version - 0.9.20.0
|
||||
* Don't reuse HTTP request objects (#532)
|
||||
* Block popups in the in-app browser (#535)
|
||||
|
||||
|
||||
#### Version - 0.9.19.0
|
||||
* Disable server-side indexing of all mods from the Nexus
|
||||
* Accept download states from clients and index the mods we haven't seen
|
||||
|
@ -37,6 +37,7 @@ namespace Wabbajack.Lib.WebAutomation
|
||||
_browser.LoadingStateChanged += handler;
|
||||
_browser.Load(uri.ToString());
|
||||
_browser.DownloadHandler = new DownloadHandler(this);
|
||||
_browser.LifeSpanHandler = new PopupBlocker(this);
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
@ -65,6 +66,40 @@ namespace Wabbajack.Lib.WebAutomation
|
||||
public string Location => _browser.Address;
|
||||
}
|
||||
|
||||
public class PopupBlocker : ILifeSpanHandler
|
||||
{
|
||||
private CefSharpWrapper _wrapper;
|
||||
|
||||
public PopupBlocker(CefSharpWrapper cefSharpWrapper)
|
||||
{
|
||||
_wrapper = cefSharpWrapper;
|
||||
}
|
||||
|
||||
public bool OnBeforePopup(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, string targetUrl,
|
||||
string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures,
|
||||
IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser)
|
||||
{
|
||||
// Block popups
|
||||
newBrowser = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnAfterCreated(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool DoClose(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnBeforeClose(IWebBrowser chromiumWebBrowser, IBrowser browser)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class DownloadHandler : IDownloadHandler
|
||||
{
|
||||
private CefSharpWrapper _wrapper;
|
||||
|
Loading…
Reference in New Issue
Block a user