Unclamp setTimeout in Safari
Fixes #2008 wrapping setTimeout in postMessage is a trade-off between * slowdown due to postMessage (slow on Safari) * speedup due to no setTimeout clamping (can be severe on Safari)
This commit is contained in:
@@ -2,7 +2,8 @@ getJasmineRequireObj().clearStack = function(j$) {
|
|||||||
const maxInlineCallCount = 10;
|
const maxInlineCallCount = 10;
|
||||||
|
|
||||||
function browserQueueMicrotaskImpl(global) {
|
function browserQueueMicrotaskImpl(global) {
|
||||||
const { setTimeout, queueMicrotask } = global;
|
const unclampedSetTimeout = getUnclampedSetTimeout(global);
|
||||||
|
const { queueMicrotask } = global;
|
||||||
let currentCallCount = 0;
|
let currentCallCount = 0;
|
||||||
return function clearStack(fn) {
|
return function clearStack(fn) {
|
||||||
currentCallCount++;
|
currentCallCount++;
|
||||||
@@ -11,7 +12,7 @@ getJasmineRequireObj().clearStack = function(j$) {
|
|||||||
queueMicrotask(fn);
|
queueMicrotask(fn);
|
||||||
} else {
|
} else {
|
||||||
currentCallCount = 0;
|
currentCallCount = 0;
|
||||||
setTimeout(fn);
|
unclampedSetTimeout(fn);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user