Closed Bug 613634 Opened 14 years ago Closed 13 years ago

NS_ERROR_XPC_NOT_ENOUGH_ARGS on rumpetroll.com (investigate if we should have optional useCapture parameter)

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla6
Tracking Status
blocking2.0 --- .x+

People

(Reporter: jdm, Assigned: smaug)

References

Details

(Keywords: dev-doc-complete, Whiteboard: [parity-webkit][parity-opera][parity-IE9?])

Attachments

(1 file, 1 obsolete file)

STR:
1. Visit rumpetroll.com

Expected:
Swimming around in a fun websocket-based game

Actual:
The error appears in the console, no game is present.

This works fine in chrome.
This is the failing line in main.js:

>document.getElementById('authorize-user-button').addEventListener('click', function(e) { 
>		app.authorize(null,null);
>		authWindow = window.open("auth.html","","width=950,height=460,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes')")
>		return false;
>	});
This error is occurring because |addEventListener('click', function(e) {})| throws.  CCing people who might know whether this is correct behaviour or not.
Component: General → DOM: Core & HTML
QA Contact: general → general
It's correct behavior per DOM 2 Events, and this site is assuming Webkit's behavior which doesn't follow that spec, really.

There have been proposals to change it for Web DOM Core; I don't believe we have a bug on making the third arg optional so far.
OS: Mac OS X → All
Hardware: x86 → All
Attached patch optional capture param (obsolete) — Splinter Review
I pushed this to tryserver
Summary: NS_ERROR_XPC_NOT_ENOUGH_ARGS on rumpetroll.com → NS_ERROR_XPC_NOT_ENOUGH_ARGS on rumpetroll.com (investigate if we should have optional useCapture parameter)
Apparently that kind of simple patch breaks quite a few tests.
Well, at least the ones in the official DOM test suites, right?
http://mxr.mozilla.org/mozilla-central/source/dom/src/threads/nsDOMWorkerMessageHandler.cpp#339

342 NS_IMETHODIMP
343 nsDOMWorkerMessageHandler::AddEventListener(const nsAString& aType,
344                                             nsIDOMEventListener* aListener,
345                                             PRBool aUseCapture,
346                                             PRBool aWantsUntrusted,
347                                             PRUint8 optional_argc)
348 {
349   // We don't support aWantsUntrusted yet.
350   NS_ENSURE_TRUE(optional_argc == 0, NS_ERROR_NOT_IMPLEMENTED);

This isn't going to fly anymore...
Blocks: 616252
Whiteboard: [parity-webkit][parity-opera]
We may want to fix this for FF4.
If I understood Travis (from MS) correctly, IE9 may make the useCapture
optional too.
Assignee: nobody → Olli.Pettay
blocking2.0: --- → ?
Whiteboard: [parity-webkit][parity-opera] → [parity-webkit][parity-opera][parity-IE9?]
As mentioned in http://www.w3.org/mid/20101124025438.GA14523@wok.mcc.id.au we came to the conclusion that Web IDL should allow too few arguments, and coerce them from undefined, (and allow too many, and ignore the extra arguments) as the most JavaScript-y way to handle mismatched arity.  Nobody has spoken up against this proposal on the list yet.  (The change is yet to have been made to the spec.)

The result of this is that it wouldn't matter if useCapture is optional or not -- omitting it would require the missing argument to be treated as undefined and thus be converted to false.
Not sure if this really needs to *block*.
Agreed, we can get to this later.
blocking2.0: ? → .x
Is there a technical or spec holdup to fixing this?

We've already made the second parameter of window.getComputedStyle to be optional.
(In reply to comment #13)
> Is there a technical or spec holdup to fixing this?
No. I just need to find time to fix this.
Olli, is there anything to do here other than adding "optional" to the idl and writing tests?
I did try that [optional] approach and something broke.
The reason is, IIRC, that we already have one optional parameter, so need to
update optional_argc handling.
(In reply to comment #17)
> I did try that [optional] approach and something broke.
> The reason is, IIRC, that we already have one optional parameter, so need to
> update optional_argc handling.

This problem only affects the nsIDOMNSEventTarget interface, which web content doesn't use, AIUI. Could we could first land a patch that makes useCapture optional only for nsIDOMEventTarget?
Web content does use addEventListener from nsIDOMNSEventTarget.
addEventListener in nsIDOMEventTarget is [noscript]
Attached patch patchSplinter Review
Uploaded to tryserver
Attachment #492203 - Attachment is obsolete: true
Attachment #527936 - Flags: review?(jonas)
Comment on attachment 527936 [details] [diff] [review]
patch

Maybe also test that

x.addEventListener("foo", l);
x.removeEventListener("foo, l, false);

removes the event listener?
Attachment #527936 - Flags: review?(jonas) → review+
Depends on: 654770
http://hg.mozilla.org/mozilla-central/rev/f0ad024522bb
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Keywords: dev-doc-needed
Target Milestone: --- → mozilla6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: