diff options
author | Kris Maglione <maglione.k@gmail.com> | 2010-12-07 16:45:15 -0500 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2010-12-07 16:45:15 -0500 |
commit | 3e8002f0d74c0174b61920f8e68b80a0c61fea9d (patch) | |
tree | 1ca13125c4cc917ebe91de9a527c2ffdf289e4ec /common/content/buffer.js | |
parent | 0af0b5340e1afc30bf19253d5829d16cd0691807 (diff) | |
download | pentadactyl-3e8002f0d74c0174b61920f8e68b80a0c61fea9d.tar.gz |
Work around help pages failing to render properly, bugs 591425 and 606877. Closes issue #81.
Update issue 81
This should at least alleviate the problem.
Diffstat (limited to 'common/content/buffer.js')
-rw-r--r-- | common/content/buffer.js | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js index 653782fe..a1b9b466 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -190,19 +190,22 @@ const Buffer = Module("buffer", { // event listener which is is called on each page load, even if the // page is loaded in a background tab onPageLoad: function onPageLoad(event) { - if (event.originalTarget instanceof Document) - if (/^dactyl:/.test(event.originalTarget.location.href)) { + let doc = event.originalTarget; + if (doc instanceof Document) { + if (doc.location.protocol === "dactyl:") { dactyl.initHelp(); config.styleHelp(); + // Workaround for bugs 591425 and 606877, dactyl bug #81 + config.browser.getBrowserForDocument(doc).collapsed = false; } - if (event.originalTarget instanceof HTMLDocument) { - let doc = event.originalTarget; - // mark the buffer as loaded, we can't use buffer.loaded // since that always refers to the current buffer, while doc can be // any buffer, even in a background tab doc.pageIsFullyLoaded = 1; + } + + if (doc instanceof HTMLDocument) { if (doc.defaultView.frameElement) { // document is part of a frameset @@ -286,6 +289,12 @@ const Buffer = Module("buffer", { for (let frame in values(buffer.allFrames())) frame.dactylFocusAllowed = false; + let browser = config.browser.mCurrentBrowser; + let uri = browser.registeredOpenURI || browser.lastURI; + if (uri.scheme === "dactyl" && !(browser.contentDocument || {}).pageIsFullyLoaded) + // Workaround for bugs 591425 and 606877, dactyl bug #81 + browser.collapsed = true; + util.timeout(function () { autocommands.trigger("LocationChange", { url: buffer.URL }); }); @@ -1147,9 +1156,12 @@ const Buffer = Module("buffer", { return elem; } - var elem = buffer.focusedFrame.document.activeElement; - if (elem == elem.ownerDocument.body) - elem = null; + try { + var elem = buffer.focusedFrame.document.activeElement; + if (elem == elem.ownerDocument.body) + elem = null; + } + catch (e) {} let sel = buffer.focusedFrame.getSelection(); if (!elem && sel && sel.rangeCount) |