RESOLVED FIXED 59128
HTMLFormControlElement::labels should allow custom attributes.
https://bugs.webkit.org/show_bug.cgi?id=59128
Summary HTMLFormControlElement::labels should allow custom attributes.
Yael
Reported 2011-04-21 12:20:34 PDT
This was introduced in http://trac.webkit.org/changeset/60232. HTMLFormControlElement::labels() needlessly caches its labels list.
Attachments
Patch. (1.81 KB, patch)
2011-04-21 12:23 PDT, Yael
sam: review-
Patch. (4.29 KB, patch)
2011-04-21 15:37 PDT, Yael
sam: review-
Patch. (4.50 KB, patch)
2011-04-22 09:05 PDT, Yael
no flags
Patch. (4.47 KB, patch)
2011-04-22 09:17 PDT, Yael
sam: review+
ap: commit-queue-
Patch. (5.73 KB, patch)
2011-04-22 11:32 PDT, Yael
no flags
Yael
Comment 1 2011-04-21 12:23:16 PDT
Sam Weinig
Comment 2 2011-04-21 13:12:21 PDT
Comment on attachment 90576 [details] Patch. This leaves the node list cache in NodeRareData. I am also not sure we don't want to cache this value. Consider the following test. inputElement.labels.customProperty = 1; alert(inputElement.labels.customProperty); That should probably work, but probably won't with this patch or the current code.
Yael
Comment 3 2011-04-21 14:36:08 PDT
(In reply to comment #2) > (From update of attachment 90576 [details]) > This leaves the node list cache in NodeRareData. I am also not sure we don't want to cache this value. Consider the following test. > > inputElement.labels.customProperty = 1; > alert(inputElement.labels.customProperty); > > That should probably work, but probably won't with this patch or the current code. Right, I was a bit too quick :) I'll rework this patch.
Yael
Comment 4 2011-04-21 15:37:55 PDT
Created attachment 90617 [details] Patch. Cache the node this time. We do want the test in comment #2 to pass :) Sam, I did not quite understand your comment on irc about strong pointers and could not catch you afterwards. If it is still a problem please let me know and I'll address that.
Alexey Proskuryakov
Comment 5 2011-04-21 15:47:21 PDT
Comment on attachment 90617 [details] Patch. View in context: https://bugs.webkit.org/attachment.cgi?id=90617&action=review I don't deeply understand what's going one like Sam does, but I've got a few comments. > LayoutTests/fast/forms/script-tests/labels-custom-property.js:1 > +description('Test that we can set and get custom properties on the labels attribute. '); Could you please merge these .js and .html files? Keeping them separate causes nothing but difficulties, as you need a second step to get from test to its content. > LayoutTests/fast/forms/script-tests/labels-custom-property.js:11 > +labels.customProperty = 1; > +shouldBe('labels.customProperty', '1'); Can you add a gc() call between these? I can't easily find any code marking the JS wrapper.
Sam Weinig
Comment 6 2011-04-21 17:04:46 PDT
Comment on attachment 90617 [details] Patch. I think you need to change m_labelsNodeListCache to be a weak pointer for this not leak.
Yael
Comment 7 2011-04-21 18:09:12 PDT
(In reply to comment #6) > (From update of attachment 90617 [details]) > I think you need to change m_labelsNodeListCache to be a weak pointer for this not leak. Thank you for the review. I am not sure I know what you mean by "weak pointer" ? I cannot find it in wtf. Do you mean DynamicNodeList* or something else?
Yael
Comment 8 2011-04-22 06:03:43 PDT
(In reply to comment #5) > (From update of attachment 90617 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=90617&action=review > Thank you for your comments. > I don't deeply understand what's going one like Sam does, but I've got a few comments. > > > LayoutTests/fast/forms/script-tests/labels-custom-property.js:1 > > +description('Test that we can set and get custom properties on the labels attribute. '); > > Could you please merge these .js and .html files? Keeping them separate causes nothing but difficulties, as you need a second step to get from test to its content. > Will do :) > > LayoutTests/fast/forms/script-tests/labels-custom-property.js:11 > > +labels.customProperty = 1; > > +shouldBe('labels.customProperty', '1'); > > Can you add a gc() call between these? I can't easily find any code marking the JS wrapper. Will do :) I'll submit a new patch once the pointer issue is resolved. Going through the logs, I see that the way we cache the DynamicNodeList wrappers was changed this week. Please look at r84309 and r83990.
Yael
Comment 9 2011-04-22 09:05:15 PDT
Created attachment 90710 [details] Patch. Address comment #5 and commnet #6.
Yael
Comment 10 2011-04-22 09:06:21 PDT
(In reply to comment #9) > Created an attachment (id=90710) [details] > Patch. > > Address comment #5 and comment #6. Verified that the LabelsNodeList is being garbage collected and the C++ object is being deleted.
Yael
Comment 11 2011-04-22 09:17:32 PDT
Created attachment 90711 [details] Patch. Resolved conflicts.
Alexey Proskuryakov
Comment 12 2011-04-22 10:32:47 PDT
Wait, it''s not a weak pointer, it's a potentially dangling pointer... For those following along at home, could you please explain why this pointer will never point to released memory?
Alexey Proskuryakov
Comment 13 2011-04-22 11:02:11 PDT
Comment on attachment 90711 [details] Patch. Could you please answer that before committing? If the code is wrong in that respect, the patch would be introducing a security bug.
Yael
Comment 14 2011-04-22 11:32:00 PDT
Created attachment 90731 [details] Patch. Change LabelsNodeList::create() to take a pointer Node* instead of PassRefPtr. Change m_labelsNodeListCache to be of type LabelsNodeList*.
Yael
Comment 15 2011-04-22 11:33:51 PDT
(In reply to comment #12) > Wait, it''s not a weak pointer, it's a potentially dangling pointer... > > For those following along at home, could you please explain why this pointer will never point to released memory? The pointer is cleared in the destructor of LabelsListNode.
WebKit Commit Bot
Comment 16 2011-04-22 15:37:01 PDT
Comment on attachment 90731 [details] Patch. Clearing flags on attachment: 90731 Committed r84693: <http://trac.webkit.org/changeset/84693>
WebKit Commit Bot
Comment 17 2011-04-22 15:37:06 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 18 2011-04-22 16:04:26 PDT
http://trac.webkit.org/changeset/84693 might have broken SnowLeopard Intel Release (Build)
Note You need to log in before you can comment on or make changes to this bug.