Closed Bug 255715 Opened 21 years ago Closed 21 years ago

[FIXr] Crash [@ nsXBLPrototypeBinding::GetImmediateChild ] when a xbl:binding has no id

Categories

(Core :: XBL, defect, P1)

x86
All
defect

Tracking

()

VERIFIED FIXED
mozilla1.8alpha4

People

(Reporter: xanthor+bz, Assigned: bzbarsky)

References

()

Details

(Keywords: crash, testcase)

Crash Data

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040207 Firefox/0.8 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040207 Firefox/0.8 When we link a web page to a XBL file with a binding element with no id, Mozilla crashes. A testcase is given by the URL : The XBL file contains : <?xml version="1.0"?> <xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl"> <xbl:binding id="b" /> <xbl:binding /> </xbl:bindings> If we add an `id="b2"` to the last xbl:binding, there is no more crash. And even if you add `xbl:id="b2"` the browser still crashes... Reproducible: Always Steps to Reproduce: 1. Open a page linked with a XBL file with a binding element without id attribute Actual Results: Crash Expected Results: No crash Verified with Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040813 Firefox/0.9.1+, Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.6) Gecko/20040207 Firefox/0.8, and Mozilla 1.8a3 Linux TalkBack : TB569654X
I can reproduce this on Windows XP, with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040803
Confirming Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3 http://talkback-public.mozilla.org/talkback/fastfind.jsp?search=2&type=iid&id=TB569889Z
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Summary: Crash when a xbl:binding has no id → Crash [@nsXBLPrototypeBinding::GetImmediateChild] when a xbl:binding has no id
verified in today's Firefox nightly -- Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a3) Gecko/20040815 Sorry, no talkback....
Keywords: testcase
Summary: Crash [@nsXBLPrototypeBinding::GetImmediateChild] when a xbl:binding has no id → Crash [@ nsXBLPrototypeBinding::GetImmediateChild ] when a xbl:binding has no id
The problem is that nsXBLContentSink::ConstructBinding does nothing useful if the ID is empty and then we try to call Initialize() on a proto binding we never called Init() on and crash. We should just report lack of an ID as an error and drop the binding.
Some one needs to attach a testcase to this bug so that QA can verify the fix once it's fixed... Web sites have a way of disappearing.
Attached patch PatchSplinter Review
Comment on attachment 158753 [details] [diff] [review] Patch Bryner, what do you think? This patch will end up reporting misplaced elements if you actually put some XBL stuff inside the binding with no id...
Attachment #158753 - Flags: superreview?(bryner)
Attachment #158753 - Flags: review?(bryner)
Comment on attachment 158753 [details] [diff] [review] Patch Maybe we should explicitly log an error in this case so the author can find the problem more quickly?
We could, but it takes a lot of code (on the order of 50 lines) to log an error to the JS console.... We really need a better API there. If you want, I can add such code here, I guess....
Comment on attachment 158753 [details] [diff] [review] Patch Not necessary to do it here, I guess, if it's a lot of code. It would be nice to see the error reporting factored out so we can just say LogError("noBindindID") and have that take care of looking up the string in the properties file and logging it.
Attachment #158753 - Flags: superreview?(bryner)
Attachment #158753 - Flags: superreview+
Attachment #158753 - Flags: review?(bryner)
Attachment #158753 - Flags: review+
That's bug 228205, mostly...
Assignee: hyatt → bzbarsky
Priority: -- → P1
Summary: Crash [@ nsXBLPrototypeBinding::GetImmediateChild ] when a xbl:binding has no id → [FIXr] Crash [@ nsXBLPrototypeBinding::GetImmediateChild ] when a xbl:binding has no id
Target Milestone: --- → mozilla1.8alpha4
Though inside content/layout, bug 187007 will help a lot. I filed bug 259861 as a followup to add an error once that lands. Checked in for 1.8a4.
Blocks: 259861
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Verified FIXED on Seamonkey trunk using Windows XP build 2004-09-26-05 and the testcase of: http://pagesperso.laposte.net/taupe/xbl.xhtml
Status: RESOLVED → VERIFIED
*** Bug 302988 has been marked as a duplicate of this bug. ***
Crash Signature: [@ nsXBLPrototypeBinding::GetImmediateChild ]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: