aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2014-01-31 13:44:11 -0800
committerLars Ingebrigtsen2014-01-31 13:44:11 -0800
commitcc477daa01c1770b5deb5bfca9fe8bdafa3941e2 (patch)
treee0bbc0f74e9ec6d108ab6302ed4b6bc2d20d6fd9
parentdba6e3ec423212f5de4caf431d2e53c525f2c984 (diff)
downloademacs-cc477daa01c1770b5deb5bfca9fe8bdafa3941e2.tar.gz
emacs-cc477daa01c1770b5deb5bfca9fe8bdafa3941e2.zip
Make shr respect privacy when viewing documents with SVG images
(shr-tag-svg): Respect `shr-inhibit-images'. (shr-dom-to-xml): Respect `shr-blocked-images'. Fixes: debbugs:15882
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/net/shr.el14
2 files changed, 13 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9b7e338e187..f17cbb7441f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,8 @@
2 2
3 * net/shr.el (shr-generic): Make into a defsubst to make the stack 3 * net/shr.el (shr-generic): Make into a defsubst to make the stack
4 depth shallower (bug#16587). 4 depth shallower (bug#16587).
5 (shr-tag-svg): Respect `shr-inhibit-images'.
6 (shr-dom-to-xml): Respect `shr-blocked-images' (bug#15882).
5 7
62014-01-31 Dmitry Gutov <dgutov@yandex.ru> 82014-01-31 Dmitry Gutov <dgutov@yandex.ru>
7 9
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index dba0f71bfe1..f23faaa3437 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -972,11 +972,18 @@ ones, in case fg and bg are nil."
972(defun shr-dom-to-xml (dom) 972(defun shr-dom-to-xml (dom)
973 "Convert DOM into a string containing the xml representation." 973 "Convert DOM into a string containing the xml representation."
974 (let ((arg " ") 974 (let ((arg " ")
975 (text "")) 975 (text "")
976 url)
976 (dolist (sub (cdr dom)) 977 (dolist (sub (cdr dom))
977 (cond 978 (cond
978 ((listp (cdr sub)) 979 ((listp (cdr sub))
979 (setq text (concat text (shr-dom-to-xml sub)))) 980 ;; Ignore external image definitions if required.
981 ;; <image xlink:href="http://TRACKING_URL/"/>
982 (when (or (not (eq (car sub) 'image))
983 (not (setq url (cdr (assq ':xlink:href (cdr sub)))))
984 (not shr-blocked-images)
985 (not (string-match shr-blocked-images url)))
986 (setq text (concat text (shr-dom-to-xml sub)))))
980 ((eq (car sub) 'text) 987 ((eq (car sub) 'text)
981 (setq text (concat text (cdr sub)))) 988 (setq text (concat text (cdr sub))))
982 (t 989 (t
@@ -990,7 +997,8 @@ ones, in case fg and bg are nil."
990 (car dom)))) 997 (car dom))))
991 998
992(defun shr-tag-svg (cont) 999(defun shr-tag-svg (cont)
993 (when (image-type-available-p 'svg) 1000 (when (and (image-type-available-p 'svg)
1001 (not shr-inhibit-images))
994 (funcall shr-put-image-function 1002 (funcall shr-put-image-function
995 (shr-dom-to-xml (cons 'svg cont)) 1003 (shr-dom-to-xml (cons 'svg cont))
996 "SVG Image"))) 1004 "SVG Image")))