summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/hints.js4
-rw-r--r--src/adblock.c8
2 files changed, 7 insertions, 5 deletions
diff --git a/scripts/hints.js b/scripts/hints.js
index d8654f12..b22749f5 100644
--- a/scripts/hints.js
+++ b/scripts/hints.js
@@ -365,7 +365,7 @@ Object.freeze((function () {
__createHints(e.contentWindow, varructor, type);
continue;
}
- else if (e instanceof HTMLImageElement) {
+ else if (e instanceof HTMLImageElement && type != HintTypes.HINT_T_IMAGES) {
if (e.hasAttribute("usemap"))
__createMap(hints, varructor, e, win, r, oe);
}
@@ -516,7 +516,7 @@ Object.freeze((function () {
}
if (type > 0) {
switch (type) {
- case HintTypes.HINT_T_IMAGES: ret = e.src; break;
+ case HintTypes.HINT_T_IMAGES: ret = e.src; __clear(); return ret;
case HintTypes.HINT_T_URL : ret = e.hasAttribute("href") ? e.href : e.src; __clear(); return ret;
default: break;
}
diff --git a/src/adblock.c b/src/adblock.c
index 51bf61fa..273268f6 100644
--- a/src/adblock.c
+++ b/src/adblock.c
@@ -336,9 +336,11 @@ adblock_apply_element_hider(WebKitWebFrame *frame, GList *gl) {
VIEW(gl)->status->style = webkit_dom_document_create_element(doc, "style", NULL);
}
WebKitDOMHTMLHeadElement *head = webkit_dom_document_get_head(doc);
- webkit_dom_html_element_set_inner_html(WEBKIT_DOM_HTML_ELEMENT(VIEW(gl)->status->style), css_rule->str, NULL);
- webkit_dom_node_append_child(WEBKIT_DOM_NODE(head), WEBKIT_DOM_NODE(VIEW(gl)->status->style), NULL);
- g_object_unref(head);
+ if (G_IS_OBJECT(head)) {
+ webkit_dom_html_element_set_inner_html(WEBKIT_DOM_HTML_ELEMENT(VIEW(gl)->status->style), css_rule->str, NULL);
+ webkit_dom_node_append_child(WEBKIT_DOM_NODE(head), WEBKIT_DOM_NODE(VIEW(gl)->status->style), NULL);
+ g_object_unref(head);
+ }
}
else {
const char *css = css_rule->str;