[tools] testbot/web: The Submit page should always provide a property list.
Francois Gouget
fgouget at codeweavers.com
Fri Mar 25 05:17:12 CDT 2022
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 at codeweavers.com>
---
The patch reordering the FormPage methods contained a change it
shouldn't have which broke the submit job page.
The FormPage methods were inconsistent about whether they would
correctly deal with $self->GetPropertyDescriptors() returning undef
(this specific issue is in the most used method, GenerateFields()). Now
they don't accept it and so the subclasses should make sure to always
provide a property list.
This updates the Submit page accordingly.
---
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 79d1c8772..472622dd5 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($)
--
2.30.2
More information about the wine-devel
mailing list