Add a capability what disabling adblock at runtime
This commit is contained in:
parent
d61e37cffb
commit
b040c652d1
|
@ -32,6 +32,9 @@ For source code:
|
||||||
set string "adblock:false;" as the user data of the
|
set string "adblock:false;" as the user data of the
|
||||||
webkit_web_context_set_web_extensions_initialization_user_data;
|
webkit_web_context_set_web_extensions_initialization_user_data;
|
||||||
|
|
||||||
|
Runtime:
|
||||||
|
g_object_set_data(G_OBJECT(webkitwebpage), "adblock", GINT_TO_POINTER('n'));
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -930,6 +930,9 @@ static bool first = true;
|
||||||
static gboolean reqcb(WebKitWebPage *page, WebKitURIRequest *req,
|
static gboolean reqcb(WebKitWebPage *page, WebKitURIRequest *req,
|
||||||
WebKitURIResponse *r, gpointer p)
|
WebKitURIResponse *r, gpointer p)
|
||||||
{
|
{
|
||||||
|
if (g_object_get_data(G_OBJECT(page), "adblock") == (gpointer)'n')
|
||||||
|
return false;
|
||||||
|
|
||||||
const char *requri = webkit_uri_request_get_uri(req);
|
const char *requri = webkit_uri_request_get_uri(req);
|
||||||
const char *pageuri = webkit_web_page_get_uri(page);
|
const char *pageuri = webkit_web_page_get_uri(page);
|
||||||
|
|
||||||
|
@ -954,7 +957,6 @@ static gboolean reqcb(WebKitWebPage *page, WebKitURIRequest *req,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void pageinit(WebKitWebExtension *ex, WebKitWebPage *wp)
|
static void pageinit(WebKitWebExtension *ex, WebKitWebPage *wp)
|
||||||
{
|
{
|
||||||
DD(pageinit)
|
DD(pageinit)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user