Documented usage of eval in DelayedFunctionScheduler
This commit is contained in:
@@ -3224,6 +3224,9 @@ getJasmineRequireObj().CompleteOnFirstErrorSkipPolicy = function(j$) {
|
|||||||
return CompleteOnFirstErrorSkipPolicy;
|
return CompleteOnFirstErrorSkipPolicy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Warning: don't add "use strict" to this file. Doing so potentially changes
|
||||||
|
// the behavior of user code that does things like setTimeout("var x = 1;")
|
||||||
|
// while the mock clock is installed.
|
||||||
getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||||
function DelayedFunctionScheduler() {
|
function DelayedFunctionScheduler() {
|
||||||
this.scheduledLookup_ = [];
|
this.scheduledLookup_ = [];
|
||||||
@@ -3249,6 +3252,9 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
|||||||
) {
|
) {
|
||||||
let f;
|
let f;
|
||||||
if (typeof funcToCall === 'string') {
|
if (typeof funcToCall === 'string') {
|
||||||
|
// setTimeout("some code") and setInterval("some code") are legal, if
|
||||||
|
// not recommended. We don't do that ourselves, but user code might.
|
||||||
|
// This allows such code to work when the mock clock is installed.
|
||||||
f = function() {
|
f = function() {
|
||||||
// eslint-disable-next-line no-eval
|
// eslint-disable-next-line no-eval
|
||||||
return eval(funcToCall);
|
return eval(funcToCall);
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Warning: don't add "use strict" to this file. Doing so potentially changes
|
||||||
|
// the behavior of user code that does things like setTimeout("var x = 1;")
|
||||||
|
// while the mock clock is installed.
|
||||||
getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||||
function DelayedFunctionScheduler() {
|
function DelayedFunctionScheduler() {
|
||||||
this.scheduledLookup_ = [];
|
this.scheduledLookup_ = [];
|
||||||
@@ -23,6 +26,9 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
|||||||
) {
|
) {
|
||||||
let f;
|
let f;
|
||||||
if (typeof funcToCall === 'string') {
|
if (typeof funcToCall === 'string') {
|
||||||
|
// setTimeout("some code") and setInterval("some code") are legal, if
|
||||||
|
// not recommended. We don't do that ourselves, but user code might.
|
||||||
|
// This allows such code to work when the mock clock is installed.
|
||||||
f = function() {
|
f = function() {
|
||||||
// eslint-disable-next-line no-eval
|
// eslint-disable-next-line no-eval
|
||||||
return eval(funcToCall);
|
return eval(funcToCall);
|
||||||
|
|||||||
Reference in New Issue
Block a user