fix __defineGetter__ errors on ie
This commit is contained in:
parent
0002bf4e4c
commit
aa76fffaf2
2 changed files with 26 additions and 8 deletions
|
|
@ -617,11 +617,29 @@ env.editor.setOptions({
|
||||||
});
|
});
|
||||||
|
|
||||||
// allow easy access to ace in console, but not in ace code which uses strict
|
// allow easy access to ace in console, but not in ace code which uses strict
|
||||||
function isNonStrict() {
|
void function() {
|
||||||
try { return !!arguments.callee.caller.caller }
|
function isStrict() {
|
||||||
catch(e){ return false }
|
try { return !arguments.callee.caller.caller.caller}
|
||||||
|
catch(e){ return true }
|
||||||
}
|
}
|
||||||
window.__defineGetter__("ace", function(){ return isNonStrict() && env.editor });
|
function warn() {
|
||||||
window.__defineGetter__("editor", function(){ return isNonStrict() && env.editor });
|
if (isStrict()) {
|
||||||
window.__defineGetter__("session", function(){ return isNonStrict() && env.editor.session });
|
console.error("trying to access to global variable");
|
||||||
window.__defineGetter__("split", function(){ return isNonStrict() && env.split });
|
}
|
||||||
|
}
|
||||||
|
function def(o, key, get) {
|
||||||
|
Object.defineProperty(o, key, {
|
||||||
|
configurable: true,
|
||||||
|
get: get,
|
||||||
|
set: function(val) {
|
||||||
|
delete o[key];
|
||||||
|
o[key] = val;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
def(window, "ace", function(){ warn(); return env.editor });
|
||||||
|
def(window, "editor", function(){ warn(); return env.editor });
|
||||||
|
def(window, "session", function(){ warn(); return env.editor.session });
|
||||||
|
def(window, "split", function(){ warn(); return env.split });
|
||||||
|
|
||||||
|
}();
|
||||||
|
|
@ -57,7 +57,7 @@ function HashHandler(config, platform) {
|
||||||
return this.commandKeyBinding = val;
|
return this.commandKeyBinding = val;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.commmandKeyBinding = commandKeyBinding;
|
this.commmandKeyBinding = this.commandKeyBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addCommands(config);
|
this.addCommands(config);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue