Fixed broken hints on pages with frames.
authorDaniel Carl <danielcarl@gmx.de>
Tue, 26 Mar 2013 23:23:27 +0000 (00:23 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Tue, 26 Mar 2013 23:23:27 +0000 (00:23 +0100)
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.

src/hints.js

index 542a386..f6c27ab 100644 (file)
@@ -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();