Add css selector output

This commit is contained in:
jun7 2017-07-18 09:24:01 +09:00
parent 63ffe039ea
commit 2351986221
2 changed files with 21 additions and 1 deletions

View File

@ -921,6 +921,7 @@ ephy_uri_tester_load (EphyUriTester *tester)
//added
#include <webkit2/webkit-web-extension.h>
#include <stdlib.h>
static EphyUriTester *uri_tester;
static gboolean reqcb (WebKitWebPage *web_page,
@ -976,7 +977,8 @@ static void initex(WebKitWebExtension *ex, WebKitWebPage *wp)
filter_file = g_file_new_for_path(filter_path);
uri_tester = ephy_uri_tester_new("/foo/bar");
}
g_signal_connect(wp, "send-request", G_CALLBACK(reqcb), NULL);
if (wp)
g_signal_connect(wp, "send-request", G_CALLBACK(reqcb), NULL);
}
g_free(filter_path);
@ -999,3 +1001,15 @@ G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data(
g_signal_connect(ex, "page-created", G_CALLBACK(initex), NULL);
}
int main(int argc, char **argv)
{
initex(NULL, NULL);
ephy_uri_tester_load(uri_tester);
g_print(uri_tester->blockcss->str);
g_print("\n\n\n\n\n\n\n\n");
g_print(uri_tester->blockcssprivate->str);
exit(0);
}

View File

@ -12,6 +12,12 @@ adblock.so: ephy-uri-tester.c ephy-uri-tester.h
-DEXTENSION_DIR=\"$(EXTENSION_DIR)\" \
$(DDEBUG) $(DAPPNAME)
cssoutput: ephy-uri-tester.c ephy-uri-tester.h
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< \
`pkg-config --cflags --libs gtk+-3.0 glib-2.0 webkit2gtk-4.0` \
-DEXTENSION_DIR=\"$(EXTENSION_DIR)\" \
$(DDEBUG) $(DAPPNAME)
clean:
rm -f adblock.so