Remove code to support browsers that don't have MessageChannel
Jasmine hasn't actually run in any such browsers since 2.x.
This commit is contained in:
@@ -10829,12 +10829,10 @@ getJasmineRequireObj().StackClearer = function(j$) {
|
|||||||
// Unlike browsers, Node doesn't require us to do a periodic setTimeout
|
// Unlike browsers, Node doesn't require us to do a periodic setTimeout
|
||||||
// so we avoid the overhead.
|
// so we avoid the overhead.
|
||||||
return nodeQueueMicrotaskImpl(global);
|
return nodeQueueMicrotaskImpl(global);
|
||||||
} else if (SAFARI_OR_WIN_WEBKIT || !global.MessageChannel /* tests */) {
|
} else if (SAFARI_OR_WIN_WEBKIT) {
|
||||||
// queueMicrotask is dramatically faster than MessageChannel in Safari
|
// queueMicrotask is dramatically faster than MessageChannel in Safari
|
||||||
// and other WebKit-based browsers, such as the one distributed by Playwright
|
// and other WebKit-based browsers, such as the one distributed by Playwright
|
||||||
// to test Safari-like behavior on Windows.
|
// to test Safari-like behavior on Windows.
|
||||||
// Some of our own integration tests provide a mock queueMicrotask in all
|
|
||||||
// environments because it's simpler to mock than MessageChannel.
|
|
||||||
return browserQueueMicrotaskImpl(global);
|
return browserQueueMicrotaskImpl(global);
|
||||||
} else {
|
} else {
|
||||||
// MessageChannel is faster than queueMicrotask in supported browsers
|
// MessageChannel is faster than queueMicrotask in supported browsers
|
||||||
|
|||||||
@@ -73,17 +73,6 @@ describe('StackClearer', function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when MessageChannel is unavailable', function() {
|
|
||||||
usesQueueMicrotaskWithSetTimeout(function() {
|
|
||||||
return {
|
|
||||||
navigator: {
|
|
||||||
userAgent: 'CERN-LineMode/2.15 libwww/2.17b3',
|
|
||||||
MessageChannel: undefined
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('in Node', function() {
|
describe('in Node', function() {
|
||||||
|
|||||||
@@ -1118,6 +1118,13 @@ describe('Env integration', function() {
|
|||||||
removeEventListener() {},
|
removeEventListener() {},
|
||||||
queueMicrotask: function(fn) {
|
queueMicrotask: function(fn) {
|
||||||
queueMicrotask(fn);
|
queueMicrotask(fn);
|
||||||
|
},
|
||||||
|
// Enough Node globals to make getStackClearer() return the microtask
|
||||||
|
// implementation, which is the easiest to mock
|
||||||
|
process: {
|
||||||
|
versions: {
|
||||||
|
node: ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1194,6 +1201,13 @@ describe('Env integration', function() {
|
|||||||
removeEventListener() {},
|
removeEventListener() {},
|
||||||
queueMicrotask: function(fn) {
|
queueMicrotask: function(fn) {
|
||||||
queueMicrotask(fn);
|
queueMicrotask(fn);
|
||||||
|
},
|
||||||
|
// Enough Node globals to make getStackClearer() return the microtask
|
||||||
|
// implementation, which is the easiest to mock
|
||||||
|
process: {
|
||||||
|
versions: {
|
||||||
|
node: ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2807,6 +2821,13 @@ describe('Env integration', function() {
|
|||||||
},
|
},
|
||||||
queueMicrotask: function(fn) {
|
queueMicrotask: function(fn) {
|
||||||
queueMicrotask(fn);
|
queueMicrotask(fn);
|
||||||
|
},
|
||||||
|
// Enough Node globals to make getStackClearer() return the microtask
|
||||||
|
// implementation, which is the easiest to mock
|
||||||
|
process: {
|
||||||
|
versions: {
|
||||||
|
node: ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ describe('Global error handling (integration)', function() {
|
|||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reports errors that occur during loading', async function() {
|
function mockGlobal() {
|
||||||
const global = {
|
return {
|
||||||
...browserEventMethods(),
|
...browserEventMethods(),
|
||||||
setTimeout: function(fn, delay) {
|
setTimeout: function(fn, delay) {
|
||||||
return setTimeout(fn, delay);
|
return setTimeout(fn, delay);
|
||||||
@@ -23,9 +23,19 @@ describe('Global error handling (integration)', function() {
|
|||||||
queueMicrotask: function(fn) {
|
queueMicrotask: function(fn) {
|
||||||
queueMicrotask(fn);
|
queueMicrotask(fn);
|
||||||
},
|
},
|
||||||
onerror: function() {}
|
onerror: function() {},
|
||||||
|
// Enough Node globals to make getStackClearer() return the microtask
|
||||||
|
// implementation, which is the easiest to mock
|
||||||
|
process: {
|
||||||
|
versions: {
|
||||||
|
node: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
it('reports errors that occur during loading', async function() {
|
||||||
|
const global = mockGlobal();
|
||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
const reporter = jasmine.createSpyObj('reporter', [
|
const reporter = jasmine.createSpyObj('reporter', [
|
||||||
@@ -69,20 +79,9 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe('If suppressLoadErrors: true was passed', function() {
|
describe('If suppressLoadErrors: true was passed', function() {
|
||||||
it('does not install a global error handler during loading', async function() {
|
it('does not install a global error handler during loading', async function() {
|
||||||
|
const global = mockGlobal();
|
||||||
const originalOnerror = jasmine.createSpy('original onerror');
|
const originalOnerror = jasmine.createSpy('original onerror');
|
||||||
const global = {
|
global.onerror = originalOnerror;
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
},
|
|
||||||
onerror: originalOnerror
|
|
||||||
};
|
|
||||||
const globalErrors = new privateUnderTest.GlobalErrors(global);
|
const globalErrors = new privateUnderTest.GlobalErrors(global);
|
||||||
const onerror = jasmine.createSpy('onerror');
|
const onerror = jasmine.createSpy('onerror');
|
||||||
globalErrors.pushListener(onerror);
|
globalErrors.pushListener(onerror);
|
||||||
@@ -114,18 +113,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe('Handling unhandled exceptions', function() {
|
describe('Handling unhandled exceptions', function() {
|
||||||
it('routes unhandled exceptions to the running spec', async function() {
|
it('routes unhandled exceptions to the running spec', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
const reporter = jasmine.createSpyObj('fakeReporter', [
|
const reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
@@ -154,19 +142,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe('When the most recently running spec has reported specDone', function() {
|
describe('When the most recently running spec has reported specDone', function() {
|
||||||
it('routes unhandled exceptions to an ancestor suite', async function() {
|
it('routes unhandled exceptions to an ancestor suite', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn) {
|
|
||||||
clearTimeout(fn);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const stackClearer = privateUnderTest.getStackClearer(global);
|
const stackClearer = privateUnderTest.getStackClearer(global);
|
||||||
const realClearStack = stackClearer.clearStack;
|
const realClearStack = stackClearer.clearStack;
|
||||||
const clearStackCallbacks = {};
|
const clearStackCallbacks = {};
|
||||||
@@ -221,18 +197,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('routes unhandled exceptions to the running suite', async function() {
|
it('routes unhandled exceptions to the running suite', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
const reporter = jasmine.createSpyObj('fakeReporter', [
|
const reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
@@ -273,19 +238,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe('When the most recently suite has reported suiteDone', function() {
|
describe('When the most recently suite has reported suiteDone', function() {
|
||||||
it('routes unhandled exceptions to an ancestor suite', async function() {
|
it('routes unhandled exceptions to an ancestor suite', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const stackClearer = privateUnderTest.getStackClearer(global);
|
const stackClearer = privateUnderTest.getStackClearer(global);
|
||||||
const realClearStack = stackClearer.clearStack;
|
const realClearStack = stackClearer.clearStack;
|
||||||
const clearStackCallbacks = {};
|
const clearStackCallbacks = {};
|
||||||
@@ -344,18 +297,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe('When the env has started reporting jasmineDone', function() {
|
describe('When the env has started reporting jasmineDone', function() {
|
||||||
it('logs the error to the console', async function() {
|
it('logs the error to the console', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
|
|
||||||
@@ -386,19 +328,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('routes all errors that occur during stack clearing somewhere', async function() {
|
it('routes all errors that occur during stack clearing somewhere', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn) {
|
|
||||||
clearTimeout(fn);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const stackClearer = privateUnderTest.getStackClearer(global);
|
const stackClearer = privateUnderTest.getStackClearer(global);
|
||||||
const realClearStack = stackClearer.clearStack;
|
const realClearStack = stackClearer.clearStack;
|
||||||
let clearStackCallCount = 0;
|
let clearStackCallCount = 0;
|
||||||
@@ -462,18 +392,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe('Handling unhandled promise rejections', function() {
|
describe('Handling unhandled promise rejections', function() {
|
||||||
it('routes unhandled promise rejections to the running spec', async function() {
|
it('routes unhandled promise rejections to the running spec', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
const reporter = jasmine.createSpyObj('fakeReporter', [
|
const reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
@@ -504,19 +423,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe('When the most recently running spec has reported specDone', function() {
|
describe('When the most recently running spec has reported specDone', function() {
|
||||||
it('routes unhandled promise rejections to an ancestor suite', async function() {
|
it('routes unhandled promise rejections to an ancestor suite', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn) {
|
|
||||||
clearTimeout(fn);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const stackClearer = privateUnderTest.getStackClearer(global);
|
const stackClearer = privateUnderTest.getStackClearer(global);
|
||||||
const realClearStack = stackClearer.clearStack;
|
const realClearStack = stackClearer.clearStack;
|
||||||
const clearStackCallbacks = {};
|
const clearStackCallbacks = {};
|
||||||
@@ -571,18 +478,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('routes unhandled promise rejections to the running suite', async function() {
|
it('routes unhandled promise rejections to the running suite', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
const reporter = jasmine.createSpyObj('fakeReporter', [
|
const reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
@@ -625,19 +521,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe('When the most recently suite has reported suiteDone', function() {
|
describe('When the most recently suite has reported suiteDone', function() {
|
||||||
it('routes unhandled promise rejections to an ancestor suite', async function() {
|
it('routes unhandled promise rejections to an ancestor suite', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const stackClearer = privateUnderTest.getStackClearer(global);
|
const stackClearer = privateUnderTest.getStackClearer(global);
|
||||||
const realClearStack = stackClearer.clearStack;
|
const realClearStack = stackClearer.clearStack;
|
||||||
const clearStackCallbacks = {};
|
const clearStackCallbacks = {};
|
||||||
@@ -696,18 +580,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe('When the env has started reporting jasmineDone', function() {
|
describe('When the env has started reporting jasmineDone', function() {
|
||||||
it('logs the rejection to the console', async function() {
|
it('logs the rejection to the console', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
|
|
||||||
@@ -740,19 +613,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('routes all unhandled promise rejections that occur during stack clearing somewhere', async function() {
|
it('routes all unhandled promise rejections that occur during stack clearing somewhere', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn) {
|
|
||||||
clearTimeout(fn);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const stackClearer = privateUnderTest.getStackClearer(global);
|
const stackClearer = privateUnderTest.getStackClearer(global);
|
||||||
const realClearStack = stackClearer.clearStack;
|
const realClearStack = stackClearer.clearStack;
|
||||||
let clearStackCallCount = 0;
|
let clearStackCallCount = 0;
|
||||||
@@ -826,18 +687,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
let global, reporter;
|
let global, reporter;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
global = {
|
global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
env.configure({ detectLateRejectionHandling: true });
|
env.configure({ detectLateRejectionHandling: true });
|
||||||
@@ -972,18 +822,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
|
|
||||||
describe("When the unhandled rejection event doesn't have a promise", function() {
|
describe("When the unhandled rejection event doesn't have a promise", function() {
|
||||||
it('reports the rejection', async function() {
|
it('reports the rejection', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
env.configure({ detectLateRejectionHandling: true });
|
env.configure({ detectLateRejectionHandling: true });
|
||||||
const reporter = jasmine.createSpyObj('fakeReporter', [
|
const reporter = jasmine.createSpyObj('fakeReporter', [
|
||||||
@@ -1016,18 +855,7 @@ describe('Global error handling (integration)', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('works when the suite is run multiple times', async function() {
|
it('works when the suite is run multiple times', async function() {
|
||||||
const global = {
|
const global = mockGlobal();
|
||||||
...browserEventMethods(),
|
|
||||||
setTimeout: function(fn, delay) {
|
|
||||||
return setTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
clearTimeout: function(fn, delay) {
|
|
||||||
clearTimeout(fn, delay);
|
|
||||||
},
|
|
||||||
queueMicrotask: function(fn) {
|
|
||||||
queueMicrotask(fn);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
env.cleanup_();
|
env.cleanup_();
|
||||||
env = new privateUnderTest.Env({ global });
|
env = new privateUnderTest.Env({ global });
|
||||||
env.configure({ autoCleanClosures: false });
|
env.configure({ autoCleanClosures: false });
|
||||||
|
|||||||
@@ -141,12 +141,10 @@ getJasmineRequireObj().StackClearer = function(j$) {
|
|||||||
// Unlike browsers, Node doesn't require us to do a periodic setTimeout
|
// Unlike browsers, Node doesn't require us to do a periodic setTimeout
|
||||||
// so we avoid the overhead.
|
// so we avoid the overhead.
|
||||||
return nodeQueueMicrotaskImpl(global);
|
return nodeQueueMicrotaskImpl(global);
|
||||||
} else if (SAFARI_OR_WIN_WEBKIT || !global.MessageChannel /* tests */) {
|
} else if (SAFARI_OR_WIN_WEBKIT) {
|
||||||
// queueMicrotask is dramatically faster than MessageChannel in Safari
|
// queueMicrotask is dramatically faster than MessageChannel in Safari
|
||||||
// and other WebKit-based browsers, such as the one distributed by Playwright
|
// and other WebKit-based browsers, such as the one distributed by Playwright
|
||||||
// to test Safari-like behavior on Windows.
|
// to test Safari-like behavior on Windows.
|
||||||
// Some of our own integration tests provide a mock queueMicrotask in all
|
|
||||||
// environments because it's simpler to mock than MessageChannel.
|
|
||||||
return browserQueueMicrotaskImpl(global);
|
return browserQueueMicrotaskImpl(global);
|
||||||
} else {
|
} else {
|
||||||
// MessageChannel is faster than queueMicrotask in supported browsers
|
// MessageChannel is faster than queueMicrotask in supported browsers
|
||||||
|
|||||||
Reference in New Issue
Block a user