mirror of
https://github.com/MontFerret/ferret.git
synced 2025-06-23 00:28:10 +02:00
Added Context to HTML methods (#235)
* Added Context to HTML methods * Fixed unit tests * Updated timeout * Fixed WAIT_CLASS timeout
This commit is contained in:
@ -2,11 +2,11 @@ package html
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/MontFerret/ferret/pkg/drivers"
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
"github.com/MontFerret/ferret/pkg/runtime/values"
|
||||
"github.com/MontFerret/ferret/pkg/runtime/values/types"
|
||||
"time"
|
||||
)
|
||||
|
||||
const defaultTimeout = 5000
|
||||
@ -67,6 +67,13 @@ func ValidateDocument(ctx context.Context, value core.Value) (core.Value, error)
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
func waitTimeout(ctx context.Context, value values.Int) (context.Context, context.CancelFunc) {
|
||||
return context.WithTimeout(
|
||||
ctx,
|
||||
time.Duration(value)*time.Millisecond,
|
||||
)
|
||||
}
|
||||
|
||||
func resolveElement(value core.Value) (drivers.HTMLElement, error) {
|
||||
vt := value.Type()
|
||||
|
||||
|
Reference in New Issue
Block a user