Closed
Bug 667612
Opened 14 years ago
Closed 14 years ago
Uncaught exception: [Exception..."Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMEventTarget.addEventListener)
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
FIXED
mozilla9
People
(Reporter: aaronmt, Assigned: sicking)
References
()
Details
(Keywords: dev-doc-complete, regression, testcase)
Attachments
(2 files, 2 obsolete files)
3.14 KB,
patch
|
smaug
:
review+
jpr
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
22.23 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
Mozilla/5.0 (Android; Linux armv71; rv7.0a1) Gecko/20110627 Firefox/7.0a1 Fennec/7.0a1
Device: Nexus One, Nexus S
OS: Android 2.3.4
I get this upon visiting the URL above.
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMEventTarget.addEventListener]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://cdn.nearbyad.com/javascripts/MBS_mobile.js?426079 :: <TOP_LEVEL> :: line 352" data: no]
Comment 1•14 years ago
|
||
And addEventListener for 'resize' seems to be causing this for Fennec on the Android device. I'm not seeing it on desktop windows Fennec.
Comment 2•14 years ago
|
||
*sigh*, That teaches me not to test. Apparently, when the function is defined after the listener, this error will appear on Fennec Android.
Attachment #543154 -
Attachment is obsolete: true
Comment 3•14 years ago
|
||
Is this an IPC bug or something?
Comment 4•14 years ago
|
||
According to that JS link, the offending bit is:
var supportsOrientationChange = "onorientationchange" in window,
orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";
window.addEventListener(orientationEvent, MBS.mbsCenterAd, false);
...which I see you figured out. As well as the reason the error occurs. Ok, I'm following now.
Comment 5•14 years ago
|
||
Given that I see the same error on Firefox with your testcase, this doesn't seem to be anything isolated to IPC behaviour.
Comment 6•14 years ago
|
||
Ah, yes. I can see the issue in today's Firefox trunk, but not on Firefox 5, so this looks like a regression.
Component: General → DOM: Events
Keywords: regression,
regressionwindow-wanted
Product: Fennec → Core
QA Contact: general → events
![]() |
||
Comment 7•14 years ago
|
||
In the attached testcase, x is undefined at the point of the addEventListener call, so I would expect it to throw...
![]() |
||
Comment 8•14 years ago
|
||
On the other hand, looks like other UAs do not.
Is this happening on aurora too?
tracking-firefox7:
--- → ?
![]() |
||
Comment 9•14 years ago
|
||
Regression range: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=48e72227c2fa&tochange=e0b805cab438
So not an aurora problem.
![]() |
||
Comment 10•14 years ago
|
||
So it looks like nsGlobalWindow::AddEventListener used to directly call nsEventListenerManager::AddEventListenerByType. This last does NOT null-check aListener, but used to call the internal nsEventListener::AddEventListener and ignore the return value, so always returned NS_OK
Now we're returning the return value of nsEventListenerManager::AddEventListener, which is NS_ERROR_FAILURE in this case.
We need to eat this exception somewhere. I suggest making nsEventListenerManager::AddEventListener just be a no-op when passed null...
![]() |
||
Updated•14 years ago
|
Keywords: regressionwindow-wanted
Assignee | ||
Comment 11•14 years ago
|
||
Unless this breaks more sites I think we should evangelize here instead.
Comment 12•14 years ago
|
||
AddEventListener must not throw. This is just a bug to fix.
Updated•14 years ago
|
Comment 13•14 years ago
|
||
(In reply to comment #11)
> Unless this breaks more sites I think we should evangelize here instead.
(In reply to comment #12)
> AddEventListener must not throw. This is just a bug to fix.
This is tracking firefox 7 - what approach do we want to take here for the FF7 release?
Assignee | ||
Comment 15•14 years ago
|
||
Attachment #543157 -
Attachment is obsolete: true
Attachment #551529 -
Flags: review?(Olli.Pettay)
Comment 16•14 years ago
|
||
Comment on attachment 551529 [details] [diff] [review]
Patch to fix
>+<script class="testbody" type="text/javascript">
>+
>+xhr = new XMLHttpRequest;
>+w = new Worker("empty.js");
>+window.addEventListener("load", null, false);
>+document.addEventListener("load", null, false);
>+document.body.addEventListener("load", null, false);
>+xhr.addEventListener("load", null, false);
>+w.addEventListener("load", null, false);
>+window.addEventListener("load", undefined, false);
>+document.addEventListener("load", undefined, false);
>+document.body.addEventListener("load", undefined, false);
>+xhr.addEventListener("load", undefined, false);
>+w.addEventListener("load", undefined, false);
>+
>+</script>
Shouldn't you have ok(true, "Test passed");
right before </script>
With that, r=me
Attachment #551529 -
Flags: review?(Olli.Pettay) → review+
Assignee | ||
Comment 17•14 years ago
|
||
This also makes addEventListener not return an nsresult since on trunk aListener being null was the only "real" way addEventListener could fail.
Attachment #551558 -
Flags: review?(Olli.Pettay)
Assignee | ||
Comment 18•14 years ago
|
||
Comment on attachment 551529 [details] [diff] [review]
Patch to fix
This fixes a regression where functions that used to be no-ops were caused to throw. The patch reverts behavior so that they are a no-op again.
Attachment #551529 -
Flags: approval-mozilla-aurora?
Comment 19•14 years ago
|
||
Comment on attachment 551529 [details] [diff] [review]
Patch to fix
Get it in before beta next monday, please!
Attachment #551529 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Assignee | ||
Comment 20•14 years ago
|
||
Fixed on aurora:
http://hg.mozilla.org/releases/mozilla-aurora/rev/54aa371f173b
status-firefox7:
--- → fixed
Comment 21•14 years ago
|
||
Backed out because the test is failing on Aurora:
https://hg.mozilla.org/releases/mozilla-aurora/rev/e835bb5bb615
http://tinderbox.mozilla.org/showlog.cgi?log=Mozilla-Aurora/1312929770.1312931139.1570.gz
45037 ERROR TEST-UNEXPECTED-FAIL | /tests/content/events/test/test_bug667612.html | [SimpleTest/SimpleTest.js, window.onerror] - An error occurred: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIWorker.addEventListener]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://mochi.test:8888/tests/content/events/test/test_bug667612.html :: <TOP_LEVEL> :: line 27" data: no] at :0
Assignee | ||
Comment 22•14 years ago
|
||
Turns out workers go through completely different codepaths on the aurora branch, which never worked. It does appear to work on trunk though where we're using a totally new worker implementation.
Repushed to branch with the offending tests removed:
http://hg.mozilla.org/releases/mozilla-aurora/rev/c2f69b271358
Comment 23•14 years ago
|
||
We couldn't decide whether or not we should transplant anything on Aurora after the migration today, so marking as tracking-firefox8+. Jonas, can you please let us know if we need to do anything on Aurora?
tracking-firefox8:
--- → +
Assignee | ||
Comment 24•14 years ago
|
||
Comment on attachment 551529 [details] [diff] [review]
Patch to fix
Good catch! Since the other patch is still is awaiting review on trunk, we'll have to take this one on (the new, to-be-ff-8) aurora.
Attachment #551529 -
Flags: approval-mozilla-aurora+ → approval-mozilla-aurora?
Updated•14 years ago
|
Attachment #551529 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Assignee | ||
Comment 25•14 years ago
|
||
Checked in to aurora:
http://hg.mozilla.org/releases/mozilla-aurora/rev/246acc814f72
status-firefox8:
--- → fixed
Updated•14 years ago
|
Attachment #551558 -
Flags: review?(Olli.Pettay) → review+
Assignee | ||
Comment 26•14 years ago
|
||
Checked in to inbound
http://hg.mozilla.org/integration/mozilla-inbound/rev/63b8853b1d67
Thanks for the review!
Comment 27•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Updated•14 years ago
|
Keywords: dev-doc-needed
Comment 28•14 years ago
|
||
I take it all that I'm documenting here is that addEventListnener() now returns as if nothing's wrong if the listener is null?
Assignee | ||
Comment 29•14 years ago
|
||
Yup
Comment 30•14 years ago
|
||
Documentation updated:
https://developer.mozilla.org/en/DOM/element.addEventListener#Gecko_notes
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIDOMEventTarget
And mentioned on Firefox 9 for developers.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•