You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Jesse <pu...@gmail.com> on 2012/09/04 22:08:56 UTC

The spec defines the docs which defines the tests which defines the implementation, and other dependency issues

I am trying to chase down a few failing tests, here is one of the
simpler cases I am having to deal with.
I need to know which of the following is correct.
( note that there are numerous other similar cases like this
throughout our code base )

The W3 Spec for MediaError is [1] :

interface MediaError {
  const unsigned short MEDIA_ERR_ABORTED = 1;
  const unsigned short MEDIA_ERR_NETWORK = 2;
  const unsigned short MEDIA_ERR_DECODE = 3;
  const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
  readonly attribute unsigned short code;
};

The phonegap edge docs state [2]:

MediaError.MEDIA_ERR_ABORTED
MediaError.MEDIA_ERR_NETWORK
MediaError.MEDIA_ERR_DECODE
MediaError.MEDIA_ERR_NONE_SUPPORTED

The tests are testing for [3] :

expect(MediaError.MEDIA_ERR_NONE_ACTIVE).toBe(0);
expect(MediaError.MEDIA_ERR_ABORTED).toBe(1);
expect(MediaError.MEDIA_ERR_NETWORK).toBe(2);
expect(MediaError.MEDIA_ERR_DECODE).toBe(3);
expect(MediaError.MEDIA_ERR_NONE_SUPPORTED).toBe(4);

The cordova js repo defines this [4] :

MediaError.MEDIA_ERR_NONE_ACTIVE    = 0;
MediaError.MEDIA_ERR_ABORTED        = 1;
MediaError.MEDIA_ERR_NETWORK        = 2;
MediaError.MEDIA_ERR_DECODE         = 3;
MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;

How should I resolve this?
Can we remove MEDIA_ERR_NONE_ACTIVE ?
Can we re-define 4 as MEDIA_ERR_SRC_NOT_SUPPORTED instead of
MEDIA_ERR_NONE_SUPPORTED ?
Can we change our js code to only write the MediaError interface if it
does not exist?

[1] http://dev.w3.org/html5/spec-author-view/video.html#error-codes
[2] http://docs.phonegap.com/en/edge/cordova_media_media.md.html#mediaError
[3] https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autotest/tests/media.tests.js
[4] https://github.com/apache/incubator-cordova-js/blob/master/lib/common/plugin/MediaError.js
-- 
@purplecabbage
risingj.com

Re: The spec defines the docs which defines the tests which defines the implementation, and other dependency issues

Posted by Andrew Grieve <ag...@chromium.org>.
Maybe just add MEDIA_ERR_SRC_NOT_SUPPORTED alongside MEDIA_ERR_NONE_
SUPPORTED?


On Tue, Sep 4, 2012 at 5:01 PM, Filip Maj <fi...@adobe.com> wrote:

> This API was written against an earlier revision of this spec so the
> codes/labels have likely changed.
>
> Changing stuff requires changes to reflect across all platforms. That's my
> only concern at this point.
>
> I would shy away from changing anything. It's make-work until we review
> the API(s) in the coming months anyways.
>
> As for this specific scenario.. Fuck. I dunno. I would update the docs to
> reflect the JS + tests?
>
> On 9/4/12 1:08 PM, "Jesse" <pu...@gmail.com> wrote:
>
> >I am trying to chase down a few failing tests, here is one of the
> >simpler cases I am having to deal with.
> >I need to know which of the following is correct.
> >( note that there are numerous other similar cases like this
> >throughout our code base )
> >
> >The W3 Spec for MediaError is [1] :
> >
> >interface MediaError {
> >  const unsigned short MEDIA_ERR_ABORTED = 1;
> >  const unsigned short MEDIA_ERR_NETWORK = 2;
> >  const unsigned short MEDIA_ERR_DECODE = 3;
> >  const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
> >  readonly attribute unsigned short code;
> >};
> >
> >The phonegap edge docs state [2]:
> >
> >MediaError.MEDIA_ERR_ABORTED
> >MediaError.MEDIA_ERR_NETWORK
> >MediaError.MEDIA_ERR_DECODE
> >MediaError.MEDIA_ERR_NONE_SUPPORTED
> >
> >The tests are testing for [3] :
> >
> >expect(MediaError.MEDIA_ERR_NONE_ACTIVE).toBe(0);
> >expect(MediaError.MEDIA_ERR_ABORTED).toBe(1);
> >expect(MediaError.MEDIA_ERR_NETWORK).toBe(2);
> >expect(MediaError.MEDIA_ERR_DECODE).toBe(3);
> >expect(MediaError.MEDIA_ERR_NONE_SUPPORTED).toBe(4);
> >
> >The cordova js repo defines this [4] :
> >
> >MediaError.MEDIA_ERR_NONE_ACTIVE    = 0;
> >MediaError.MEDIA_ERR_ABORTED        = 1;
> >MediaError.MEDIA_ERR_NETWORK        = 2;
> >MediaError.MEDIA_ERR_DECODE         = 3;
> >MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
> >
> >How should I resolve this?
> >Can we remove MEDIA_ERR_NONE_ACTIVE ?
> >Can we re-define 4 as MEDIA_ERR_SRC_NOT_SUPPORTED instead of
> >MEDIA_ERR_NONE_SUPPORTED ?
> >Can we change our js code to only write the MediaError interface if it
> >does not exist?
> >
> >[1] http://dev.w3.org/html5/spec-author-view/video.html#error-codes
> >[2]
> >http://docs.phonegap.com/en/edge/cordova_media_media.md.html#mediaError
> >[3]
> >
> https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autote
> >st/tests/media.tests.js
> >[4]
> >
> https://github.com/apache/incubator-cordova-js/blob/master/lib/common/plug
> >in/MediaError.js
> >--
> >@purplecabbage
> >risingj.com
>
>

Re: The spec defines the docs which defines the tests which defines the implementation, and other dependency issues

Posted by Filip Maj <fi...@adobe.com>.
This API was written against an earlier revision of this spec so the
codes/labels have likely changed.

Changing stuff requires changes to reflect across all platforms. That's my
only concern at this point.

I would shy away from changing anything. It's make-work until we review
the API(s) in the coming months anyways.

As for this specific scenario.. Fuck. I dunno. I would update the docs to
reflect the JS + tests?

On 9/4/12 1:08 PM, "Jesse" <pu...@gmail.com> wrote:

>I am trying to chase down a few failing tests, here is one of the
>simpler cases I am having to deal with.
>I need to know which of the following is correct.
>( note that there are numerous other similar cases like this
>throughout our code base )
>
>The W3 Spec for MediaError is [1] :
>
>interface MediaError {
>  const unsigned short MEDIA_ERR_ABORTED = 1;
>  const unsigned short MEDIA_ERR_NETWORK = 2;
>  const unsigned short MEDIA_ERR_DECODE = 3;
>  const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
>  readonly attribute unsigned short code;
>};
>
>The phonegap edge docs state [2]:
>
>MediaError.MEDIA_ERR_ABORTED
>MediaError.MEDIA_ERR_NETWORK
>MediaError.MEDIA_ERR_DECODE
>MediaError.MEDIA_ERR_NONE_SUPPORTED
>
>The tests are testing for [3] :
>
>expect(MediaError.MEDIA_ERR_NONE_ACTIVE).toBe(0);
>expect(MediaError.MEDIA_ERR_ABORTED).toBe(1);
>expect(MediaError.MEDIA_ERR_NETWORK).toBe(2);
>expect(MediaError.MEDIA_ERR_DECODE).toBe(3);
>expect(MediaError.MEDIA_ERR_NONE_SUPPORTED).toBe(4);
>
>The cordova js repo defines this [4] :
>
>MediaError.MEDIA_ERR_NONE_ACTIVE    = 0;
>MediaError.MEDIA_ERR_ABORTED        = 1;
>MediaError.MEDIA_ERR_NETWORK        = 2;
>MediaError.MEDIA_ERR_DECODE         = 3;
>MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
>
>How should I resolve this?
>Can we remove MEDIA_ERR_NONE_ACTIVE ?
>Can we re-define 4 as MEDIA_ERR_SRC_NOT_SUPPORTED instead of
>MEDIA_ERR_NONE_SUPPORTED ?
>Can we change our js code to only write the MediaError interface if it
>does not exist?
>
>[1] http://dev.w3.org/html5/spec-author-view/video.html#error-codes
>[2] 
>http://docs.phonegap.com/en/edge/cordova_media_media.md.html#mediaError
>[3] 
>https://github.com/apache/incubator-cordova-mobile-spec/blob/master/autote
>st/tests/media.tests.js
>[4] 
>https://github.com/apache/incubator-cordova-js/blob/master/lib/common/plug
>in/MediaError.js
>-- 
>@purplecabbage
>risingj.com