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.

--

Notes:

  - The URL panel and overlink mode serve a similar notification purpose;
    we should provide a common interface for setting their text.

  - If we start putting other stuff in the URL panel, perhaps it needs
    a more general name; e.g. hints_information.

  - Perhaps the panel should be on by default, or perhaps we should
    even remove the parameter and have it always enabled.
---
 modules/hints.js |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/hints.js b/modules/hints.js
index 34d478d..a2ea901 100644
--- a/modules/hints.js
+++ b/modules/hints.js
@@ -420,17 +420,24 @@ function hints_url_panel (hints, window) {
     window.minibuffer.element.insertBefore(p, null);
 
     p.update = function () {
-       p.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) p.value = uri;
+                if (uri) s.push(uri);
             }
        }
+        p.value = s.join(" ");
     };
 
     p.destroy = function () {
-- 
1.7.5.3

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

Reply via email to