1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 06:07:59 +01:00

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.
This commit is contained in:
Kris Maglione
2010-12-07 16:45:15 -05:00
parent 0af0b5340e
commit 3e8002f0d7

View File

@@ -190,19 +190,22 @@ const Buffer = Module("buffer", {
// event listener which is is called on each page load, even if the // event listener which is is called on each page load, even if the
// page is loaded in a background tab // page is loaded in a background tab
onPageLoad: function onPageLoad(event) { onPageLoad: function onPageLoad(event) {
if (event.originalTarget instanceof Document) let doc = event.originalTarget;
if (/^dactyl:/.test(event.originalTarget.location.href)) { if (doc instanceof Document) {
if (doc.location.protocol === "dactyl:") {
dactyl.initHelp(); dactyl.initHelp();
config.styleHelp(); 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 // mark the buffer as loaded, we can't use buffer.loaded
// since that always refers to the current buffer, while doc can be // since that always refers to the current buffer, while doc can be
// any buffer, even in a background tab // any buffer, even in a background tab
doc.pageIsFullyLoaded = 1; doc.pageIsFullyLoaded = 1;
}
if (doc instanceof HTMLDocument) {
if (doc.defaultView.frameElement) { if (doc.defaultView.frameElement) {
// document is part of a frameset // document is part of a frameset
@@ -286,6 +289,12 @@ const Buffer = Module("buffer", {
for (let frame in values(buffer.allFrames())) for (let frame in values(buffer.allFrames()))
frame.dactylFocusAllowed = false; 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 () { util.timeout(function () {
autocommands.trigger("LocationChange", { url: buffer.URL }); autocommands.trigger("LocationChange", { url: buffer.URL });
}); });
@@ -1147,9 +1156,12 @@ const Buffer = Module("buffer", {
return elem; return elem;
} }
var elem = buffer.focusedFrame.document.activeElement; try {
if (elem == elem.ownerDocument.body) var elem = buffer.focusedFrame.document.activeElement;
elem = null; if (elem == elem.ownerDocument.body)
elem = null;
}
catch (e) {}
let sel = buffer.focusedFrame.getSelection(); let sel = buffer.focusedFrame.getSelection();
if (!elem && sel && sel.rangeCount) if (!elem && sel && sel.rangeCount)