mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 05:38:01 +01:00
Fix some CPOW issues. Everything is still terrible, though.
This commit is contained in:
@@ -696,7 +696,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
keyword, true);
|
keyword, true);
|
||||||
|
|
||||||
let item = keywords[keyword];
|
let item = keywords[keyword];
|
||||||
if (item && item.url.contains("%s"))
|
if (item && item.url.includes("%s"))
|
||||||
context.fork("keyword/" + keyword, keyword.length + space.length, null, context => {
|
context.fork("keyword/" + keyword, keyword.length + space.length, null, context => {
|
||||||
context.format = history.format;
|
context.format = history.format;
|
||||||
context.title = [/*L*/keyword + " Quick Search"];
|
context.title = [/*L*/keyword + " Quick Search"];
|
||||||
@@ -709,7 +709,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
return history.get({ uri: util.newURI(begin), uriIsPrefix: true }).map(function (item) {
|
return history.get({ uri: util.newURI(begin), uriIsPrefix: true }).map(function (item) {
|
||||||
let rest = item.url.length - end.length;
|
let rest = item.url.length - end.length;
|
||||||
let query = item.url.substring(begin.length, rest);
|
let query = item.url.substring(begin.length, rest);
|
||||||
if (item.url.substr(rest) == end && query.contains("&"))
|
if (item.url.substr(rest) == end && query.includes("&"))
|
||||||
try {
|
try {
|
||||||
item.url = decodeURIComponent(query.replace(/[&#].*/, "").replace(/\+/g, " "));
|
item.url = decodeURIComponent(query.replace(/[&#].*/, "").replace(/\+/g, " "));
|
||||||
if (!seen.add(item.url))
|
if (!seen.add(item.url))
|
||||||
@@ -765,7 +765,7 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
let words = ctxt.filter.toLowerCase().split(/\s+/g);
|
let words = ctxt.filter.toLowerCase().split(/\s+/g);
|
||||||
ctxt.completions = ctxt.completions.filter(i => words.every(w => i.toLowerCase().contains(w)));
|
ctxt.completions = ctxt.completions.filter(i => words.every(w => i.toLowerCase().includes(w)));
|
||||||
|
|
||||||
ctxt.hasItems = ctxt.completions.length;
|
ctxt.hasItems = ctxt.completions.length;
|
||||||
ctxt.incomplete = true;
|
ctxt.incomplete = true;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
|
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
|
||||||
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
|
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
|
||||||
// Copyright (c) 2008-2014 Kris Maglione <maglione.k at Gmail>
|
// Copyright (c) 2008-2015 Kris Maglione <maglione.k at Gmail>
|
||||||
//
|
//
|
||||||
// This work is licensed for reuse under an MIT license. Details are
|
// This work is licensed for reuse under an MIT license. Details are
|
||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
@@ -106,7 +106,10 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
else {
|
else {
|
||||||
// code which should happen for all (also background) newly loaded tabs goes here:
|
// code which should happen for all (also background) newly loaded tabs goes here:
|
||||||
if (doc != config.browser.contentDocument)
|
if (doc != config.browser.contentDocument)
|
||||||
dactyl.echomsg({ domains: [util.getHost(doc.location)], message: _("buffer.backgroundLoaded", (doc.title || doc.location.href)) }, 3);
|
dactyl.echomsg({
|
||||||
|
domains: [util.getHost(doc.location)],
|
||||||
|
message: _("buffer.backgroundLoaded", (doc.title || doc.location.href))
|
||||||
|
}, 3);
|
||||||
|
|
||||||
this._triggerLoadAutocmd("PageLoad", doc);
|
this._triggerLoadAutocmd("PageLoad", doc);
|
||||||
}
|
}
|
||||||
@@ -161,10 +164,11 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
dactyl.applyTriggerObserver("browser.locationChange", arguments);
|
dactyl.applyTriggerObserver("browser.locationChange", arguments);
|
||||||
|
|
||||||
let win = webProgress.DOMWindow;
|
let win = webProgress.DOMWindow;
|
||||||
if (win && uri) {
|
if (win && uri && !Cu.isCrossProcessWrapper(win)) {
|
||||||
Buffer(win).updateZoom();
|
Buffer(win).updateZoom();
|
||||||
|
|
||||||
let oldURI = overlay.getData(win.document)["uri"];
|
let oldURI = overlay.getData(win.document)["uri"];
|
||||||
|
|
||||||
if (overlay.getData(win.document)["load-idx"] === webProgress.loadedTransIndex
|
if (overlay.getData(win.document)["load-idx"] === webProgress.loadedTransIndex
|
||||||
|| !oldURI || uri.spec.replace(/#.*/, "") !== oldURI.replace(/#.*/, ""))
|
|| !oldURI || uri.spec.replace(/#.*/, "") !== oldURI.replace(/#.*/, ""))
|
||||||
for (let frame of buffer.allFrames(win))
|
for (let frame of buffer.allFrames(win))
|
||||||
@@ -204,7 +208,7 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
onProgressChange: function onProgressChange(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) {},
|
onProgressChange: function onProgressChange(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) {},
|
||||||
|
|
||||||
onLocationChange: util.wrapCallback(function onLocationChange(browser) {
|
onLocationChange: util.wrapCallback(function onLocationChange(browser) {
|
||||||
Buffer(browser.contentWindow).locationChanged();
|
Buffer(null, browser).locationChanged();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -646,6 +646,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
* Initialize the help system.
|
* Initialize the help system.
|
||||||
*/
|
*/
|
||||||
initHelp: function initHelp() {
|
initHelp: function initHelp() {
|
||||||
|
util.dumpStack('INIT HELP');
|
||||||
if ("noscriptOverlay" in window)
|
if ("noscriptOverlay" in window)
|
||||||
window.noscriptOverlay.safeAllow("dactyl:", true, false);
|
window.noscriptOverlay.safeAllow("dactyl:", true, false);
|
||||||
|
|
||||||
@@ -852,7 +853,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
click: function onClick(event) {
|
click: function onClick(event) {
|
||||||
let elem = event.originalTarget;
|
let elem = event.originalTarget;
|
||||||
|
|
||||||
if (elem instanceof Ci.nsIDOMElement && services.security.isSystemPrincipal(elem.nodePrincipal)) {
|
if (elem instanceof Ci.nsIDOMElement &&
|
||||||
|
!Cu.isCrossProcessWrapper(elem) &&
|
||||||
|
services.security.isSystemPrincipal(elem.nodePrincipal)) {
|
||||||
let command = elem.getAttributeNS(NS, "command");
|
let command = elem.getAttributeNS(NS, "command");
|
||||||
if (command && event.button == 0) {
|
if (command && event.button == 0) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|||||||
@@ -784,7 +784,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
|
|||||||
context.keys = { text: identity, description: editor.bound.getRegister };
|
context.keys = { text: identity, description: editor.bound.getRegister };
|
||||||
|
|
||||||
context.match = function (r) {
|
context.match = function (r) {
|
||||||
return !this.filter || this.filter.contains(r);
|
return !this.filter || this.filter.includes(r);
|
||||||
};
|
};
|
||||||
|
|
||||||
context.fork("clipboard", 0, this, ctxt => {
|
context.fork("clipboard", 0, this, ctxt => {
|
||||||
|
|||||||
@@ -621,7 +621,8 @@ var Events = Module("events", {
|
|||||||
|
|
||||||
let win = (elem.ownerDocument || elem).defaultView || elem;
|
let win = (elem.ownerDocument || elem).defaultView || elem;
|
||||||
|
|
||||||
if (!(services.focus.getLastFocusMethod(win) & 0x3000)
|
if (!Cu.isCrossProcessWrapper(win) &&
|
||||||
|
!(services.focus.getLastFocusMethod(win) & 0x3000)
|
||||||
&& events.isContentNode(elem)
|
&& events.isContentNode(elem)
|
||||||
&& !buffer.focusAllowed(elem)
|
&& !buffer.focusAllowed(elem)
|
||||||
&& isinstance(elem, [Ci.nsIDOMHTMLInputElement,
|
&& isinstance(elem, [Ci.nsIDOMHTMLInputElement,
|
||||||
@@ -808,7 +809,7 @@ var Events = Module("events", {
|
|||||||
// Prevents certain sites from transferring focus to an input box
|
// Prevents certain sites from transferring focus to an input box
|
||||||
// before we get a chance to process our key bindings on the
|
// before we get a chance to process our key bindings on the
|
||||||
// "keypress" event.
|
// "keypress" event.
|
||||||
if (!pass)
|
if (!pass && Cu.getClassName(event, true) !== "Proxy")
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
},
|
},
|
||||||
keydown: function onKeyDown(event) {
|
keydown: function onKeyDown(event) {
|
||||||
|
|||||||
@@ -155,6 +155,9 @@ var Modes = Module("modes", {
|
|||||||
dactyl.focusContent(true);
|
dactyl.focusContent(true);
|
||||||
if (prev.main == modes.NORMAL) {
|
if (prev.main == modes.NORMAL) {
|
||||||
dactyl.focusContent(true);
|
dactyl.focusContent(true);
|
||||||
|
|
||||||
|
let { win } = buffer;
|
||||||
|
if (!Cu.isCrossProcessWrapper(win) && win instanceof Ci.nsIDOMWindow)
|
||||||
for (let frame of buffer.allFrames()) {
|
for (let frame of buffer.allFrames()) {
|
||||||
// clear any selection made
|
// clear any selection made
|
||||||
let selection = frame.getSelection();
|
let selection = frame.getSelection();
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
/** @scope modules */
|
/** @scope modules */
|
||||||
|
|
||||||
|
let securityState = new WeakMap();
|
||||||
|
|
||||||
var StatusLine = Module("statusline", {
|
var StatusLine = Module("statusline", {
|
||||||
init: function init() {
|
init: function init() {
|
||||||
this._statusLine = document.getElementById("status-bar");
|
this._statusLine = document.getElementById("status-bar");
|
||||||
@@ -121,7 +123,7 @@ var StatusLine = Module("statusline", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.security = content.document.dactylSecurity || "insecure";
|
this.security = securityState.get(content) || "insecure";
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
},
|
},
|
||||||
@@ -179,7 +181,7 @@ var StatusLine = Module("statusline", {
|
|||||||
this.security = "insecure";
|
this.security = "insecure";
|
||||||
|
|
||||||
if (webProgress && webProgress.DOMWindow)
|
if (webProgress && webProgress.DOMWindow)
|
||||||
webProgress.DOMWindow.document.dactylSecurity = this.security;
|
securityState.set(webProgress.DOMWindow, this.security);
|
||||||
},
|
},
|
||||||
"browser.stateChange": function onStateChange(webProgress, request, flags, status) {
|
"browser.stateChange": function onStateChange(webProgress, request, flags, status) {
|
||||||
const L = Ci.nsIWebProgressListener;
|
const L = Ci.nsIWebProgressListener;
|
||||||
@@ -261,12 +263,13 @@ var StatusLine = Module("statusline", {
|
|||||||
if (isinstance(uri, Ci.nsIURI)) {
|
if (isinstance(uri, Ci.nsIURI)) {
|
||||||
// when session information is available, add [+] when we can go
|
// when session information is available, add [+] when we can go
|
||||||
// backwards, [-] when we can go forwards
|
// backwards, [-] when we can go forwards
|
||||||
if (uri.equals(buffer.uri) && window.getWebNavigation) {
|
if (uri.equals(buffer.uri)) {
|
||||||
let sh = window.getWebNavigation().sessionHistory;
|
let { webNav } = buffer;
|
||||||
if (sh && sh.index > 0)
|
if (webNav.canGoBack)
|
||||||
modified += "-";
|
modified += "-";
|
||||||
if (sh && sh.index < sh.count - 1)
|
if (webNav.canGoForward)
|
||||||
modified += "+";
|
modified += "+";
|
||||||
|
|
||||||
if (this.bookmarked)
|
if (this.bookmarked)
|
||||||
modified += UTF8("❤");
|
modified += UTF8("❤");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ var Tabs = Module("tabs", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_alternates: Class.Memoize(() => [config.tabbrowser.mCurrentTab, null]),
|
_alternates: Class.Memoize(() => [gBrowser.mCurrentTab, null]),
|
||||||
|
|
||||||
cleanup: function cleanup() {
|
cleanup: function cleanup() {
|
||||||
for (let tab of this.allTabs) {
|
for (let tab of this.allTabs) {
|
||||||
@@ -118,7 +118,7 @@ var Tabs = Module("tabs", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
get allTabs() {
|
get allTabs() {
|
||||||
return Array.slice(config.tabbrowser.tabContainer.childNodes);
|
return Array.slice(gBrowser.tabs);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,7 +136,7 @@ var Tabs = Module("tabs", {
|
|||||||
*/
|
*/
|
||||||
get browsers() {
|
get browsers() {
|
||||||
return function* () {
|
return function* () {
|
||||||
for (let [i, browser] of config.tabbrowser.browsers.entries())
|
for (let [i, browser] of gBrowser.browsers.entries())
|
||||||
if (browser !== undefined) // Bug in Google's Page Speed add-on.
|
if (browser !== undefined) // Bug in Google's Page Speed add-on.
|
||||||
yield [i, browser];
|
yield [i, browser];
|
||||||
}();
|
}();
|
||||||
@@ -145,7 +145,7 @@ var Tabs = Module("tabs", {
|
|||||||
/**
|
/**
|
||||||
* @property {number} The number of tabs in the current window.
|
* @property {number} The number of tabs in the current window.
|
||||||
*/
|
*/
|
||||||
get count() { return config.tabbrowser.mTabs.length; },
|
get count() { return gBrowser.mTabs.length; },
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {Object} The local options store for the current tab.
|
* @property {Object} The local options store for the current tab.
|
||||||
@@ -153,7 +153,7 @@ var Tabs = Module("tabs", {
|
|||||||
get options() { return this.localStore.options; },
|
get options() { return this.localStore.options; },
|
||||||
|
|
||||||
get visibleTabs() {
|
get visibleTabs() {
|
||||||
return config.tabbrowser.visibleTabs ||
|
return gBrowser.visibleTabs ||
|
||||||
this.allTabs.filter(tab => !tab.hidden);
|
this.allTabs.filter(tab => !tab.hidden);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -202,11 +202,11 @@ var Tabs = Module("tabs", {
|
|||||||
* @param {boolean} activate Whether to select the newly cloned tab.
|
* @param {boolean} activate Whether to select the newly cloned tab.
|
||||||
*/
|
*/
|
||||||
cloneTab: function cloneTab(tab, activate) {
|
cloneTab: function cloneTab(tab, activate) {
|
||||||
let newTab = config.tabbrowser.addTab("about:blank", { ownerTab: tab });
|
let newTab = gBrowser.addTab("about:blank", { ownerTab: tab });
|
||||||
Tabs.copyTab(newTab, tab);
|
Tabs.copyTab(newTab, tab);
|
||||||
|
|
||||||
if (activate)
|
if (activate)
|
||||||
config.tabbrowser.mTabContainer.selectedItem = newTab;
|
gBrowser.mTabContainer.selectedItem = newTab;
|
||||||
|
|
||||||
return newTab;
|
return newTab;
|
||||||
},
|
},
|
||||||
@@ -219,7 +219,7 @@ var Tabs = Module("tabs", {
|
|||||||
*/
|
*/
|
||||||
detachTab: function detachTab(tab) {
|
detachTab: function detachTab(tab) {
|
||||||
if (!tab)
|
if (!tab)
|
||||||
tab = config.tabbrowser.mTabContainer.selectedItem;
|
tab = gBrowser.mTabContainer.selectedItem;
|
||||||
|
|
||||||
services.windowWatcher
|
services.windowWatcher
|
||||||
.openWindow(window, window.getBrowserURL(), null, "chrome,dialog=no,all", tab);
|
.openWindow(window, window.getBrowserURL(), null, "chrome,dialog=no,all", tab);
|
||||||
@@ -280,7 +280,7 @@ var Tabs = Module("tabs", {
|
|||||||
return index;
|
return index;
|
||||||
if (index != null)
|
if (index != null)
|
||||||
return this[visible ? "visibleTabs" : "allTabs"][index];
|
return this[visible ? "visibleTabs" : "allTabs"][index];
|
||||||
return config.tabbrowser.mCurrentTab;
|
return gBrowser.mCurrentTab;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -293,7 +293,7 @@ var Tabs = Module("tabs", {
|
|||||||
*/
|
*/
|
||||||
index: function index(tab, visible) {
|
index: function index(tab, visible) {
|
||||||
let tabs = this[visible ? "visibleTabs" : "allTabs"];
|
let tabs = this[visible ? "visibleTabs" : "allTabs"];
|
||||||
return tabs.indexOf(tab || config.tabbrowser.mCurrentTab);
|
return tabs.indexOf(tab || gBrowser.mCurrentTab);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -340,7 +340,7 @@ var Tabs = Module("tabs", {
|
|||||||
* @param {Object} tab The tab to keep.
|
* @param {Object} tab The tab to keep.
|
||||||
*/
|
*/
|
||||||
keepOnly: function keepOnly(tab) {
|
keepOnly: function keepOnly(tab) {
|
||||||
config.tabbrowser.removeAllTabsBut(tab);
|
gBrowser.removeAllTabsBut(tab);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -416,7 +416,7 @@ var Tabs = Module("tabs", {
|
|||||||
*/
|
*/
|
||||||
move: function move(tab, spec, wrap) {
|
move: function move(tab, spec, wrap) {
|
||||||
let index = tabs.indexFromSpec(spec, wrap, -1);
|
let index = tabs.indexFromSpec(spec, wrap, -1);
|
||||||
config.tabbrowser.moveTabTo(tab, index);
|
gBrowser.moveTabTo(tab, index);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -439,7 +439,7 @@ var Tabs = Module("tabs", {
|
|||||||
next = index + (focusLeftTab ? 1 : -1);
|
next = index + (focusLeftTab ? 1 : -1);
|
||||||
if (next in tabs) {
|
if (next in tabs) {
|
||||||
this._alternates[0] = tabs[next];
|
this._alternates[0] = tabs[next];
|
||||||
config.tabbrowser.mTabContainer.selectedItem = tabs[next];
|
gBrowser.mTabContainer.selectedItem = tabs[next];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (focusLeftTab)
|
if (focusLeftTab)
|
||||||
@@ -464,10 +464,10 @@ var Tabs = Module("tabs", {
|
|||||||
try {
|
try {
|
||||||
if (bypassCache) {
|
if (bypassCache) {
|
||||||
const flags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY | Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
|
const flags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY | Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
|
||||||
config.tabbrowser.getBrowserForTab(tab).reloadWithFlags(flags);
|
gBrowser.getBrowserForTab(tab).reloadWithFlags(flags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
config.tabbrowser.reloadTab(tab);
|
gBrowser.reloadTab(tab);
|
||||||
}
|
}
|
||||||
catch (e if !(e instanceof Error)) {}
|
catch (e if !(e instanceof Error)) {}
|
||||||
},
|
},
|
||||||
@@ -501,7 +501,7 @@ var Tabs = Module("tabs", {
|
|||||||
if (index == -1)
|
if (index == -1)
|
||||||
dactyl.beep();
|
dactyl.beep();
|
||||||
else
|
else
|
||||||
config.tabbrowser.mTabContainer.selectedIndex = index;
|
gBrowser.mTabContainer.selectedIndex = index;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -606,7 +606,7 @@ var Tabs = Module("tabs", {
|
|||||||
if (!tabs) {
|
if (!tabs) {
|
||||||
if (this.getTab() == this._alternates[0]
|
if (this.getTab() == this._alternates[0]
|
||||||
|| this.alternate && this.allTabs.indexOf(this._alternates[0]) == -1
|
|| this.alternate && this.allTabs.indexOf(this._alternates[0]) == -1
|
||||||
|| this.alternate && config.tabbrowser._removingTabs && config.tabbrowser._removingTabs.indexOf(this._alternates[0]) >= 0)
|
|| this.alternate && gBrowser._removingTabs && gBrowser._removingTabs.indexOf(this._alternates[0]) >= 0)
|
||||||
tabs = [this.getTab(), this.alternate];
|
tabs = [this.getTab(), this.alternate];
|
||||||
}
|
}
|
||||||
this._alternates = tabs || [this.getTab(), this._alternates[0]];
|
this._alternates = tabs || [this.getTab(), this._alternates[0]];
|
||||||
@@ -614,7 +614,7 @@ var Tabs = Module("tabs", {
|
|||||||
}, {
|
}, {
|
||||||
copyTab: function (to, from) {
|
copyTab: function (to, from) {
|
||||||
if (!from)
|
if (!from)
|
||||||
from = config.tabbrowser.mTabContainer.selectedItem;
|
from = gBrowser.mTabContainer.selectedItem;
|
||||||
|
|
||||||
let tabState = services.sessionStore.getTabState(from);
|
let tabState = services.sessionStore.getTabState(from);
|
||||||
services.sessionStore.setTabState(to, tabState);
|
services.sessionStore.setTabState(to, tabState);
|
||||||
@@ -1146,7 +1146,7 @@ var Tabs = Module("tabs", {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
events: function initEvents() {
|
events: function initEvents() {
|
||||||
let tabContainer = config.tabbrowser.mTabContainer;
|
let tabContainer = gBrowser.mTabContainer;
|
||||||
function callback() {
|
function callback() {
|
||||||
tabs.timeout(function () { this.updateTabCount(); });
|
tabs.timeout(function () { this.updateTabCount(); });
|
||||||
}
|
}
|
||||||
@@ -1268,8 +1268,8 @@ var Tabs = Module("tabs", {
|
|||||||
else
|
else
|
||||||
config.tabStrip.collapsed = false;
|
config.tabStrip.collapsed = false;
|
||||||
|
|
||||||
if (config.tabbrowser.tabContainer._positionPinnedTabs)
|
if (gBrowser.tabContainer._positionPinnedTabs)
|
||||||
config.tabbrowser.tabContainer._positionPinnedTabs();
|
gBrowser.tabContainer._positionPinnedTabs();
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
values: {
|
values: {
|
||||||
|
|||||||
@@ -275,6 +275,8 @@ literal.locations = literal_.locations;
|
|||||||
function apply(obj, meth, args) {
|
function apply(obj, meth, args) {
|
||||||
// The function's own apply method breaks in strange ways
|
// The function's own apply method breaks in strange ways
|
||||||
// when using CPOWs.
|
// when using CPOWs.
|
||||||
|
if (callable(meth))
|
||||||
|
return Function.apply.call(meth, obj, args);
|
||||||
return Function.apply.call(obj[meth], obj, args);
|
return Function.apply.call(obj[meth], obj, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ lazyRequire("promises", ["CancelablePromise", "Promise", "promises"]);
|
|||||||
lazyRequire("sanitizer", ["sanitizer"]);
|
lazyRequire("sanitizer", ["sanitizer"]);
|
||||||
lazyRequire("storage", ["File", "storage"]);
|
lazyRequire("storage", ["File", "storage"]);
|
||||||
lazyRequire("template", ["template"]);
|
lazyRequire("template", ["template"]);
|
||||||
|
let global = this;
|
||||||
/**
|
/**
|
||||||
* A class to manage the primary web content buffer. The name comes
|
* A class to manage the primary web content buffer. The name comes
|
||||||
* from Vim's term, 'buffer', which signifies instances of open
|
* from Vim's term, 'buffer', which signifies instances of open
|
||||||
@@ -30,14 +30,17 @@ lazyRequire("template", ["template"]);
|
|||||||
*/
|
*/
|
||||||
var Buffer = Module("Buffer", {
|
var Buffer = Module("Buffer", {
|
||||||
Local: function Local(dactyl, modules, window) {
|
Local: function Local(dactyl, modules, window) {
|
||||||
|
let gBrowser = window.gBrowser;
|
||||||
return {
|
return {
|
||||||
get win() { return window.content; }
|
get browser() { return gBrowser.mCurrentBrowser; },
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function init(win) {
|
init: function init(win, browser) {
|
||||||
if (win)
|
if (win)
|
||||||
this.win = win;
|
this.win = win;
|
||||||
|
if (browser)
|
||||||
|
this.browser = browser;
|
||||||
},
|
},
|
||||||
|
|
||||||
get addPageInfoSection() { return Buffer.bound.addPageInfoSection; },
|
get addPageInfoSection() { return Buffer.bound.addPageInfoSection; },
|
||||||
@@ -66,7 +69,9 @@ var Buffer = Module("Buffer", {
|
|||||||
/**
|
/**
|
||||||
* The load context of the window bound to this buffer.
|
* The load context of the window bound to this buffer.
|
||||||
*/
|
*/
|
||||||
get loadContext() { return sanitizer.getContext(this.win); },
|
get loadContext() {
|
||||||
|
return sanitizer.getContext(this.win, this.topWindow);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content preference methods.
|
* Content preference methods.
|
||||||
@@ -243,24 +248,62 @@ var Buffer = Module("Buffer", {
|
|||||||
},
|
},
|
||||||
set lastInputField(value) { this.localStore.lastInputField = util.weakReference(value); },
|
set lastInputField(value) { this.localStore.lastInputField = util.weakReference(value); },
|
||||||
|
|
||||||
|
get win() {
|
||||||
|
if (this.browser)
|
||||||
|
return this.browser.contentWindow;
|
||||||
|
return this._win;
|
||||||
|
},
|
||||||
|
|
||||||
|
set win(value) {
|
||||||
|
this._win = value;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {nsIURI} The current top-level document.
|
* @property {nsIURI} The current top-level document.
|
||||||
*/
|
*/
|
||||||
get doc() { return this.win.document; },
|
get doc() {
|
||||||
|
if (this.browser)
|
||||||
|
return this.browser.contentDocument;
|
||||||
|
return this.win.document;
|
||||||
|
},
|
||||||
|
|
||||||
get docShell() { return util.docShell(this.win); },
|
get docShell() {
|
||||||
|
let docShell;
|
||||||
|
if (this.browser)
|
||||||
|
docShell = this.browser.docShell;
|
||||||
|
|
||||||
|
if (!docShell && this.win && this.win.QueryInterface)
|
||||||
|
docShell = util.docShell(this.win);
|
||||||
|
|
||||||
|
return docShell;
|
||||||
|
},
|
||||||
|
|
||||||
|
get webNav() {
|
||||||
|
if (this.browser)
|
||||||
|
return this.browser.webNavigation;
|
||||||
|
|
||||||
|
return this.docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||||
|
},
|
||||||
|
|
||||||
get modules() { return this.topWindow.dactyl.modules; },
|
get modules() { return this.topWindow.dactyl.modules; },
|
||||||
set modules(val) {},
|
set modules(val) {},
|
||||||
|
|
||||||
topWindow: Class.Memoize(function () {
|
topWindow: Class.Memoize(function () {
|
||||||
|
if (this.browser)
|
||||||
|
return this.browser.ownerDocument.defaultView;
|
||||||
|
|
||||||
return util.topWindow(this.win);
|
return util.topWindow(this.win);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {nsIURI} The current top-level document's URI.
|
* @property {nsIURI} The current top-level document's URI.
|
||||||
*/
|
*/
|
||||||
get uri() { return util.newURI(this.win.location.href); },
|
get uri() {
|
||||||
|
if (this.browser)
|
||||||
|
return this.browser.currentURI.clone();
|
||||||
|
|
||||||
|
return util.newURI(this.win.location.href);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {nsIURI} The current top-level document's URI, sans
|
* @property {nsIURI} The current top-level document's URI, sans
|
||||||
@@ -278,16 +321,20 @@ var Buffer = Module("Buffer", {
|
|||||||
* fragment identifier.
|
* fragment identifier.
|
||||||
*/
|
*/
|
||||||
get documentURI() {
|
get documentURI() {
|
||||||
return this.doc.documentURIObject ||
|
if (this.browser)
|
||||||
util.newURI(this.doc.documentURI);
|
return this.browser.documentURI.clone();
|
||||||
|
|
||||||
|
return this.uri.cloneIgnoringRef();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {string} The current top-level document's URL.
|
* @property {string} The current top-level document's URL.
|
||||||
*/
|
*/
|
||||||
get URL() {
|
get URL() {
|
||||||
return update(new String(this.win.location.href),
|
let uri = this.browser ? this.browser.currentURI
|
||||||
util.newURI(this.win.location.href));
|
: util.newURI(this.win.location.href);
|
||||||
|
|
||||||
|
return update(new String(uri.spec), uri);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -296,6 +343,9 @@ var Buffer = Module("Buffer", {
|
|||||||
get pageHeight() { return this.win.innerHeight; },
|
get pageHeight() { return this.win.innerHeight; },
|
||||||
|
|
||||||
get contentViewer() {
|
get contentViewer() {
|
||||||
|
if (!this.win || Cu.isCrossProcessWrapper(this.win) || !this.docShell)
|
||||||
|
return null; // e10s
|
||||||
|
|
||||||
return this.docShell.contentViewer
|
return this.docShell.contentViewer
|
||||||
.QueryInterface(Ci.nsIMarkupDocumentViewer ||
|
.QueryInterface(Ci.nsIMarkupDocumentViewer ||
|
||||||
Ci.nsIContentViewer);
|
Ci.nsIContentViewer);
|
||||||
@@ -307,6 +357,9 @@ var Buffer = Module("Buffer", {
|
|||||||
*/
|
*/
|
||||||
get zoomLevel() {
|
get zoomLevel() {
|
||||||
let v = this.contentViewer;
|
let v = this.contentViewer;
|
||||||
|
if (v == null)
|
||||||
|
return this.ZoomManager.zoom * 100;
|
||||||
|
|
||||||
return v[v.textZoom == 1 ? "fullZoom" : "textZoom"] * 100;
|
return v[v.textZoom == 1 ? "fullZoom" : "textZoom"] * 100;
|
||||||
},
|
},
|
||||||
set zoomLevel(value) { this.setZoom(value, this.fullZoom); },
|
set zoomLevel(value) { this.setZoom(value, this.fullZoom); },
|
||||||
@@ -323,7 +376,12 @@ var Buffer = Module("Buffer", {
|
|||||||
/**
|
/**
|
||||||
* @property {string} The current document's title.
|
* @property {string} The current document's title.
|
||||||
*/
|
*/
|
||||||
get title() { return this.doc.title; },
|
get title() {
|
||||||
|
if (this.browser)
|
||||||
|
return this.browser.contentTitle;
|
||||||
|
|
||||||
|
return this.doc.title;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {number} The buffer's horizontal scroll percentile.
|
* @property {number} The buffer's horizontal scroll percentile.
|
||||||
@@ -370,10 +428,20 @@ var Buffer = Module("Buffer", {
|
|||||||
* @property {Window} Returns the currently focused frame.
|
* @property {Window} Returns the currently focused frame.
|
||||||
*/
|
*/
|
||||||
get focusedFrame() {
|
get focusedFrame() {
|
||||||
|
try {
|
||||||
|
if (Cu.isCrossProcessWrapper(this.win))
|
||||||
|
return this.win;
|
||||||
|
} catch (e) {
|
||||||
|
util.dump("WTF: " + e);
|
||||||
|
util.dump(this.win, this.browser);
|
||||||
|
return this.win;
|
||||||
|
}
|
||||||
|
|
||||||
let frame = this.localStore.focusedFrame;
|
let frame = this.localStore.focusedFrame;
|
||||||
return frame && frame.get() || this.win;
|
return frame && frame.get() || this.win;
|
||||||
},
|
},
|
||||||
set focusedFrame(frame) {
|
set focusedFrame(frame) {
|
||||||
|
if (!Cu.isCrossProcessWrapper(this.win))
|
||||||
this.localStore.focusedFrame = util.weakReference(frame);
|
this.localStore.focusedFrame = util.weakReference(frame);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2652,10 +2720,18 @@ var Buffer = Module("Buffer", {
|
|||||||
"boolean", false,
|
"boolean", false,
|
||||||
{
|
{
|
||||||
setter: function (value) {
|
setter: function (value) {
|
||||||
return buffer.contentViewer.authorStyleDisabled = value;
|
let { contentViewer } = buffer;
|
||||||
|
|
||||||
|
if (contentViewer)
|
||||||
|
return contentViewer.authorStyleDisabled = value;
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
getter: function () {
|
getter: function () {
|
||||||
return buffer.contentViewer.authorStyleDisabled;
|
let { contentViewer } = buffer;
|
||||||
|
|
||||||
|
if (contentViewer)
|
||||||
|
return contentViewer.authorStyleDisabled;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
|
|||||||
},
|
},
|
||||||
|
|
||||||
parse: function parse(str) {
|
parse: function parse(str) {
|
||||||
if ('{['.contains(str[0]))
|
if ('{['.includes(str[0]))
|
||||||
return JSON.parse(str);
|
return JSON.parse(str);
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
var substrings = [text];
|
var substrings = [text];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var compare = function compare(text, s) { return text.contains(s); };
|
var compare = function compare(text, s) { return text.includes(s); };
|
||||||
var substrings = [];
|
var substrings = [];
|
||||||
let start = 0;
|
let start = 0;
|
||||||
let idx;
|
let idx;
|
||||||
@@ -1169,7 +1169,7 @@ var Completion = Module("completion", {
|
|||||||
if (context.ignoreCase) {
|
if (context.ignoreCase) {
|
||||||
compare = util.compareIgnoreCase;
|
compare = util.compareIgnoreCase;
|
||||||
contains = function contains_(a, b) {
|
contains = function contains_(a, b) {
|
||||||
return a && a.toLowerCase().contains(b.toLowerCase());
|
return a && a.toLowerCase().includes(b.toLowerCase());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -409,7 +409,9 @@ var Contexts = Module("contexts", {
|
|||||||
return frame;
|
return frame;
|
||||||
},
|
},
|
||||||
|
|
||||||
groups: Class.Memoize(function () { return this.matchingGroups(); }),
|
groups: Class.Memoize(function () {
|
||||||
|
return this.matchingGroups();
|
||||||
|
}),
|
||||||
|
|
||||||
allGroups: Class.Memoize(function () {
|
allGroups: Class.Memoize(function () {
|
||||||
return Object.create(this.groupsProto, {
|
return Object.create(this.groupsProto, {
|
||||||
|
|||||||
@@ -954,6 +954,11 @@ var DOM = Class("DOM", {
|
|||||||
try {
|
try {
|
||||||
if (elem instanceof Ci.nsIDOMDocument)
|
if (elem instanceof Ci.nsIDOMDocument)
|
||||||
elem = elem.defaultView;
|
elem = elem.defaultView;
|
||||||
|
|
||||||
|
if (Cu.isCrossProcessWrapper(elem)) {
|
||||||
|
elem.focus();
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (elem instanceof Ci.nsIDOMElement)
|
if (elem instanceof Ci.nsIDOMElement)
|
||||||
services.focus.setFocus(elem, flags);
|
services.focus.setFocus(elem, flags);
|
||||||
else if (elem instanceof Ci.nsIDOMWindow) {
|
else if (elem instanceof Ci.nsIDOMWindow) {
|
||||||
@@ -962,6 +967,7 @@ var DOM = Class("DOM", {
|
|||||||
services.focus.clearFocus(elem);
|
services.focus.clearFocus(elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
util.dump(elem);
|
util.dump(elem);
|
||||||
util.reportError(e);
|
util.reportError(e);
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ var DownloadList = Class("DownloadList",
|
|||||||
addDownload: function addDownload(download) {
|
addDownload: function addDownload(download) {
|
||||||
if (!this.downloads.has(download)) {
|
if (!this.downloads.has(download)) {
|
||||||
download = Download(download, this);
|
download = Download(download, this);
|
||||||
if (this.filter && !download.displayName.contains(this.filter))
|
if (this.filter && !download.displayName.includes(this.filter))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.downloads.set(download.download, download);
|
this.downloads.set(download.download, download);
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ var Help = Module("Help", {
|
|||||||
| ^ (?P<space> \s*)
|
| ^ (?P<space> \s*)
|
||||||
(?P<char> [-•*+]) \ //
|
(?P<char> [-•*+]) \ //
|
||||||
(?P<content> .*\n
|
(?P<content> .*\n
|
||||||
(?: ${"\\2"} // This is incorrectly interpreted as an octal literal otherwise}\ \ .*\n | \s*\n)* )
|
(?: ${"\\2" /* This is incorrectly interpreted as an octal literal otherwise */}\ \ .*\n | \s*\n)* )
|
||||||
|
|
||||||
| (?P<par>
|
| (?P<par>
|
||||||
(?: ^ [^\S\n]*
|
(?: ^ [^\S\n]*
|
||||||
|
|||||||
@@ -97,9 +97,12 @@ var Modules = function Modules(window) {
|
|||||||
if (normal)
|
if (normal)
|
||||||
return create(proto);
|
return create(proto);
|
||||||
|
|
||||||
let sandbox = Components.utils.Sandbox(window, { sandboxPrototype: proto || modules,
|
let sandbox = Components.utils.Sandbox(Cu.getObjectPrincipal(global),
|
||||||
|
{ sandboxPrototype: proto || modules,
|
||||||
sandboxName: name || ("Dactyl Sandbox " + ++_id),
|
sandboxName: name || ("Dactyl Sandbox " + ++_id),
|
||||||
wantXrays: true });
|
addonId: config.addon.id,
|
||||||
|
wantXrays: true,
|
||||||
|
metadata: { addonID: config.addon.id } });
|
||||||
|
|
||||||
// Hack:
|
// Hack:
|
||||||
// sandbox.Object = jsmodules.Object;
|
// sandbox.Object = jsmodules.Object;
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
|||||||
delete desc.writable;
|
delete desc.writable;
|
||||||
desc.get = function get() { return value; }
|
desc.get = function get() { return value; }
|
||||||
desc.set = function set(val) {
|
desc.set = function set(val) {
|
||||||
if (!callable(val) || !Function.prototype.toString(val).contains(sentinel))
|
if (!callable(val) || !Function.prototype.toString(val).includes(sentinel))
|
||||||
Class.replaceProperty(this, k, val);
|
Class.replaceProperty(this, k, val);
|
||||||
else {
|
else {
|
||||||
let package_ = util.newURI(Components.stack.caller.filename).host;
|
let package_ = util.newURI(Components.stack.caller.filename).host;
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
|||||||
function* prefs() {
|
function* prefs() {
|
||||||
for (let pref of prefArray) {
|
for (let pref of prefArray) {
|
||||||
let userValue = services.pref.prefHasUserValue(pref);
|
let userValue = services.pref.prefHasUserValue(pref);
|
||||||
if (onlyNonDefault && !userValue || !pref.contains(filter))
|
if (onlyNonDefault && !userValue || !pref.includes(filter))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
let value = this.get(pref);
|
let value = this.get(pref);
|
||||||
|
|||||||
@@ -329,10 +329,13 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
* @param {Window|Document|Node} thing The thing for which to return
|
* @param {Window|Document|Node} thing The thing for which to return
|
||||||
* a load context.
|
* a load context.
|
||||||
*/
|
*/
|
||||||
getContext: function getContext(thing) {
|
getContext: function getContext(thing, global = null) {
|
||||||
if (!Ci.nsILoadContext)
|
if (!Ci.nsILoadContext)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (Cu.isCrossProcessWrapper(thing) && global)
|
||||||
|
thing = global;
|
||||||
|
|
||||||
if (thing instanceof Ci.nsIDOMNode && thing.ownerDocument)
|
if (thing instanceof Ci.nsIDOMNode && thing.ownerDocument)
|
||||||
thing = thing.ownerDocument;
|
thing = thing.ownerDocument;
|
||||||
if (thing instanceof Ci.nsIDOMDocument)
|
if (thing instanceof Ci.nsIDOMDocument)
|
||||||
@@ -634,7 +637,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
completion: function initCompletion(dactyl, modules, window) {
|
completion: function initCompletion(dactyl, modules, window) {
|
||||||
modules.completion.visibleHosts = function completeHosts(context) {
|
modules.completion.visibleHosts = function completeHosts(context) {
|
||||||
let res = util.visibleHosts(window.content);
|
let res = util.visibleHosts(window.content);
|
||||||
if (context.filter && !res.some(host => host.contains(context.filter)))
|
if (context.filter && !res.some(host => host.includes(context.filter)))
|
||||||
res.push(context.filter);
|
res.push(context.filter);
|
||||||
|
|
||||||
context.title = ["Domain"];
|
context.title = ["Domain"];
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ var Hive = Class("Hive", {
|
|||||||
name = null;
|
name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter && filter.contains(","))
|
if (filter && filter.includes(","))
|
||||||
return filter.split(",").reduce(
|
return filter.split(",").reduce(
|
||||||
(n, f) => n + this.removeSheet(name, f, index), 0);
|
(n, f) => n + this.removeSheet(name, f, index), 0);
|
||||||
|
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
rec([]);
|
rec([]);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
catch (e if e.message && e.message.contains("res is undefined")) {
|
catch (e if e.message && e.message.includes("res is undefined")) {
|
||||||
// prefs.safeSet() would be reset on :rehash
|
// prefs.safeSet() would be reset on :rehash
|
||||||
prefs.set("javascript.options.methodjit.chrome", false);
|
prefs.set("javascript.options.methodjit.chrome", false);
|
||||||
util.dactyl.warn(_(UTF8("error.damnYouJägermonkey")));
|
util.dactyl.warn(_(UTF8("error.damnYouJägermonkey")));
|
||||||
@@ -591,7 +591,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
*/
|
*/
|
||||||
dequote: function dequote(pattern, chars) {
|
dequote: function dequote(pattern, chars) {
|
||||||
return pattern.replace(/\\(.)/,
|
return pattern.replace(/\\(.)/,
|
||||||
(m0, m1) => chars.contains(m1) ? m1 : m0);
|
(m0, m1) => chars.includes(m1) ? m1 : m0);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1485,6 +1485,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
this.dump(util.stackLines(error.stack).join("\n"));
|
this.dump(util.stackLines(error.stack).join("\n"));
|
||||||
}
|
}
|
||||||
catch (e) { dump(e + "\n"); }
|
catch (e) { dump(e + "\n"); }
|
||||||
|
dump("Stack: " + Error().stack + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ctypes.open("libc.so.6").declare("kill", ctypes.default_abi, ctypes.void_t, ctypes.int, ctypes.int)(
|
// ctypes.open("libc.so.6").declare("kill", ctypes.default_abi, ctypes.void_t, ctypes.int, ctypes.int)(
|
||||||
@@ -1727,10 +1728,11 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
* @returns {Window} The top-level parent window.
|
* @returns {Window} The top-level parent window.
|
||||||
*/
|
*/
|
||||||
topWindow: function topWindow(win) {
|
topWindow: function topWindow(win) {
|
||||||
return win.QueryInterface(Ci.nsIInterfaceRequestor)
|
let docShell = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIDocShell);
|
||||||
.QueryInterface(Ci.nsIDocShellTreeItem).rootTreeItem
|
let { rootTreeItem } = docShell;
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
if (rootTreeItem)
|
||||||
|
return rootTreeItem.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindow);
|
.getInterface(Ci.nsIDOMWindow);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1742,9 +1744,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
*/
|
*/
|
||||||
trapErrors: function trapErrors(func, self, ...args) {
|
trapErrors: function trapErrors(func, self, ...args) {
|
||||||
try {
|
try {
|
||||||
if (!callable(func))
|
return apply(self || this, func, args);
|
||||||
func = self[func];
|
|
||||||
return func.apply(self || this, args);
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
this.reportError(e);
|
this.reportError(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user