Skip to content

Commit 62476f5

Browse files
Jake ChampionJakeChampion
authored andcommitted
fix: check that setTimeout/setInterval handler is an object before casting to an object
1 parent 0b0d24f commit 62476f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

c-dependencies/js-compute-runtime/js-compute-builtins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4889,12 +4889,12 @@ template <bool repeat> bool setTimeout_or_interval(JSContext *cx, unsigned argc,
48894889
return false;
48904890
}
48914891

4892-
RootedObject handler(cx, &args[0].toObject());
48934892
if (!(args[0].isObject() && JS::IsCallable(&args[0].toObject()))) {
48944893
JS_ReportErrorASCII(cx, "First argument to %s must be a function",
48954894
repeat ? "setInterval" : "setTimeout");
48964895
return false;
48974896
}
4897+
RootedObject handler(cx, &args[0].toObject());
48984898

48994899
int32_t delay = 0;
49004900
if (args.length() > 1 && !JS::ToInt32(cx, args.get(1), &delay)) {

0 commit comments

Comments
 (0)