Undo the disabling method
This commit is contained in:
parent
3edc7d8e99
commit
257c0a893c
|
@ -34,7 +34,7 @@ webkit_web_context_set_web_extensions_initialization_user_data;
|
|||
|
||||
Runtime:
|
||||
|
||||
g_object_set_data(G_OBJECT(webkitwebpage), "wyebab", GINT_TO_POINTER('n'));
|
||||
g_object_set_data(G_OBJECT(webkitwebpage), "adblock", GINT_TO_POINTER('n'));
|
||||
|
||||
in any extension.
|
||||
|
||||
|
|
|
@ -939,7 +939,7 @@ static bool check(const char *requri, const char *pageuri)
|
|||
static gboolean reqcb(WebKitWebPage *page, WebKitURIRequest *req,
|
||||
WebKitURIResponse *r, gpointer p)
|
||||
{
|
||||
if (g_object_get_data(G_OBJECT(page), "wyebab") == (gpointer)'n')
|
||||
if (g_object_get_data(G_OBJECT(page), "adblock") == (gpointer)'n')
|
||||
return false;
|
||||
|
||||
const char *requri = webkit_uri_request_get_uri(req);
|
||||
|
@ -954,20 +954,18 @@ static gboolean reqcb(WebKitWebPage *page, WebKitURIRequest *req,
|
|||
}
|
||||
|
||||
if (check(requri, pageuri)) return false;
|
||||
|
||||
void (*rf)(gpointer p, const char *) =
|
||||
g_object_get_data(G_OBJECT(page), "blockedreport");
|
||||
if (rf)
|
||||
rf(g_object_get_data(G_OBJECT(page), "blockedreportto"), requri);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool useapi = false;
|
||||
static void pageinit(WebKitWebExtension *ex, WebKitWebPage *wp)
|
||||
{
|
||||
DD(pageinit)
|
||||
g_signal_connect(wp, "send-request", G_CALLBACK(reqcb), NULL);
|
||||
|
||||
g_object_set_data(G_OBJECT(wp), "wyebabcheck", check);
|
||||
if (!useapi)
|
||||
g_signal_connect(wp, "send-request", G_CALLBACK(reqcb), NULL);
|
||||
|
||||
g_object_set_data(G_OBJECT(wp), "wyebcheck", check);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data(
|
||||
|
@ -981,11 +979,15 @@ G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data(
|
|||
bool enable = true;
|
||||
char **args = g_strsplit(str, ";", -1);
|
||||
for (char **arg = args; *arg; arg++)
|
||||
{
|
||||
if (g_str_has_prefix(*arg, "adblock:"))
|
||||
{
|
||||
enable = !strcmp(*arg + 8, "true");
|
||||
hasarg = true;
|
||||
}
|
||||
if (!strcmp(*arg, "wyebabapi"))
|
||||
useapi = true;
|
||||
}
|
||||
g_strfreev(args);
|
||||
if (!enable) return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user