1
0
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:
Kris Maglione
2011-09-05 08:46:31 -04:00
parent aa78825133
commit a5aafe63d9
6 changed files with 34 additions and 21 deletions

View File

@@ -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);