Closed Bug 539533 Opened 15 years ago Closed 14 years ago

XUL select1 does not display items

Categories

(Core Graveyard :: XForms, defect)

1.9.2 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: imphil, Assigned: sergeyreym)

References

Details

(Keywords: regression)

Attachments

(2 files, 8 obsolete files)

Attached file testcase
UL select1 don't work in 1.9.2 any more (were fine in 1.9.1). No items are displayed, only empty entries.
This is a regression caused by the fix for bug 531297. Reverting that patch restores the correct behavior.
Sergey, could you look possibly look into it?
Blocks: 531297
Keywords: regression
I'm not sure how to use the test case to verify this bug on the RC2. Philipp, you could help us verify this bug?
(In reply to comment #2)
> I'm not sure how to use the test case to verify this bug on the RC2. Philipp,
> you could help us verify this bug?

it's an XForms bug, not toolkit or Firefox. To verify, build the xforms extension with Gecko 1.9.2 and open the testcase.
On my Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a1pre) Gecko/20091031 MRA 5.5 (build 02842) Minefield/3.7a1pre (.NET CLR 3.5.30729) the testcase works without problems. All Sergey's patches are applied.
(In reply to comment #4)
> On my Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a1pre)
> Gecko/20091031 MRA 5.5 (build 02842) Minefield/3.7a1pre (.NET CLR 3.5.30729)
> the testcase works without problems. All Sergey's patches are applied.

What kind of patches? Have you applied any additional patches to the trunk code?
I didn't apply patches from bug 537881 and I'm not sure that I have the latest version of patches for bug 525730.

I'm sure that the patch from bug 531297 is applied.
You shouldn't need any additional patches to reproduce this, it happens (here) with plain hg trunk, without any additional patches.
I've look into this bug. Problem is in xforms-xul.xml:202
set value(val) {
  if (val != null) {
    this._implicitContent.hidden = false;
    this._explicitContent.hidden = true;
    this._implicitContent.textContent = val;
  } else {
    this._implicitContent.hidden = true;
    this._explicitContent.hidden = false;
    this._implicitContent.textContent = '';
  }
},

get textValue() {
  if (!this._implicitContent.hidden)             
    return this._implicitContent.textContent;
  return this.textContent;
},

At first constructor of xf:select1 calls get textValue() and then constructor of labels call set value(val). It must be back to front.
Attached patch patch (obsolete) — Splinter Review
I use setTimeout to right order of creating elements.
Attachment #422301 - Flags: review?(surkov.alexander)
Comment on attachment 422301 [details] [diff] [review]
patch


>     <!-- private -->
>+      <!-- Timeout uses for right order of creating selects, items and labels. 
>+        Additional info in bug 539533.
>+      -->

move the comment into constructor, don't refer to bug number, put all necessary information right here instead.

>       <constructor>
>-        this.handleInsertion(this, null);
>+        obj = this;

var obj

>+        setTimeout(function() {obj.handleInsertion(obj, null);}, 0);

I'm not happy with setTimeout usage but I can't see better way
Attachment #422301 - Flags: review?(Olli.Pettay)
Assignee: nobody → sergeyreym
Status: NEW → ASSIGNED
Comment on attachment 422301 [details] [diff] [review]
patch

forgot to set r=me
Attachment #422301 - Flags: review?(surkov.alexander) → review+
Attached patch patch 2 (obsolete) — Splinter Review
Move comment.
Attachment #422301 - Attachment is obsolete: true
Attachment #422323 - Flags: review?(surkov.alexander)
Attachment #422301 - Flags: review?(Olli.Pettay)
Attachment #422323 - Flags: review?(Olli.Pettay)
Comment on attachment 422323 [details] [diff] [review]
patch 2


>     <!-- private -->
>       <constructor>
>-        this.handleInsertion(this, null);
>+        <!-- Timeout uses for right order of creating selects, items and labels. 
>+          Additional info in bug 539533.
>+        -->      

use JS comment style, remove spaces from the end and remove a reference to the bug, it's better to put valuable comment instead

>+        obj = this;

var obj = this.

waiting for new patch
Attachment #422323 - Flags: review?(surkov.alexander)
Attached patch patch 3 (obsolete) — Splinter Review
Attachment #422323 - Attachment is obsolete: true
Attachment #422336 - Flags: review?(surkov.alexander)
Attachment #422323 - Flags: review?(Olli.Pettay)
That's better could you change the wording? Something like

We use timeout to fix the initialization order of selects and item labels bindings. Originally the select/select1 bindings are constructed before label bindings and this break us.
Attached patch patch 4 (obsolete) — Splinter Review
Attachment #422336 - Attachment is obsolete: true
Attachment #422475 - Flags: review?(surkov.alexander)
Attachment #422336 - Flags: review?(surkov.alexander)
Attachment #422475 - Flags: review?(surkov.alexander) → review+
Comment on attachment 422475 [details] [diff] [review]
patch 4

The patch doesn't make the testcase working. The instance node value doesn't appear selected in select1. That's probably timing issue like the first one.

clearing r+ unit this is addressed.
Attachment #422475 - Flags: review+
Attachment #422301 - Flags: review+
Attached patch patch 5 (obsolete) — Splinter Review
Attachment #422475 - Attachment is obsolete: true
Attachment #422510 - Flags: review?(surkov.alexander)
Attachment #422510 - Flags: review?(Olli.Pettay)
Try to use @deferredrefresh like it's done for xformswidget-range-numeric binding.
I've done it but it's not successfull.
(In reply to comment #20)
> I've done it but it's not successfull.

put the patch please
Attached patch patch with deferredrefresh (obsolete) — Splinter Review
I'm not sure it makes sense to add deferredrefresh attribute for every binding we have. And it's not enough. This attribute prevents the call of widgetAttached method in constructor. So if you put this attribute on the element then you should call widgetAttached yourself when the widget is ready or in timeout like we do xformswidget-range-numeric.
Attached patch patch 6 (obsolete) — Splinter Review
It works fine.
Attachment #422510 - Attachment is obsolete: true
Attachment #425194 - Attachment is obsolete: true
Attachment #425359 - Flags: review?(surkov.alexander)
Attachment #422510 - Flags: review?(surkov.alexander)
Attachment #422510 - Flags: review?(Olli.Pettay)
Comment on attachment 425359 [details] [diff] [review]
patch 6


>diff -r 576e24224968 resources/content/selects.xml
>--- a/resources/content/selects.xml	Tue Jan 19 11:48:31 2010 +0800
>+++ b/resources/content/selects.xml	Fri Feb 05 09:14:00 2010 +0800

Please put a comment that any inherited binding with the content must have mozType:deferredrefresh="true" attribute.

>@@ -625,7 +625,14 @@
>       </method>
> 
>       <constructor>
>-        this.freeEntryAllowed = this.allowFreeEntry(this.selection == "open");
>+        // Call widgetAttached() and handleInsertion() after timeout to let items to be
>+        // loaded elsewhere select loads before items.      

remove spaces at the end of the comment

this binding hans't handleInsertion() method.

>     <!-- private -->
>       <constructor>
>-        this.handleInsertion(this, null);
>+        // Call constructor and widgetAttached() after timeout to let items to be
>+        // loaded elsewhere select loads before items.      
>+        this.ownerDocument.defaultView.setTimeout(
>+          function(aElement)
>+          {
>+            aElement.delegate.handleInsertion(aElement, null);
>+            aElement.delegate.widgetAttached();

it doesn't make sense to call widgetAttached() twice
Attachment #425359 - Flags: review?(surkov.alexander)
Attached patch patch 7 (obsolete) — Splinter Review
Attachment #425359 - Attachment is obsolete: true
Attachment #425424 - Flags: review?(surkov.alexander)
(In reply to comment #26)
> Created an attachment (id=425424) [details]
> patch 7

please address all my comments.
Attached patch patch 8Splinter Review
I've removed selects.xml changes and its relatives because constructor in non-widget selects don't need timeout (constructor makes simple assignment statement). Also I wrote more detailed comment in header of selectsnw.xml.
Attachment #425424 - Attachment is obsolete: true
Attachment #425439 - Flags: review?(surkov.alexander)
Attachment #425424 - Flags: review?(surkov.alexander)
Attachment #425439 - Flags: review?(Olli.Pettay)
Comment on attachment 425439 [details] [diff] [review]
patch 8

fine with me, thanks.
Attachment #425439 - Flags: review?(surkov.alexander) → review+
Attachment #425439 - Flags: review?(Olli.Pettay) → review+
http://hg.mozilla.org/xforms/rev/8f5a9b43d98b
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
OS: Linux → All
Hardware: x86 → All
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: