Module: tools Branch: master Commit: cb2e09e463c68af4bd2480bbba6749a0d48efba1 URL: https://source.winehq.org/git/tools.git/?a=commit;h=cb2e09e463c68af4bd2480bb...
Author: Francois Gouget fgouget@codeweavers.com Date: Fri Mar 25 11:17:12 2022 +0100
testbot/web: The Submit page should always provide a property list.
FormPage expects to be provided with a property list when it calls GetPropertyDescriptors() at the very latest. So while that method may return an empty list, returning undef is not allowed.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/web/Submit.pl | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl index 79d1c87..472622d 100644 --- a/testbot/web/Submit.pl +++ b/testbot/web/Submit.pl @@ -665,16 +665,23 @@ sub GetPropertyDescriptors($) my ($self) = @_;
# Note that this may be called for different pages. For instance first to - # validate the properties of the page 1, then again to generate the form - # fields of page 2. See _SetPage(). - if ($self->{Page} == 1) + # validate the page 1 properties, then again to generate the page 2 form + # fields. See _SetPage(). + if ($self->{PropertyDescriptors}) { - $self->{PropertyDescriptors} ||= [ + # The property descriptors list is already set for $self->{Page} + } + elsif ($self->{Page} == 1) + { + $self->{PropertyDescriptors} = [ CreateBasicPropertyDescriptor("Remarks", "Remarks", !1, !1, "A", 128), ]; } - elsif (($self->{Page} == 3 or $self->{Page} == 4) and - !$self->{PropertyDescriptors}) + elsif ($self->{Page} == 2) + { + $self->{PropertyDescriptors} = []; # no fields, only a collection block + } + elsif ($self->{Page} == 3 or $self->{Page} == 4) { if ($self->{Page} == 4) { @@ -960,9 +967,12 @@ sub _SetPage($$) { my ($self, $Page) = @_;
- $self->{Page} = $Page; - # Changing the page also changes the fields of the HTML form - delete $self->{PropertyDescriptors}; + if ($self->{Page} != $Page) + { + $self->{Page} = $Page; + # Changing the page also changes the fields of the HTML form + $self->{PropertyDescriptors} = undef; + } }
sub OnUnset($)