addEventListener throws an exception with FF 1.0.5

RESOLVED FIXED

Status

()

defect
--
major
RESOLVED FIXED
14 years ago
14 years ago

People

(Reporter: legege, Unassigned)

Tracking

({fixed-aviary1.0.6, fixed1.7.10, regression})

1.0 Branch
x86
Windows XP
Points:
---
Bug Flags:
blocking1.7.10 +
blocking-aviary1.0.6 +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.9) Gecko/20050711 Firefox/1.0.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.9) Gecko/20050711 Firefox/1.0.5

With Firefox 1.0.5, the addEventListener throws an Exception for an element that
is in the chrome.

This is what I do :
*****
var sb = document.getElementById("searchbar");
sb.addEventListener("input", function() { alert('it works'); }, false, true);	
*****

This code throws this exception :
*****
Error: [Exception... "'JavaScript component threw a null value as an exception'
when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001d
(NS_ERROR_XPC_JS_THREW_NULL)"  location: "<unknown>"  data: no]
*****

I have to use XPCNativeWrapper to make it works. But this causes me many others
problems.
*****
var sb = new XPCNativeWrapper(document.getElementById("searchbar"),
"addEventListener()");
*****

With Firefox 1.0.4, everything was fine.

Reproducible: Always

Actual Results:  
The event listener isn't added.

Expected Results:  
No exception, and the event listener is added.
(Reporter)

Updated

14 years ago
Summary: Incompatible extension with Firefox 1.0.5 → addEventListener throws an exception with FF 1.0.5

Updated

14 years ago
Severity: normal → major

Updated

14 years ago
Assignee: nobody → events
Component: General → DOM: Events
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.0 Branch
Out of interest, does it work if you use this:
var sb = document.getElementById("searchbar");
sb.addEventListener("input", { handleEvent: function() { alert('it works'); } },
false, true);	
Can you please attach a testcase that shows this problem?
Found the problem, no need for a testcase.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Posted patch Fix.Splinter Review
This was due to a difference in the nsXULElement code on the trunk and
branches. On the trunk, where the patch that introduced this was developed,
nsXULElement inherits nsGenericElement and gets a QI that returns an interface
for nsIDOMNSEventTarget, but on the trunk there's no such inheritance, so
nsXULElement's QI needs to deal. This is a trivial fix to simply add the
missing code.
Attachment #189458 - Flags: superreview?(brendan)
Attachment #189458 - Flags: review?(dveditz)
Comment on attachment 189458 [details] [diff] [review]
Fix.

r+sr=bzbarsky; requesting branch approvals (this is not needed on trunk)
Attachment #189458 - Flags: superreview?(brendan)
Attachment #189458 - Flags: superreview+
Attachment #189458 - Flags: review?(dveditz)
Attachment #189458 - Flags: review+
Attachment #189458 - Flags: approval1.7.10?
Attachment #189458 - Flags: approval-aviary1.0.6?

Updated

14 years ago
Flags: blocking-aviary1.0.6?
Flags: blocking1.7.10?
Keywords: regression
(Reporter)

Comment 6

14 years ago
Do you know if there is a work around for this problem in FF 1.0.5?
You can add an event handler that listens for all events and explicitly check
the trusted flag on them...

Comment 8

14 years ago
Comment on attachment 189458 [details] [diff] [review]
Fix.

a=chase.  API fix, needs to land soon to catch respins.
Attachment #189458 - Flags: approval1.7.10?
Attachment #189458 - Flags: approval1.7.10+
Attachment #189458 - Flags: approval-aviary1.0.6?
Attachment #189458 - Flags: approval-aviary1.0.6+

Updated

14 years ago
Flags: blocking-aviary1.0.6? → blocking-aviary1.0.6+

Updated

14 years ago
Flags: blocking1.7.10? → blocking1.7.10+
Fixed on branches, not a problem on the trunk.
Status: ASSIGNED → RESOLVED
Last Resolved: 14 years ago
Flags: blocking1.7.10?
Flags: blocking1.7.10+
Flags: blocking-aviary1.0.6?
Flags: blocking-aviary1.0.6+
Resolution: --- → FIXED

Updated

14 years ago
Flags: blocking1.7.10?
Flags: blocking1.7.10+
Flags: blocking-aviary1.0.6?
Flags: blocking-aviary1.0.6+
You need to log in before you can comment on or make changes to this bug.