From: Daniel Carl Date: Tue, 26 Mar 2013 23:23:27 +0000 (+0100) Subject: Fixed broken hints on pages with frames. X-Git-Url: https://git.owens.tech/rss.xml/rss.xml/git?a=commitdiff_plain;h=7e78694b3b7612f3a72bc103679d16ac3a74c5ac;p=vimb.git Fixed broken hints on pages with frames. If pages contains pages with content from other domains, we can't process them because of the same origin policy. In this case the window.document is undefined and no hint could be shown. To solve the problem, we leaf the hinting helper if we cant access the document. --- diff --git a/src/hints.js b/src/hints.js index 542a386..f6c27ab 100644 --- a/src/hints.js +++ b/src/hints.js @@ -20,6 +20,11 @@ function VimbHints(mode, usage, bg, bgf, fg, style, maxHints) function _helper(win, offsetX, offsetY) { + /* document may be undefined for frames out of the same origin + * policy and will break the whole code - so we check this before */ + if (typeof(win.document) === 'undefined') { + return; + } var doc = win.document; var fragment = doc.createDocumentFragment();