mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-10-03 22:16:49 +02:00
fix broken remote browser init
Signed-off-by: RonniSkansing <rskansing@gmail.com>
This commit is contained in:
2 files changed
+17
-3
No files matched your search
@@ -56,7 +56,9 @@
|
||||
}
|
||||
|
||||
newSession = function (opts) {
|
||||
var s = baseNewSession(opts);
|
||||
// Default to {} so a no-argument newSession() call does not forward
|
||||
// undefined, which the native binding would reject when it parses options.
|
||||
var s = baseNewSession(opts || {});
|
||||
|
||||
// present is true when the selector matches at least one node.
|
||||
s.present = function (sel) { return s.getNodeCount(sel) > 0; };
|
||||
|
||||
@@ -19,7 +19,16 @@ func TestPreludeStateMachine(t *testing.T) {
|
||||
// 0 password, 1 totp, 2 done.
|
||||
stage := 0
|
||||
|
||||
newSession := func(goja.FunctionCall) goja.Value {
|
||||
// badArg records the regression where the prelude wrapper forwards undefined
|
||||
// to the native newSession for a no-argument call.
|
||||
badArg := false
|
||||
newSession := func(call goja.FunctionCall) goja.Value {
|
||||
if len(call.Arguments) > 0 {
|
||||
a := call.Argument(0)
|
||||
if goja.IsUndefined(a) || goja.IsNull(a) {
|
||||
badArg = true
|
||||
}
|
||||
}
|
||||
s := vm.NewObject()
|
||||
_ = s.Set("location", func(goja.FunctionCall) goja.Value {
|
||||
if stage >= 2 {
|
||||
@@ -60,7 +69,7 @@ func TestPreludeStateMachine(t *testing.T) {
|
||||
var visited = [];
|
||||
var beforeSeen = [];
|
||||
var afterSeen = [];
|
||||
var s = newSession({});
|
||||
var s = newSession();
|
||||
if (typeof s.states !== "function") { throw new Error("s.states missing"); }
|
||||
if (typeof s.waitForState !== "function") { throw new Error("s.waitForState missing"); }
|
||||
if (typeof s.present !== "function") { throw new Error("s.present missing"); }
|
||||
@@ -98,6 +107,9 @@ func TestPreludeStateMachine(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("script failed: %v", err)
|
||||
}
|
||||
if badArg {
|
||||
t.Fatalf("newSession wrapper forwarded undefined/null opts for a no-argument call")
|
||||
}
|
||||
got := v.String()
|
||||
want := "password,totp,done|password,totp,done|password,totp,done"
|
||||
if got != want {
|
||||
|
||||
Reference in new issue
Block a user