surf-adblock

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 3c2028b5af591cb00fdf7dbc06bb55e1bcdc4eed
parent c882cd7277bb06ca5e14dcd0671a610141de6122
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sat, 16 Jul 2016 21:08:21 +0200

do not apply empty css rules

Diffstat:
surf-adblock.c | 26+++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/surf-adblock.c b/surf-adblock.c @@ -742,17 +742,21 @@ documentloaded(WebKitWebPage *wp, Page *p) p->view = webkit_dom_document_get_default_view(doc); #if 1 - el = webkit_dom_document_create_element(doc, "style", NULL); - webkit_dom_element_set_attribute(el, "type", "text/css", NULL); - webkit_dom_element_set_inner_html(el, globalcss.data, NULL); - webkit_dom_node_append_child(WEBKIT_DOM_NODE(body), - WEBKIT_DOM_NODE(el), NULL); - - el = webkit_dom_document_create_element(doc, "style", NULL); - webkit_dom_element_set_attribute(el, "type", "text/css", NULL); - webkit_dom_element_set_inner_html(el, sitecss.data, NULL); - webkit_dom_node_append_child(WEBKIT_DOM_NODE(body), - WEBKIT_DOM_NODE(el), NULL); + if (globalcss.data) { + el = webkit_dom_document_create_element(doc, "style", NULL); + webkit_dom_element_set_attribute(el, "type", "text/css", NULL); + webkit_dom_element_set_inner_html(el, globalcss.data, NULL); + webkit_dom_node_append_child(WEBKIT_DOM_NODE(body), + WEBKIT_DOM_NODE(el), NULL); + } + + if (sitecss.data) { + el = webkit_dom_document_create_element(doc, "style", NULL); + webkit_dom_element_set_attribute(el, "type", "text/css", NULL); + webkit_dom_element_set_inner_html(el, sitecss.data, NULL); + webkit_dom_node_append_child(WEBKIT_DOM_NODE(body), + WEBKIT_DOM_NODE(el), NULL); + } #endif free(domain);