Closed Bug 725784 Opened 13 years ago Closed 5 years ago

XBL breaks when replacing a node with itself inside a panel

Categories

(Core :: XBL, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: alice0775, Unassigned)

References

Details

(Keywords: regression)

Attachments

(2 files, 4 obsolete files)

Build Identifier: http://hg.mozilla.org/mozilla-central/rev/7c0ba1c98ff7 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0a1) Gecko/20120209 Firefox/13.0a1 ID:20120209031242 Label of remove button does not be taken into account plural bookmarks till restarting browser Reproducible: Always Steps to Reproduce: 1. Start Firefox with new profile 2. Enable Bookmark toolbar if any 3. Open a web site (Ex. http://www.mozilla.org/ ) 4. Click STAR UI in Location bar 5. Click STAR UI again --- you can see "Remove Bookmark" button 6. Drag a Identify Icon in the Location bar to Bookmarks toolbar and drop it. so that there are 2 bookmarks with same URL. 7. Click STAR UI again Actual Results: The button is still labeled "Remove Bookmark" Expected Results: The button should be labeled "Remove 2 Bookmarks" Regression window(cachedm-c) Works: http://hg.mozilla.org/mozilla-central/rev/7aa58a99a2e5 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110630 Firefox/7.0a1 ID:20110630003937 Fails: http://hg.mozilla.org/mozilla-central/rev/5c246f2bccb1 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110630 Firefox/7.0a1 ID:20110630035829 Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=7aa58a99a2e5&tochange=5c246f2bccb1 Regression window(cached m-i) Works: http://hg.mozilla.org/integration/mozilla-inbound/rev/6777320f6f29 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110629 Firefox/7.0a1 ID:20110629215351 Fails: http://hg.mozilla.org/integration/mozilla-inbound/rev/c2f48684b9f5 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a1) Gecko/20110629 Firefox/7.0a1 ID:20110629231921 Pushlog: http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=6777320f6f29&tochange=c2f48684b9f5 In local build: first bad changeset c2f48684b9f5 last good changeset fb03584dd823
This also happen on ubuntu. http://hg.mozilla.org/mozilla-central/rev/7c0ba1c98ff7 Mozilla/5.0 (X11; Linux i686; rv:13.0a1) Gecko/20120209 Firefox/13.0a1 ID:20120209031242
OS: Windows 7 → All
Component: Bookmarks & History → DOM
Product: Firefox → Core
QA Contact: bookmarks → general
Summary: Label of remove button does not be taken into account plural bookmarks till restarting browser → Label of remove button does not reflect plural bookmarks till restarting browser
Is this a DOM bug, or a bug in the UI that's note expecting a remove+reinsert there?
And reproduce another way and it is same regression range. It is not reflected to button label even if I delete one of the duplicating bookmark Reproducible: Always Steps to Reproduce: 1-7 same as commenet #0 -- make duplicate bookmarks 8. Restart browser 9. Click STAR UI again --- you can see "Remove 2 Bookmarks" button as expected 10. Delete one of those bookmark 11. Click STAR UI again Actual Results: The button is still labeled "Remove 2 Bookmarks" Expected Results: The button should be labeled "Remove Bookmark"
Attached patch possible fix (obsolete) — Splinter Review
using setAttribute to set label strings
Component: DOM → Bookmarks & History
Product: Core → Firefox
QA Contact: general → bookmarks
Comment on attachment 596070 [details] [diff] [review] possible fix So is the problem somehow that the remove and reinsert confuses the XBL binding?
(In reply to Boris Zbarsky (:bz) from comment #5) > Comment on attachment 596070 [details] [diff] [review] > possible fix > > So is the problem somehow that the remove and reinsert confuses the XBL > binding? I do not know why Element.label=xxx does not work in this case.
There are no replaceChild calls in any of this code, so I'm not sure how bug 647603 would have caused this. Did it have wider impact than just replaceChild? Does XBL use replaceChild internally somehow?
I think the change also changed the behavior for things like a.insertBefore(b, b); a.appendChild(a.lastChild);
I may suppose that the first time _doShowEditBookmarkPanel is invoked rows.insertBefore(header, rows.firstChild); will move the header from the current position to the grid. Next invokations would probably just remove and reinsert it from the grid, hitting the changed code path. So this should be fixable by just checking if header.parentNode is editBookmarkPanelGrid, makes sense. Though this also means xbl is broken when removing and reinserting the same node.
taking cause I don't want to lose this, should be fixed before the release. The local fix is simple, though I think we also want an XBL bug filed to check why the general binding is lost when reinserting the same node.
Assignee: nobody → mak77
Attached file attempt at a testcase (obsolete) —
I tried using this to reproduce the bug, but it doesn't seem to. The bookmarks UI is rather complicated, it's difficult to minimize...
Attached file attempt at a testcase (obsolete) —
(attached the wrong file)
Attachment #599733 - Attachment is obsolete: true
Attached file chrome testcase (obsolete) —
I started from Gavin's test and added stuff till I could make a working testcase. This is not yet a chrome test but should not be hard to make one. It is not minimal yet, but I didn't want to hack on it till I had attached this working version somewhere. Just put it in a chrome tests folder, add to Makefile.in and run it. If you comment out rows.insertBefore(row, rows.firstChild); the label correctly changes. From what I see, being inside a <panel> is related to the issue.
Attachment #599734 - Attachment is obsolete: true
Attachment #599757 - Attachment is patch: false
Attachment #599734 - Attachment mime type: application/vnd.mozilla.xul+xml → text/plain
Attached file reduced chrome test
This is reduced and in form of a chrome test
Attachment #599757 - Attachment is obsolete: true
Any idea where such a test should go in the tree? layout/xul/test/? toolkit/content/tests/chrome/? That said, I'm not sure what's a good code point to start debugging the problem, any help is welcome.
Attached patch tests v1.0Splinter Review
test in patch form (toolkit/content/tests/chrome/test_panel_replaceSame.xul)
See Also: → 726440
Blocks: 726440
So, I'm transforming this bug in the one handling the XBL problem, and will use bug 726440 to fix the browser code that now is replacing the node with itself, since it's no more a no-op.
Assignee: mak77 → nobody
Component: Bookmarks & History → XBL
Product: Firefox → Core
QA Contact: bookmarks → xbl
Summary: Label of remove button does not reflect plural bookmarks till restarting browser → XBL breaks when replacing a node with itself inside a panel
Attachment #596070 - Attachment is obsolete: true
My guess is that when an element which has a binding but no frame, upon inserting, now gains a frame but the binding it had is lost. Whereabouts would this be handled?
The frame constructor tries to create a binding if one is needed and if there isn't one yet.
Actually I realize now that in the testcase, the node is simply being moved to another place in the same panel, so it doesn't have a frame before or after the insert. I verified that no frame construction is happening during the call to insertBefore, and bindings are not being processed. So whatever mechanism is creating the binding when the window first loads for frameless elements is happening, but not when the element is inserted later on.
There is no such mechanism. For frameless nodes, a binding is created when the node is first js-wrapped.
Blocks: 638785
Attachment #599766 - Attachment mime type: text/plain → application/vnd.mozilla.xul+xml

XBL is now disabled in Firefox (Bug 1583314) and is in the process of being removed from Gecko (Bug 1566221), so closing bugs requesting changes to its implementation as wontfix.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: