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)
Firefox Graveyard
Web Apps
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 30
People
(Reporter: kumar, Assigned: marco)
References
Details
Attachments
(2 files, 5 obsolete files)
(deleted),
patch
|
mfinkle
:
review+
marco
:
checkin+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
marco
:
review+
|
Details | Diff | Splinter Review |
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
Reporter | ||
Comment 1•11 years ago
|
||
expected screenshot from Firefox OS
Reporter | ||
Comment 2•11 years ago
|
||
actual screenshot from Android
Comment 3•11 years ago
|
||
I haven't tested this, but this matches b2g. The desktop winrt has this same bug though.
Attachment #832042 -
Flags: review?(mark.finkle)
Comment 4•11 years ago
|
||
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 5•11 years ago
|
||
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
Comment 6•11 years ago
|
||
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)
Updated•11 years ago
|
Attachment #833120 -
Flags: review?(mark.finkle) → review+
Assignee | ||
Comment 7•11 years ago
|
||
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)
Comment 8•11 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/7f5e40e54c11
marking leave-open for the desktop + tests bit.
Whiteboard: [leave-open]
Comment 10•11 years ago
|
||
If its being left open for Desktop, moving over to that tracking bug.
Comment 11•11 years ago
|
||
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
Assignee | ||
Comment 12•11 years ago
|
||
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)
Assignee | ||
Updated•11 years ago
|
Attachment #833120 -
Flags: checkin+
Comment 13•11 years ago
|
||
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+
Assignee | ||
Comment 14•11 years ago
|
||
Attachment #8390001 -
Attachment is obsolete: true
Attachment #8392151 -
Flags: review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Whiteboard: [leave-open]
Comment 15•11 years ago
|
||
Comment 16•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 30
Updated•11 years ago
|
QA Whiteboard: [qa-]
Updated•9 years ago
|
Product: Firefox → Firefox Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•