Re: throw or not when sw or sh is zero in drawImage(img, 0, 0, sw, wh, ...) (WHATWG r7589)

As Kenny mentioned, this will break some existing content. Because of this,
I'm leaning towards changing the spec since it's likely that very few
people are expecting this behavior. (Is it good practice to build code with
exception in javascript? In C++ they should only be used to flag serious
errors since their overhead is so high.)

An alternate approach would be to contact the authors of this content so
they can change their code before we throw the switch.

On Mon, Mar 25, 2013 at 5:13 PM, Kris Krueger <krisk@microsoft.com> wrote:

> IE9 and IE10 shipped with behavior and I don't expect that this will be
> changed for these versions of IE.
> The least path of resistance would be to have webkit just match FireFox
> and IE.
>
> -Kris
>
> From: Rik Cabanier [mailto:cabanier@gmail.com]
> Sent: Thursday, March 21, 2013 9:28 PM
> To: Kang-Hao (Kenny) Lu
> Cc: W3C Canvas Spec; HTML-related tests; Tietao Wang
> Subject: Re: throw or not when sw or sh is zero in drawImage(img, 0, 0,
> sw, wh, ...) (WHATWG r7589)
>
> Sorry, I was confused about the particular API call you were referring to.
> Also, are you a web developer or do you work on a browser? (I thought you
> were a developer)
>
> There is indeed a trend to be more forgiving in the user facing APIs.
> If Firefox also moves to not throwing, I would be happy to change the
> Canvas spec.
>
> We should pick up the conversation on the WhatWG mailing list again so we
> can get close this issue. Last I heard, people were reluctant to change
> since there were already 2 shipping implementations and I was almost ready
> to integrate a WebKit patch to fix the behavior.
>
> Rik
>
> On Thu, Mar 21, 2013 at 9:02 PM, Kang-Hao (Kenny) Lu <kanghaol@oupeng.com>
> wrote:
> (13/03/22 3:45), Rik Cabanier wrote:
> > The spec was changed at the last minute by the WhatWG and it was actually
> > done by accident. (Cameron did a global replace for WebIDL.)
> How would doing a global replace for WebIDL change the spec prose? Just
> curious.
>
> > The W3C version reversed that change since the change was unintentional
> and
> > there were already 2 independent implementations. Ian decided that the
> new
> > prose made more sense and just left it in.
> roc seemed to indicate that he has a patch for removing these errors[1]
> (although I haven't found the relevant Bugzilla bug) so "having 2
> independent implementations" doesn't seem like a stable assertion.
>
> Should we raise a discussion on the WHATWG list if we intend to keep the
> current prose in the W3C version as it is?
>
> [1] http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Mar/0020
>
> > As a developer you should try to catch the exception since both Firefox
> and
> > IE will throw. This will make your code work everywhere.
> Not sure what you mean here. This doesn't look like an argument against
> the backwards-compat argument. As UA developers, we don't want to do
> unnecessary Web evangelism. As Web developer, I'd say using try and
> catch in JS is not as common as in other languages.
>
> > If those browser change their behavior, we will update the spec
> > accordingly (but you will still have to account for old browsers)
> A UA needs to account for old contents.
>
> >> 2. Compatibility
> >>
> >> Currently only WebKit implements the WHATWG behavior (not throwing).
> >> However, it seems very likely that this part of the Web (the WebKit Web
> >> :( ) is already depending on drawImage not throwing. Google
> >> "IndexSizeError" gives [3][4][5], and I bet there are much more. Also,
> >> it is known that getting the Android WebView to change is hard, and
> >> therefore not throwing seems like the way to converge.
> >>
> >>
> >> Anyway, the baseline is that we shouldn't have a difference between the
> >> two specs.
> >>
> >> [3] https://github.com/Animatron/player/pull/70
> >> [4] https://github.com/aduros/flambe/issues/55
> >> [5] http://groups.google.com/group/melonjs/msg/571b36150fd2760b
>
> Cheers,
> Kenny
> --
> Web Specialist, Opera Sphinx Game Force, Oupeng Browser, Beijing
> Try Oupeng: http://www.oupeng.com/
>
>

Received on Tuesday, 26 March 2013 02:37:14 UTC