Subject: [PATCH] Place a notification on the URL panel for a script on a link.

If following a link during a hints interaction would also execute a
script, the URL panel now includes the text "[script]" to warn the
user.
---

Sorry, the previous was broken; I missed a bit when rebasing and then
only tested the end result, not each patch.  This one works.

 modules/hints.js |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/hints.js b/modules/hints.js
index 8544333..1f15364 100644
--- a/modules/hints.js
+++ b/modules/hints.js
@@ -431,17 +431,24 @@ function hints_url_panel (hints, window) {
     window.minibuffer.insert_before(p);
 
     p.update = function () {
-       url_value.value = "";
+       var s = [];
        if (hints.manager && hints.manager.last_selected_hint) {
             var spec;
+            var elem = hints.manager.last_selected_hint.elem;
+            if (elem.hasAttribute("onmousedown") ||
+                elem.hasAttribute("onclick"))
+            {
+                s.push("[script]");
+            }
             try {
-                spec = load_spec(hints.manager.last_selected_hint.elem);
+                spec = load_spec(elem);
             } catch (e) {}
             if (spec) {
                 var uri = load_spec_uri_string(spec);
-                if (uri) url_value.value = uri;
+                if (uri) s.push(uri);
             }
        }
+        url_value.value = s.join(" ");
     };
 
     p.destroy = function () {
-- 
1.7.6.3

_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to