Update qunit-clib to avoid issues with non-writable context.clearTimeout.

This commit is contained in:
John-David Dalton
2013-11-06 08:51:16 -08:00
parent a8196ec99e
commit aa8e92e9a5
2 changed files with 18 additions and 5 deletions

View File

@@ -1531,7 +1531,7 @@
}
});
asyncTest('should call `trailing` with the correct `arguments` and `this` binding', 2, function() {
asyncTest('should execute the `trailing` call with the correct arguments and `this` binding', 2, function() {
if (!(isRhino && isModularize)) {
var args,
count = 0,

View File

@@ -309,10 +309,23 @@
slice = Array.prototype.slice,
timer = new java.util.Timer;
context.clearInterval =
context.clearTimeout = clearTimer;
context.setInterval = setInterval;
context.setTimeout = setTimeout;
(function() {
var getDescriptor = Object.getOwnPropertyDescriptor || function() {
return { 'writable': true };
};
var descriptor;
if ((!context.clearInterval || ((descriptor = getDescriptor(context, 'clearInterval')) && (descriptor.writable || descriptor.set))) &&
(!context.setInterval || ((descriptor = getDescriptor(context, 'setInterval')) && (descriptor.writable || descriptor.set)))) {
context.clearInterval = clearTimer;
context.setInterval = setInterval;
}
if ((!context.clearTimeout || ((descriptor = getDescriptor(context, 'clearTimeout')) && (descriptor.writable || descriptor.set))) &&
(!context.setTimeout || ((descriptor = getDescriptor(context, 'setTimeout')) && (descriptor.writable || descriptor.set)))) {
context.clearTimeout = clearTimer;
context.setTimeout = setTimeout;
}
}());
} catch(e) { }
// expose shortcuts