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

RESOLVED FIXED in mozilla11

Status

()

Core
DOM
P2
normal
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: emk, Assigned: bz)

Tracking

unspecified
mozilla11
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
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....
Created attachment 579587 [details] [diff] [review]
Patch for reference
(Reporter)

Comment 5

6 years ago
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?
(Reporter)

Comment 7

6 years ago
(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)
(Reporter)

Comment 8

6 years ago
> (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.
(Reporter)

Comment 9

6 years ago
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).

Comment 10

6 years ago
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.
(Reporter)

Comment 13

6 years ago
(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.
(Reporter)

Comment 17

6 years ago
The spec has been changed.
http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html#cancelAnimationFrame
(Reporter)

Comment 18

6 years ago
Sorry, wrong bug.
Blocks: 710981
Created attachment 581898 [details] [diff] [review]
Warn when null or no argument is passed to mozRequestAnimationFrame.
Attachment #581898 - Flags: review?(roc)
Priority: -- → P2
Whiteboard: [need review]
Attachment #581898 - Flags: review?(roc) → 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
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.