Closed Bug 708169 Opened 8 years ago Closed 8 years ago

Report deprecated mozRequestAnimationFrame usage (no-arguments style) to console

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: emk, Assigned: bzbarsky)

References

Details

Attachments

(2 files)

Users may wonder why MozBeforePaint events suddenly stopped to work.
Deprecation messages will help to spot the problem promptly.
Yeah, fair.  I'll do this.
Assignee: nobody → bzbarsky
Actually, if you call requestAnimationFrame with no arguments it'll just throw.  But I can add a warning for cases when it's called with an explicit null.
Although of course those cases will throw too.  So is the warning really useful at that point?  Any attempt to do the old broken thing will throw....
I'm going to add similar warnings in bug 701787 because I thought the message "A parameter or an operation is not supported by the underlying object." was too generic. Is there a way to customize messages of Exceptions?
Yes, but it's moderately painful (e.g. requires you to define a new nsresult and the associated stringification).

Do you think the "not enough arguments" exception for the case when null is not passed explicitly is good enough?
(In reply to Boris Zbarsky (:bz) from comment #6)
> Do you think the "not enough arguments" exception for the case when null is
> not passed explicitly is good enough?
I heard an Extension developer said so.
http://piro.sakura.ne.jp/latest/blosxom/webtech/javascript/2011-12-02_requestanimationframe.htm (Sorry, Japanese)
> (e.g. requires you to define a new nsresult
I have to use NS_ERROR_DOM_INVALID_ACCESS_ERR because it's required by the spec.
Also, exception messages will not help if it is swallowed by
> try { ... } catch (e) {}
idiom (I know it is a bad practice, but sometimes it is used).
On my case: I actually got an error message like "invalid argument error" for window.mozRequestAnimationFrame() (with no callback), so, at first I tried to give a dummy function (like "function() {}") for the method. Then I got no error message in the console, so I thought that the problem was gone. But, my codes still didn't work, and I realized that my event listener never listened the MozBeforePaint event. I think the problem could be fixed easily if the error console said like "mozRequestAnimationFrame() with no argument and MozBeforePaint event are deprecated." (If "Firefox 11 for developers" including this topic was there, it will helped me.)

I don't know how many people actually use the deprecated usage. If only few people use it (I think it maybe true), I agree that helpful error message is not required.
> I heard an Extension developer said so.

Said that it _is_ good enough, or that it's not?

> If "Firefox 11 for developers" including this topic was there, it will helped me.

It'll get there, I promise!

> I don't know how many people actually use the deprecated usage.

I did look into that before removing it.  See bug 704171 comment 1.

I obviously can't add a warning for the dummy function case....  Adding a warning for the case of not enough arguments would be very painful, actually.  :(
> It'll get there, I promise!

I just added something for a start.
(In reply to Boris Zbarsky (:bz) from comment #11)
> Said that it _is_ good enough, or that it's not?
Ah, is not.

> I did look into that before removing it.  See bug 704171 comment 1.
Deprecation warnings will also help for Web authors. Bug 704171 is blocked by some Tech Evang bugs.

> I obviously can't add a warning for the dummy function case....  Adding a
> warning for the case of not enough arguments would be very painful,
> actually.  :(
I don't think the warning is required for the dummy function case. If the warning explained that the "MozBeforePaint" event had gone, he would have noticed the cause before adding the dummy function.
Yeah.  I haven't thought of a good way to add a warning for the not enough arguments case yet.  It'd have to be hacked into quickstubs somehow....
Or make the argument optional in IDL and warn/throw if it isn't supplied?
Hmm.  Yeah, I suppose I could go back to doing that for a release or two.  OK.
Sorry, wrong bug.
Blocks: 710981
Priority: -- → P2
Whiteboard: [need review]
https://hg.mozilla.org/integration/mozilla-inbound/rev/ec462ccd642b
Flags: in-testsuite?
Whiteboard: [need review]
Target Milestone: --- → mozilla11
https://hg.mozilla.org/mozilla-central/rev/ec462ccd642b
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.