Closed Bug 1118102 Opened 10 years ago Closed 9 years ago

SecureElement : Proper errors should be propagated to apps using SE API

Categories

(Firefox OS Graveyard :: NFC, defect)

x86_64
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox41 fixed)

RESOLVED FIXED
2.2 S14 (12june)
Tracking Status
firefox41 --- fixed

People

(Reporter: psiddh, Assigned: psiddh)

References

Details

Attachments

(2 files, 4 obsolete files)

Currently most of the errors in parent process are propagated north bound as 'Generic Errors'. This bug may track error handling / propagation across parent and child process in the SE stack.
No longer depends on: 1118101
Blocks: 1118106
No longer blocks: 1118106
Assignee: nobody → psiddh
Attachment #8589446 - Flags: feedback?(allstars.chh)
Here is the patch for 'SE API Test App'. With the Gecko + (this) Gaia patch, the test app passes all the test cases (except one which is related to ACE). If earlier Gecko patch is Ok'd then I'd send this patch / pull request to Alison for her further review! FYI:There is another issue to be fixed in SE stack (as a result intermittently shows up in 'SE API Test App'). It looks like there is a race condition that needs to be fixed. (More on this bug later)
Attachment #8589450 - Attachment description: 0001-Error-Handling.patch → 'SE-API-Test-App' Gaia dev app changes
Attachment #8589450 - Attachment description: 'SE-API-Test-App' Gaia dev app changes → 'SE-API-Test-App' corresponding Gaia dev app changes
Attachment #8589446 - Flags: feedback?(allstars.chh) → review?(allstars.chh)
Comment on attachment 8589446 [details] [diff] [review] (v1) Fix error handling by rejecting the promises with specific SE errors. Review of attachment 8589446 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/secureelement/DOMSecureElement.js @@ +152,5 @@ > this._sessions = []; > resolver.resolve(); > }, (reason) => { > + let error = new SEError(SE.ERROR_BADSTATE, > + " Unable to close all channels associated with this reader"); extra space @@ +206,5 @@ > }, > > openLogicalChannel: function openLogicalChannel(aid) { > + if (this._isClosed) { > + return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE, indent @@ +217,1 @@ > " Invalid AID length - " + aidLen); extra space. @@ +236,5 @@ > }, > > closeAll: function closeAll() { > + if (this._isClosed) { > + return PromiseHelpers.rejectWithSEError(SE.ERROR_BADSTATE, indent @@ +346,1 @@ > ", MANAGE CHANNEL command not permitted"); What does ', ' mean ? forgot to remove this? same for below
Attachment #8589446 - Flags: review?(allstars.chh) → feedback+
Thanks Yoshi for the comments. I was caught with few other things. Will follow up on this now.
Hi Yoshi, I have taken care of your comments. Since it has been more than a month (and ACE code has landed as well), requesting a review one more time just in case. Based on my recent testing, I observe that couple of test cases fail. These test cases are merely test-case failures in the app at this point and not functional. I will raise another bug (after analyzing it further) where we can discuss on how to address these test-case failures.
Attachment #8589446 - Attachment is obsolete: true
Attachment #8611588 - Flags: review?(allstars.chh)
Attachment #8611588 - Attachment is obsolete: true
Attachment #8611588 - Flags: review?(allstars.chh)
Attachment #8611592 - Flags: review?(allstars.chh)
Comment on attachment 8611592 [details] [diff] [review] (v2) Fix error handling by rejecting the promises with specific SE errors. Review of attachment 8611592 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/secureelement/DOMSecureElement.js @@ +34,5 @@ > > +// Extend / Inherit from Error object > +function SEError(name, message) { > + this.name = name || SE.ERROR_GENERIC; > + this.message = message || ''; "" @@ +353,5 @@ > // TODO remove this once it will be possible to have a non-optional dict > // in the WebIDL > if (!command) { > + return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER, > + " SECommand dict must be defined"); remove extra space in the beginning, "SECommand.." ::: dom/webidl/SecureElement.webidl @@ +14,5 @@ > "SEIoError", // I/O Error while communicating with the secure element. > "SEBadStateError", // Error occuring as a result of bad state. > "SEInvalidChannelError", // Opening a channel failed because no channel is available. > "SEInvalidApplicationError", // The requested application was not found on the secure element. > + "SEIllegalParameterError", // Request operation does not have valid parameters. Where have SENotPresentError gone?
Attachment #8611592 - Flags: review?(allstars.chh) → review-
(In reply to Yoshi Huang[:allstars.chh] from comment #8) > Comment on attachment 8611592 [details] [diff] [review] > (v2) Fix error handling by rejecting the promises with specific SE errors. > > Review of attachment 8611592 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/secureelement/DOMSecureElement.js > @@ +34,5 @@ > > > > +// Extend / Inherit from Error object > > +function SEError(name, message) { > > + this.name = name || SE.ERROR_GENERIC; > > + this.message = message || ''; > > "" > > @@ +353,5 @@ > > // TODO remove this once it will be possible to have a non-optional dict > > // in the WebIDL > > if (!command) { > > + return PromiseHelpers.rejectWithSEError(SE.ERROR_ILLEGALPARAMETER, > > + " SECommand dict must be defined"); > > remove extra space in the beginning, "SECommand.." > > ::: dom/webidl/SecureElement.webidl > @@ +14,5 @@ > > "SEIoError", // I/O Error while communicating with the secure element. > > "SEBadStateError", // Error occuring as a result of bad state. > > "SEInvalidChannelError", // Opening a channel failed because no channel is available. > > "SEInvalidApplicationError", // The requested application was not found on the secure element. > > + "SEIllegalParameterError", // Request operation does not have valid parameters. > > Where have SENotPresentError gone? My mistake. I have added this constant back in the next version
Addressed earlier comments
Attachment #8611592 - Attachment is obsolete: true
Attachment #8614979 - Flags: review?(allstars.chh)
Comment on attachment 8614979 [details] [diff] [review] (v3) Fix error handling by rejecting the promises with specific SE errors. Review of attachment 8614979 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/secureelement/gonk/se_consts.js @@ +60,3 @@ > this.ERROR_NOTPRESENT = "SENotPresentError"; > +this.ERROR_ILLEGALPARAMETER = "SEIllegalParameterError"; > +this.ERROR_GENERIC = "SEGenericError"; nit, this.ERROR_GENERIC should be put in the original location, instead of moving it to the end.
Attachment #8614979 - Flags: review?(allstars.chh) → review+
Attachment #8615727 - Attachment description: (v3.1) Fix error handling by rejecting the promises with specific SE errors. → (v3.1) Fix error handling by rejecting the promises with specific SE errors. r=allstars.chh
Keywords: checkin-needed
webidl changes need DOM peer review
Keywords: checkin-needed
Comment on attachment 8615727 [details] [diff] [review] (v3.1) Fix error handling by rejecting the promises with specific SE errors. r=allstars.chh r=khuey Requesting Kyle Huey to review the relevant bits of the patch.
Attachment #8615727 - Flags: review?(khuey)
Attachment #8615727 - Attachment description: (v3.1) Fix error handling by rejecting the promises with specific SE errors. r=allstars.chh → (v3.1) Fix error handling by rejecting the promises with specific SE errors. r=allstars.chh r=khuey
Keywords: checkin-needed
QA Whiteboard: [COM=NFC]
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S14 (12june)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: