From 7ebd4039f834f8f1a2eba34021bf9f931683522a Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 6 Jan 2018 18:48:15 +0100 Subject: [PATCH] AdBlock: Clear blocked requests for url when webpage is deleted --- src/lib/adblock/adblockplugin.cpp | 6 ++++++ src/lib/adblock/adblockplugin.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/lib/adblock/adblockplugin.cpp b/src/lib/adblock/adblockplugin.cpp index 5b138a4e2..0b43c1a4f 100644 --- a/src/lib/adblock/adblockplugin.cpp +++ b/src/lib/adblock/adblockplugin.cpp @@ -32,6 +32,7 @@ AdBlockPlugin::AdBlockPlugin(QObject *parent) { connect(mApp, &MainApplication::aboutToQuit, AdBlockManager::instance(), &AdBlockManager::save); connect(mApp->plugins(), &PluginProxy::webPageCreated, this, &AdBlockPlugin::webPageCreated); + connect(mApp->plugins(), &PluginProxy::webPageDeleted, this, &AdBlockPlugin::webPageDeleted); connect(mApp->plugins(), &PluginProxy::mainWindowCreated, this, &AdBlockPlugin::mainWindowCreated); } @@ -55,6 +56,11 @@ void AdBlockPlugin::webPageCreated(WebPage *page) }); } +void AdBlockPlugin::webPageDeleted(WebPage *page) +{ + AdBlockManager::instance()->clearBlockedRequestsForUrl(page->url()); +} + void AdBlockPlugin::mainWindowCreated(BrowserWindow *window) { window->navigationBar()->addToolButton(new AdBlockIcon(window)); diff --git a/src/lib/adblock/adblockplugin.h b/src/lib/adblock/adblockplugin.h index 64372ef61..9350abba0 100644 --- a/src/lib/adblock/adblockplugin.h +++ b/src/lib/adblock/adblockplugin.h @@ -29,5 +29,6 @@ public: private: void webPageCreated(WebPage *page); + void webPageDeleted(WebPage *page); void mainWindowCreated(BrowserWindow *window); };