Closed Bug 938304 Opened 11 years ago Closed 11 years ago

navigator.mozPay(): callbacks do not pass through result

Categories

(Firefox Graveyard :: Web Apps, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 30

People

(Reporter: kumar, Assigned: marco)

References

Details

Attachments

(2 files, 5 obsolete files)

STR: - Install Firefox Nightly on an Android device - Install the in-app payment tester from http://apploa.de/3b25a (manifest: http://inapp-pay-test.paas.allizom.org/manifest.webapp) - Open the tester app from the Android home screen - Edit the JWT textarea to make a simulation. Add {"simulate": {"result": "postback"}} to the request object so it looks something like: { "iss": "323d34dc-b5cf-4822-8e47-6a4515dc74db", "aud": "marketplace.firefox.com", ... "request": { ... "simulate": {"result": "postback"} } } - Scroll out of the textarea and tap Pay - When prompted to continue the simulation, tap the Cancel button Expected: The payment page will call paymentFailed('USER_CANCELLED') and that error code is available in DOMRequest.error.name. In the above STR you should see 'error: USER_CANCELLED' in the tester app. Actual: because DOMRequest.error.name is not set, you see 'error: undefined' Note that this is the behavior for paymentFailed(). In paymentSuccess(), the input variable should become the DOMRequest.result: https://developer.mozilla.org/en-US/docs/Web/API/DOMRequest.result Here is the complete callback API: https://wiki.mozilla.org/WebAPI/WebPaymentProvider#API Android callbacks originally added in bug 924693
Attached image expected.png (obsolete) (deleted) —
expected screenshot from Firefox OS
Attached image actual.png (obsolete) (deleted) —
actual screenshot from Android
Blocks: 909896
Attached patch Patch (obsolete) (deleted) — Splinter Review
I haven't tested this, but this matches b2g. The desktop winrt has this same bug though.
Attachment #832042 - Flags: review?(mark.finkle)
Attached patch desktop patch (obsolete) (deleted) — Splinter Review
This looked good on try: https://tbpl.mozilla.org/?tree=Try&rev=5f84b2f62815 but I'm not sure if these tests are running there.
Attachment #832080 - Flags: review?(mar.castelluccio)
Comment on attachment 832042 [details] [diff] [review] Patch >diff --git a/mobile/android/components/PaymentsUI.js b/mobile/android/components/PaymentsUI.js > function paymentSuccess(aRequestId) { >- return paymentCallback(aRequestId, "Payment:Success"); >+ return function(aResult) { >+ closePaymentTab(aRequestId, function() { >+ cpmm.sendAsyncMessage(aMsg, { result: aResult, Where does aMsg come from? > function paymentFailed(aRequestId) { >- return paymentCallback(aRequestId, "Payment:Failed"); >-} >- >-function paymentCallback(aRequestId, aMsg) { >- return function(aResult) { >+ return function(aErrorMsg) { > closePaymentTab(aRequestId, function() { >- cpmm.sendAsyncMessage(aMsg, { result: aResult, >+ cpmm.sendAsyncMessage(aMsg, { errorMsg: aErrorMsg, Same
Attached patch Patch (deleted) — Splinter Review
Whoops. Thanks for catching this. Tested this and seems to work fine :)
Attachment #832042 - Attachment is obsolete: true
Attachment #832042 - Flags: review?(mark.finkle)
Attachment #833120 - Flags: review?(mark.finkle)
Attachment #833120 - Flags: review?(mark.finkle) → review+
Comment on attachment 832080 [details] [diff] [review] desktop patch Review of attachment 832080 [details] [diff] [review]: ----------------------------------------------------------------- The webapprt chrome tests work in a quite different way (see the other tests for example). You should create an application manifest that specifies the launch path (that in this case would be "/webapprtChrome/webapprt/test/chrome/mozpay-failed.html"). There are a couple of syntax errors in browser_mozpay.js. These tests aren't yet run on try, so you should run them manually. You can run the tests with the webapprt-test-chrome command ("mach webapprt-test-chrome webapprt/test/chrome/browser_mozpay.js").
Attachment #832080 - Flags: review?(mar.castelluccio)
https://hg.mozilla.org/integration/fx-team/rev/7f5e40e54c11 marking leave-open for the desktop + tests bit.
Whiteboard: [leave-open]
If its being left open for Desktop, moving over to that tracking bug.
Blocks: 969539
No longer blocks: 909896
I would prefer to track the desktop work in a separate bug, but in any case we should move this to the desktop product/component now that the only remaining work is for desktop.
OS: Android → All
Product: Firefox for Android → Firefox
QA Contact: aaron.train
Attached patch Patch (obsolete) (deleted) — Splinter Review
Assignee: nobody → mar.castelluccio
Attachment #831741 - Attachment is obsolete: true
Attachment #831742 - Attachment is obsolete: true
Attachment #832080 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8390001 - Flags: review?(ferjmoreno)
Attachment #833120 - Flags: checkin+
Comment on attachment 8390001 [details] [diff] [review] Patch Review of attachment 8390001 [details] [diff] [review]: ----------------------------------------------------------------- ::: webapprt/PaymentUIGlue.js @@ +25,5 @@ > function paymentFailed(aRequestId) { > + return function(aErrorMsg) { > + closePaymentWindow(aRequestId, function() { > + cpmm.sendAsyncMessage("Payment:Failed", { requestId: aRequestId, > + errorMsg: aErrorMsg }); nit: align errorMsg with requestId
Attachment #8390001 - Flags: review?(ferjmoreno) → review+
Attached patch Patch (deleted) — Splinter Review
Attachment #8390001 - Attachment is obsolete: true
Attachment #8392151 - Flags: review+
Keywords: checkin-needed
Whiteboard: [leave-open]
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 30
QA Whiteboard: [qa-]
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: