1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 15:47:58 +01:00

Handle buffer.loaded properly for frameset documents.

This commit is contained in:
Kris Maglione
2010-10-03 14:49:08 -04:00
parent 684dd0994d
commit 60df536305

View File

@@ -185,26 +185,27 @@ const Buffer = Module("buffer", {
if (event.originalTarget instanceof HTMLDocument) { if (event.originalTarget instanceof HTMLDocument) {
let doc = event.originalTarget; let doc = event.originalTarget;
// document is part of a frameset
if (doc.defaultView.frameElement) {
// hacky way to get rid of "Transferring data from ..." on sites with frames
// when you click on a link inside a frameset, because asyncUpdateUI
// is not triggered there (Gecko bug?)
this.timeout(function () { statusline.updateUrl(); }, 10);
return;
}
// code which should happen for all (also background) newly loaded tabs goes here:
// 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 != config.browser.contentDocument) if (doc.defaultView.frameElement) {
dactyl.echomsg({ domains: [util.getHost(doc.location.href)], message: "Background tab loaded: " + doc.title || doc.location.href }, 3); // document is part of a frameset
this._triggerLoadAutocmd("PageLoad", doc); // hacky way to get rid of "Transferring data from ..." on sites with frames
// when you click on a link inside a frameset, because asyncUpdateUI
// is not triggered there (Gecko bug?)
this.timeout(function () { statusline.updateUrl(); }, 10);
}
else {
// code which should happen for all (also background) newly loaded tabs goes here:
if (doc != config.browser.contentDocument)
dactyl.echomsg({ domains: [util.getHost(doc.location.href)], message: "Background tab loaded: " + doc.title || doc.location.href }, 3);
this._triggerLoadAutocmd("PageLoad", doc);
}
} }
}, },
@@ -225,7 +226,7 @@ const Buffer = Module("buffer", {
// This fires when the load event is initiated // This fires when the load event is initiated
// only thrown for the current tab, not when another tab changes // only thrown for the current tab, not when another tab changes
if (flags & Ci.nsIWebProgressListener.STATE_START) { if (flags & Ci.nsIWebProgressListener.STATE_START) {
buffer.loaded = 0; webProgress.DOMWindow.document.pageIsFullyLoaded = 0;
statusline.updateProgress(0); statusline.updateProgress(0);
autocommands.trigger("PageLoadPre", { url: buffer.URL }); autocommands.trigger("PageLoadPre", { url: buffer.URL });
@@ -238,7 +239,7 @@ const Buffer = Module("buffer", {
} }
} }
else if (flags & Ci.nsIWebProgressListener.STATE_STOP) { else if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
buffer.loaded = (status == 0 ? 1 : 2); webProgress.DOMWindow.document.pageIsFullyLoaded = (status == 0 ? 1 : 2);
statusline.updateUrl(); statusline.updateUrl();
} }
} }
@@ -328,14 +329,10 @@ const Buffer = Module("buffer", {
* 1 - Fully loaded. * 1 - Fully loaded.
* 2 - Load failed. * 2 - Load failed.
*/ */
get loaded() { get loaded()
if (window.content.document.pageIsFullyLoaded !== undefined) Math.min.apply(Math,
return window.content.document.pageIsFullyLoaded; buffer.allFrames().map(function (frame)
return 0; // in doubt return "loading" frame.document.pageIsFullyLoaded || 0)),
},
set loaded(value) {
window.content.document.pageIsFullyLoaded = value;
},
/** /**
* @property {Object} The local state store for the currently selected * @property {Object} The local state store for the currently selected