You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Simon MacDonald <si...@gmail.com> on 2012/09/11 21:43:38 UTC
Change to Media.onStatus() causing error callback to get incorrect
value on Android & iOS
Hey all,
This change:
https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commitdiff;h=4214ffe2c319608cd1065caed5e6e4ddd4720fd9
has modified the way the error callback is invoked. It used to be:
media.errorCallback(value)
and it is now:
media.errorCallback({'code':value})
So now when the error callback is run on Android or iOS you get a value of
{'code': {'code': 1}}. This is causing a mobile spec test failure in Media.
I could go ahead and make the change in the JavaScript to make it:
media.errorCallback(value)
but that'll screw up Windows Phone. Is there any way that WP can return a
JSON error object or do Becky and I need to go in and change the
Android/iOS repos?
Thanks...
Simon Mac Donald
http://hi.im/simonmacdonald
Re: Change to Media.onStatus() causing error callback to get
incorrect value on Android & iOS
Posted by Jesse <pu...@gmail.com>.
changes pushed, please re-test + re-tag
sorry for any confusion ..
On Tue, Sep 11, 2012 at 1:56 PM, Jesse <pu...@gmail.com> wrote:
> The mobile-spec failure test is explicitly checking for the error
> handler to have been called with an error object:, or at least an
> object that has a 'code' property that is a number.
>
> fail = jasmine.createSpy().andCallFake(function (result) {
> expect(result).toBeDefined();
> expect(result.code).toBe(MediaError.MEDIA_ERR_ABORTED);
> });
>
> The docs say NOTHING of what is passed to the error handler.
>
> Android is doing this ugliness ...
> this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('"
> + this.id + "', { \"code\":" + arg1 + "});");
>
> iOS includes a non-standard error message
>
> Regardless, I will fix WP7, so it does not break the other platforms,
> and file issues for the inconsistencies.
>
>
>
>
>
>
>
>
> On Tue, Sep 11, 2012 at 1:12 PM, Jesse <pu...@gmail.com> wrote:
>> I can modify WP7, that is okay ... just looking into the test/docs
>> briefly first.
>>
>> On Tue, Sep 11, 2012 at 12:43 PM, Simon MacDonald
>> <si...@gmail.com> wrote:
>>> Hey all,
>>>
>>> This change:
>>>
>>> https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commitdiff;h=4214ffe2c319608cd1065caed5e6e4ddd4720fd9
>>>
>>> has modified the way the error callback is invoked. It used to be:
>>>
>>> media.errorCallback(value)
>>>
>>> and it is now:
>>>
>>> media.errorCallback({'code':value})
>>>
>>> So now when the error callback is run on Android or iOS you get a value of
>>> {'code': {'code': 1}}. This is causing a mobile spec test failure in Media.
>>>
>>> I could go ahead and make the change in the JavaScript to make it:
>>>
>>> media.errorCallback(value)
>>>
>>> but that'll screw up Windows Phone. Is there any way that WP can return a
>>> JSON error object or do Becky and I need to go in and change the
>>> Android/iOS repos?
>>>
>>> Thanks...
>>>
>>> Simon Mac Donald
>>> http://hi.im/simonmacdonald
>>
>>
>>
>> --
>> @purplecabbage
>> risingj.com
>
>
>
> --
> @purplecabbage
> risingj.com
--
@purplecabbage
risingj.com
Re: Change to Media.onStatus() causing error callback to get
incorrect value on Android & iOS
Posted by Jesse <pu...@gmail.com>.
The mobile-spec failure test is explicitly checking for the error
handler to have been called with an error object:, or at least an
object that has a 'code' property that is a number.
fail = jasmine.createSpy().andCallFake(function (result) {
expect(result).toBeDefined();
expect(result.code).toBe(MediaError.MEDIA_ERR_ABORTED);
});
The docs say NOTHING of what is passed to the error handler.
Android is doing this ugliness ...
this.handler.sendJavascript("cordova.require('cordova/plugin/Media').onStatus('"
+ this.id + "', { \"code\":" + arg1 + "});");
iOS includes a non-standard error message
Regardless, I will fix WP7, so it does not break the other platforms,
and file issues for the inconsistencies.
On Tue, Sep 11, 2012 at 1:12 PM, Jesse <pu...@gmail.com> wrote:
> I can modify WP7, that is okay ... just looking into the test/docs
> briefly first.
>
> On Tue, Sep 11, 2012 at 12:43 PM, Simon MacDonald
> <si...@gmail.com> wrote:
>> Hey all,
>>
>> This change:
>>
>> https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commitdiff;h=4214ffe2c319608cd1065caed5e6e4ddd4720fd9
>>
>> has modified the way the error callback is invoked. It used to be:
>>
>> media.errorCallback(value)
>>
>> and it is now:
>>
>> media.errorCallback({'code':value})
>>
>> So now when the error callback is run on Android or iOS you get a value of
>> {'code': {'code': 1}}. This is causing a mobile spec test failure in Media.
>>
>> I could go ahead and make the change in the JavaScript to make it:
>>
>> media.errorCallback(value)
>>
>> but that'll screw up Windows Phone. Is there any way that WP can return a
>> JSON error object or do Becky and I need to go in and change the
>> Android/iOS repos?
>>
>> Thanks...
>>
>> Simon Mac Donald
>> http://hi.im/simonmacdonald
>
>
>
> --
> @purplecabbage
> risingj.com
--
@purplecabbage
risingj.com
Re: Change to Media.onStatus() causing error callback to get
incorrect value on Android & iOS
Posted by Jesse <pu...@gmail.com>.
I can modify WP7, that is okay ... just looking into the test/docs
briefly first.
On Tue, Sep 11, 2012 at 12:43 PM, Simon MacDonald
<si...@gmail.com> wrote:
> Hey all,
>
> This change:
>
> https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-js.git;a=commitdiff;h=4214ffe2c319608cd1065caed5e6e4ddd4720fd9
>
> has modified the way the error callback is invoked. It used to be:
>
> media.errorCallback(value)
>
> and it is now:
>
> media.errorCallback({'code':value})
>
> So now when the error callback is run on Android or iOS you get a value of
> {'code': {'code': 1}}. This is causing a mobile spec test failure in Media.
>
> I could go ahead and make the change in the JavaScript to make it:
>
> media.errorCallback(value)
>
> but that'll screw up Windows Phone. Is there any way that WP can return a
> JSON error object or do Becky and I need to go in and change the
> Android/iOS repos?
>
> Thanks...
>
> Simon Mac Donald
> http://hi.im/simonmacdonald
--
@purplecabbage
risingj.com