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

Use document rather than window for localStore and dactylFocusAllowed.

This commit is contained in:
Kris Maglione
2010-12-24 05:31:14 -05:00
parent cace9f737c
commit a8d2678ad1
2 changed files with 14 additions and 10 deletions

View File

@@ -161,6 +161,9 @@ const Buffer = Module("buffer", {
}, },
_triggerLoadAutocmd: function _triggerLoadAutocmd(name, doc, uri) { _triggerLoadAutocmd: function _triggerLoadAutocmd(name, doc, uri) {
if (!(uri || doc.location))
return;
uri = uri || util.newURI(doc.location.href); uri = uri || util.newURI(doc.location.href);
let args = { let args = {
url: { toString: function () uri.spec, valueOf: function () uri }, url: { toString: function () uri.spec, valueOf: function () uri },
@@ -292,8 +295,8 @@ const Buffer = Module("buffer", {
onLocationChange.superapply(this, arguments); onLocationChange.superapply(this, arguments);
statusline.updateUrl(); statusline.updateUrl();
statusline.updateProgress(webProgress.DOMWindow || content); statusline.updateProgress(webProgress.DOMWindow || content);
for (let frame in values(buffer.allFrames())) for (let frame in values(buffer.allFrames(webProgress.DOMWindow || content)))
frame.dactylFocusAllowed = false; frame.document.dactylFocusAllowed = false;
// Workaround for bugs 591425 and 606877, dactyl bug #81 // Workaround for bugs 591425 and 606877, dactyl bug #81
let collapse = uri && uri.scheme === "dactyl" && webProgress.isLoadingDocument; let collapse = uri && uri.scheme === "dactyl" && webProgress.isLoadingDocument;
@@ -372,9 +375,9 @@ const Buffer = Module("buffer", {
* tab. * tab.
*/ */
get localStore() { get localStore() {
if (!content.dactylStore) if (!content.document.dactylStore)
content.dactylStore = {}; content.document.dactylStore = {};
return content.dactylStore; return content.document.dactylStore;
}, },
/** /**
@@ -524,8 +527,8 @@ const Buffer = Module("buffer", {
focusAllowed: function (elem) { focusAllowed: function (elem) {
if (elem instanceof Window && !Editor.getEditor(window)) if (elem instanceof Window && !Editor.getEditor(window))
return true; return true;
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem; let doc = elem.ownerDocument || elem.document || elem;
return !options["strictfocus"] || win.dactylFocusAllowed; return !options["strictfocus"] || doc.dactylFocusAllowed;
}, },
/** /**
@@ -537,11 +540,12 @@ const Buffer = Module("buffer", {
*/ */
focusElement: function (elem) { focusElement: function (elem) {
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem; let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
win.dactylFocusAllowed = true; win.document.dactylFocusAllowed = true;
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement])) if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
elem = elem.contentWindow; elem = elem.contentWindow;
elem.dactylFocusAllowed = true; if (elem.document)
elem.document.dactylFocusAllowed = true;
if (elem instanceof HTMLInputElement && elem.type == "file") { if (elem instanceof HTMLInputElement && elem.type == "file") {
Buffer.openUploadPrompt(elem); Buffer.openUploadPrompt(elem);

View File

@@ -947,7 +947,7 @@ const Events = Module("events", {
let elem = event.target; let elem = event.target;
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem; let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
for (; win; win = win != win.parent && win.parent) for (; win; win = win != win.parent && win.parent)
win.dactylFocusAllowed = true; win.document.dactylFocusAllowed = true;
}, },
onPopupShown: function onPopupShown(event) { onPopupShown: function onPopupShown(event) {