1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-06-23 00:28:10 +02:00

Fixed WAIT_CLASS args validation (#192)

This commit is contained in:
Tim Voronov
2018-11-22 10:39:15 -05:00
committed by GitHub
parent 58112b8ee9
commit a5dec54a3c
6 changed files with 120 additions and 23 deletions

View File

@ -43,6 +43,13 @@ func WaitClass(_ context.Context, args ...core.Value) (core.Value, error) {
// lets figure out what is passed as 1st argument
switch args[0].(type) {
case *dynamic.HTMLDocument:
// revalidate args with more accurate amount
err := core.ValidateArgs(args, 3, 4)
if err != nil {
return values.None, err
}
// class
err = core.ValidateType(args[2], core.StringType)
@ -86,7 +93,7 @@ func WaitClass(_ context.Context, args ...core.Value) (core.Value, error) {
return values.None, err
}
timeout = args[3].(values.Int)
timeout = args[2].(values.Int)
}
return values.None, el.WaitForClass(class, timeout)