Skip to content

Incorrect check causes unnecessary wait #109

@uuf6429

Description

@uuf6429

The following code is faulty (introduced in #35):

if ($this->safePageWait(5000, 'document.getElementsByTagName("title") === "Advanced form save"')) {

document.getElementsByTagName("title") returns a list of elements, therefore it will never be true against a string. Then what happens is that the code is stuck for 5 seconds and then simply returns true - since safePageWait() / wait() is coded to return true even when it "times out".

I would disagree with the logic behind those two methods, but that's kinda off topic.


What I think was meant to happen is to check the content of the title element? So maybe:

document.getElementsByTagName("title")[0]?.textContent === "Advanced form save"

On the other hand, such a change might introduce timing issues (if that wait guard is actually checking/waiting for the wrong thing).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions