Closed Bug 1430034 Opened 7 years ago Closed 7 years ago

PolymerElements/iron-ajax demo page is missing contents when Custom Elements are enabled

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

()

Details

Attachments

(1 file, 1 obsolete file)

While debugging bug 1429967, I found the PolymerElements iron-ajax [1] does not work well with our native CE implementation.

STR:
1) Set dom.webcomponents.customelements.enabled to true
2) Load the demo page: https://raw-dot-custom-elements.appspot.com/PolymerElements/iron-ajax/v2.0.8/iron-ajax/demo/index.html

Expected result:
Video contents under "Video Feed"

Actual result:
No contents under "Video Feed"

[1] https://www.webcomponents.org/element/PolymerElements/iron-ajax
The demo page will send the search request to Youtube and display the search result.
But it looks like the search request isn't send [1] when Custom Elements are enabled.
Need to do more investigating, ni myself.

[1] DevTool/Network doesn't show the search request.
Flags: needinfo?(echen)
Blocks: 1429967
In the demo page, the iron-ajax has "auto" attribute set to empty string, it should send request automatically via creating an iron-request [1]. But I didn't see an iron-request being created when Custom Elements are enabled.

After I do "document.getElementsByTagName("iron-ajax")[0].setAttribute("auto", "a");" in web console, the request is performed and the contents is showing as expected.

So I suspect the attributeChangedCallback isn't fired correctly in some circumstances...

[1] iron-request is used to perform XMLHttpRequests.
Assignee: nobody → echen
Flags: needinfo?(echen)
Okay, I found the root cause, the attributeChangedCallback from upgrade steps isn't fired correctly when the attribute value is empty string, it will fire callback with null as newValue, see https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=5692.

And for the demo page case, the iron-ajax's "auto" attribute is set to empty string, the attributeChangedCallback for auto attribute is fired with null as both oldValue and newValue, and the Polymer will ignore the callback since it thinks the attribute value is changed.
(In reply to Edgar Chen [:edgar] from comment #3)
> Okay, I found the root cause, the attributeChangedCallback from upgrade
> steps isn't fired correctly when the attribute value is empty string, it
> will fire callback with null as newValue, see
> https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=5692.
> 
> And for the demo page case, the iron-ajax's "auto" attribute is set to empty
> string, the attributeChangedCallback for auto attribute is fired with null
> as both oldValue and newValue, and the Polymer will ignore the callback
> since it thinks the attribute value is changed.
                                      ^^
                                      isn't
Attached patch patch (obsolete) — Splinter Review
Quick fix, tests are coming soon.
Oops, sorry, my bad :(
Attachment #8942559 - Attachment is obsolete: true
Attachment #8942601 - Flags: feedback?(jdai)
Attachment #8942601 - Flags: feedback?(jdai) → feedback+
Attachment #8942601 - Flags: review?(bugs)
Comment on attachment 8942601 [details]
Bug 1430034 - Fix attributeChangedCallback isn't fired with correct newValue when the attribute value is an empty string;

https://reviewboard.mozilla.org/r/212870/#review219244
Attachment #8942601 - Flags: review?(bugs) → review+
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ec468ee9dfc6
Fix attributeChangedCallback isn't fired with correct newValue when the attribute value is an empty string; r=smaug
https://hg.mozilla.org/mozilla-central/rev/ec468ee9dfc6
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: