For most commands it is an error if no object type is specified and
there is no default (although that is an unusual situation). For
example, previously the keys "T c" gave an obscure error message
(TypeError: e is undefined). Now the error message is clear for this
and other similar situations.
There are two callers of read_browser_object that work with a null
browser object; these now specify a nullok flag.
---
modules/content-buffer.js | 2 +-
modules/element.js | 8 +++++++-
modules/scroll.js | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules/content-buffer.js b/modules/content-buffer.js
index 0f8b86e..9667640 100644
--- a/modules/content-buffer.js
+++ b/modules/content-buffer.js
@@ -559,7 +559,7 @@ interactive("reload",
"reloaded.",
function (I) {
check_buffer(I.buffer, content_buffer);
- var element = yield read_browser_object(I);
+ var element = yield read_browser_object(I, true);
reload(I.buffer, I.P, element, I.forced_charset);
});
diff --git a/modules/element.js b/modules/element.js
index 576cfff..6d24126 100644
--- a/modules/element.js
+++ b/modules/element.js
@@ -270,9 +270,15 @@ interactive("browser-object-text",
},
$prefix);
-function read_browser_object (I) {
+function read_browser_object (I, nullok) {
var browser_object = I.browser_object;
var result;
+ if (browser_object == null) {
+ if (nullok)
+ yield co_return(null);
+ else
+ throw interactive_error("No browser object type specified.");
+ }
// literals cannot be overridden
if (browser_object instanceof Function) {
result = yield browser_object(I);
diff --git a/modules/scroll.js b/modules/scroll.js
index b0dd0e5..4ad7bdd 100644
--- a/modules/scroll.js
+++ b/modules/scroll.js
@@ -77,7 +77,7 @@ define_browser_object_class("previous-heading", null,
function scroll (I) {
- var element = yield read_browser_object(I);
+ var element = yield read_browser_object(I, true);
// no scrolling and no error if we failed to get an object.
if (! element)
return;
--
1.6.5
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror