Skip to content

Commit 02da7d0

Browse files
committed
Fix TypeError exception when scrolling while the buffer is being loaded
Fixes issue 866
1 parent 0d849be commit 02da7d0

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

common/content/buffer.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,11 +1010,14 @@ const Buffer = Module("buffer", {
10101010
getFocusedWindow: function (win) {
10111011
win = win || config.browser.contentWindow;
10121012
let elem = win.document.activeElement;
1013-
let doc;
1014-
while (doc = elem.contentDocument) {
1015-
elem = doc.activeElement;
1016-
}
1017-
return elem.ownerDocument.defaultView;
1013+
if (elem) {
1014+
let doc;
1015+
while (doc = elem.contentDocument) {
1016+
elem = doc.activeElement;
1017+
}
1018+
return elem.ownerDocument.defaultView;
1019+
} else
1020+
return win;
10181021
},
10191022

10201023
setZoom: function setZoom(value, fullZoom) {
@@ -1067,7 +1070,7 @@ const Buffer = Module("buffer", {
10671070
pos = "scrollLeft", maxPos = "scrollLeftMax", clientSize = "clientWidth";
10681071

10691072
function find(elem) {
1070-
if (!(elem instanceof Element))
1073+
if (elem && !(elem instanceof Element))
10711074
elem = elem.parentNode;
10721075

10731076
for (; elem && elem.parentNode instanceof Element; elem = elem.parentNode) {

vimperator/NEWS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
2013-XX-XX:
1+
2013-XX-XX
22
* version 3.8
33
* Add "ssl" field shows SSL connection icon to "status" option (default: off)
44
* Tabs count and it's index in status-line are changed to the current group's tabs count and it's index.
5+
* Fixed "TypeError: elem is null" error when scrolling while the page is being loaded
56

67
2013-05-22:
78
* version 3.7.1

0 commit comments

Comments
 (0)