Last Comment Bug 708169 - Report deprecated mozRequestAnimationFrame usage (no-arguments style) to console
: Report deprecated mozRequestAnimationFrame usage (no-arguments style) to console
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: unspecified
: All All
: P2 normal (vote)
: mozilla11
Assigned To: Boris Zbarsky [:bz] (Out June 25-July 6)
:
Mentors:
Depends on:
Blocks: 704171 710981
  Show dependency treegraph
 
Reported: 2011-12-06 20:04 PST by Masatoshi Kimura [:emk]
Modified: 2011-12-15 10:36 PST (History)
5 users (show)
bzbarsky: in‑testsuite?
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch for reference (3.44 KB, patch)
2011-12-06 21:07 PST, Boris Zbarsky [:bz] (Out June 25-July 6)
no flags Details | Diff | Review
Warn when null or no argument is passed to mozRequestAnimationFrame. (4.56 KB, patch)
2011-12-14 23:47 PST, Boris Zbarsky [:bz] (Out June 25-July 6)
roc: review+
Details | Diff | Review

Description Masatoshi Kimura [:emk] 2011-12-06 20:04:34 PST
Users may wonder why MozBeforePaint events suddenly stopped to work.
Deprecation messages will help to spot the problem promptly.
Comment 1 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-06 20:07:06 PST
Yeah, fair.  I'll do this.
Comment 2 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-06 20:52:07 PST
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.
Comment 3 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-06 21:06:28 PST
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....
Comment 4 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-06 21:07:25 PST
Created attachment 579587 [details] [diff] [review]
Patch for reference
Comment 5 Masatoshi Kimura [:emk] 2011-12-06 23:58:22 PST
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?
Comment 6 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-07 00:01:21 PST
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?
Comment 7 Masatoshi Kimura [:emk] 2011-12-07 00:18:50 PST
(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)
Comment 8 Masatoshi Kimura [:emk] 2011-12-07 00:23:06 PST
> (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.
Comment 9 Masatoshi Kimura [:emk] 2011-12-07 00:29:49 PST
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 YUKI "Piro" Hiroshi 2011-12-07 00:43:01 PST
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.
Comment 11 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-07 01:38:45 PST
> 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.  :(
Comment 12 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-07 01:41:59 PST
> It'll get there, I promise!

I just added something for a start.
Comment 13 Masatoshi Kimura [:emk] 2011-12-07 03:11:40 PST
(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.
Comment 14 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-07 04:46:17 PST
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....
Comment 15 :Ms2ger 2011-12-07 07:15:40 PST
Or make the argument optional in IDL and warn/throw if it isn't supplied?
Comment 16 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-07 11:34:26 PST
Hmm.  Yeah, I suppose I could go back to doing that for a release or two.  OK.
Comment 18 Masatoshi Kimura [:emk] 2011-12-13 18:13:27 PST
Sorry, wrong bug.
Comment 19 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-14 23:47:32 PST
Created attachment 581898 [details] [diff] [review]
Warn when null or no argument is passed to mozRequestAnimationFrame.
Comment 20 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-12-15 05:55:03 PST
https://hg.mozilla.org/integration/mozilla-inbound/rev/ec462ccd642b
Comment 21 Matt Brubeck (:mbrubeck) 2011-12-15 10:36:12 PST
https://hg.mozilla.org/mozilla-central/rev/ec462ccd642b

Note You need to log in before you can comment on or make changes to this bug.