Fix sharing system in page
This commit is contained in:
parent
4feef09576
commit
3edc7d8e99
|
@ -34,7 +34,7 @@ webkit_web_context_set_web_extensions_initialization_user_data;
|
||||||
|
|
||||||
Runtime:
|
Runtime:
|
||||||
|
|
||||||
g_object_set_data(G_OBJECT(webkitwebpage), "adblock", GINT_TO_POINTER('n'));
|
g_object_set_data(G_OBJECT(webkitwebpage), "wyebab", GINT_TO_POINTER('n'));
|
||||||
|
|
||||||
in any extension.
|
in any extension.
|
||||||
|
|
||||||
|
|
|
@ -927,10 +927,19 @@ ephy_uri_tester_load (EphyUriTester *tester)
|
||||||
|
|
||||||
#include <webkit2/webkit-web-extension.h>
|
#include <webkit2/webkit-web-extension.h>
|
||||||
static bool first = true;
|
static bool first = true;
|
||||||
|
static bool check(const char *requri, const char *pageuri)
|
||||||
|
{
|
||||||
|
char *uris = g_strconcat(requri, " ", pageuri, NULL);
|
||||||
|
char *ruri = wyebreq(EXE, uris);
|
||||||
|
g_free(uris);
|
||||||
|
|
||||||
|
if (ruri && !*ruri) return false;
|
||||||
|
return 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')
|
if (g_object_get_data(G_OBJECT(page), "wyebab") == (gpointer)'n')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const char *requri = webkit_uri_request_get_uri(req);
|
const char *requri = webkit_uri_request_get_uri(req);
|
||||||
|
@ -944,23 +953,21 @@ static gboolean reqcb(WebKitWebPage *page, WebKitURIRequest *req,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *uris = g_strconcat(requri, " ", pageuri, NULL);
|
if (check(requri, pageuri)) return false;
|
||||||
char *ruri = wyebreq(EXE, uris);
|
|
||||||
g_free(uris);
|
|
||||||
|
|
||||||
if (!ruri) return false; //wyebab failed
|
void (*rf)(gpointer p, const char *) =
|
||||||
if (!*ruri) return true;
|
g_object_get_data(G_OBJECT(page), "blockedreport");
|
||||||
|
if (rf)
|
||||||
if (g_strcmp0(requri, ruri))
|
rf(g_object_get_data(G_OBJECT(page), "blockedreportto"), requri);
|
||||||
webkit_uri_request_set_uri(req, ruri);
|
return true;
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pageinit(WebKitWebExtension *ex, WebKitWebPage *wp)
|
static void pageinit(WebKitWebExtension *ex, WebKitWebPage *wp)
|
||||||
{
|
{
|
||||||
DD(pageinit)
|
DD(pageinit)
|
||||||
g_signal_connect(wp, "send-request", G_CALLBACK(reqcb), NULL);
|
g_signal_connect(wp, "send-request", G_CALLBACK(reqcb), NULL);
|
||||||
|
|
||||||
|
g_object_set_data(G_OBJECT(wp), "wyebabcheck", check);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data(
|
G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data(
|
||||||
|
|
15
wyebrun.c
15
wyebrun.c
|
@ -415,18 +415,25 @@ static gboolean tcinputcb(GIOChannel *ch, GIOCondition c, char *exe)
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (!strcmp(line, "l"))
|
if (g_str_has_prefix(line, "l"))
|
||||||
{
|
{
|
||||||
start = g_get_monotonic_time();
|
start = g_get_monotonic_time();
|
||||||
for (int i = 0; i < 10000; i++)
|
for (int i = 0; i < 1000; i++)
|
||||||
{
|
{
|
||||||
char *is = g_strdup_printf("l%d", i);
|
char *is = g_strdup_printf("l%d", i);
|
||||||
//g_print("loop %d ret %s\n", i, wyebreq(exe, is));
|
//g_print("loop %d ret %s\n", i, wyebreq(exe, is));
|
||||||
wyebreq(exe, is);
|
if (*(line + 1) == 's')
|
||||||
|
wyebsend(exe, is);
|
||||||
|
else if (*(line + 1) == 'p')
|
||||||
|
D(pint %s, is)
|
||||||
|
else
|
||||||
|
wyebreq(exe, is);
|
||||||
g_free(is);
|
g_free(is);
|
||||||
}
|
}
|
||||||
gint64 now = g_get_monotonic_time();
|
gint64 now = g_get_monotonic_time();
|
||||||
D(time %f, (now - start) / 1000000.0)
|
char *time = g_strdup_printf("time %f", (now - start) / 1000000.0);
|
||||||
|
wyebsend(exe, time);
|
||||||
|
g_free(time);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_print("RET is %s\n", wyebreq(exe, line));
|
g_print("RET is %s\n", wyebreq(exe, line));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user