mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 18:47:58 +01:00
Fix REPL with foreign window contexts. Other general cleanup.
This commit is contained in:
@@ -28,11 +28,16 @@ var FailedAssertion = Class("FailedAssertion", ErrorBase, {
|
||||
|
||||
var Point = Struct("x", "y");
|
||||
|
||||
var wrapCallback = function wrapCallback(fn) {
|
||||
var wrapCallback = function wrapCallback(fn, isEvent) {
|
||||
if (!fn.wrapper)
|
||||
fn.wrapper = function wrappedCallback() {
|
||||
try {
|
||||
return fn.apply(this, arguments);
|
||||
let res = fn.apply(this, arguments);
|
||||
if (isEvent && res === false) {
|
||||
arguments[0].preventDefault();
|
||||
arguments[0].stopPropagation();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
catch (e) {
|
||||
util.reportError(e);
|
||||
|
||||
Reference in New Issue
Block a user