From 1d3013a6f8ab7f7855ecf43ad2e9abd929a2821d Mon Sep 17 00:00:00 2001 From: Fedor Date: Mon, 30 Oct 2023 22:47:59 +0200 Subject: [PATCH] Remove payments --- .eslintignore | 2 - .eslintrc.js | 1 - .../static/browser_all_files_referenced.js | 3 - .../test/static/browser_parsable_script.js | 7 - browser/components/moz.build | 1 - browser/components/payments/.eslintrc.js | 65 - .../components/payments/PaymentUIService.jsm | 352 ----- browser/components/payments/components.conf | 12 - .../content/paymentDialogFrameScript.js | 181 --- .../payments/content/paymentDialogWrapper.js | 926 ------------- browser/components/payments/docs/index.rst | 110 -- browser/components/payments/jar.mn | 26 - browser/components/payments/moz.build | 34 - .../components/payments/res/PaymentsStore.js | 97 -- .../res/components/accepted-cards.css | 104 -- .../payments/res/components/accepted-cards.js | 75 - .../res/components/address-option.css | 29 - .../payments/res/components/address-option.js | 159 --- .../res/components/basic-card-option.css | 40 - .../res/components/basic-card-option.js | 89 -- .../payments/res/components/card-icon.svg | 6 - .../payments/res/components/csc-input.js | 112 -- .../res/components/currency-amount.js | 63 - .../res/components/labelled-checkbox.js | 59 - .../res/components/payment-details-item.css | 8 - .../res/components/payment-details-item.js | 47 - .../res/components/payment-request-page.js | 36 - .../payments/res/components/rich-option.js | 26 - .../payments/res/components/rich-select.css | 58 - .../payments/res/components/rich-select.js | 104 -- .../res/components/shipping-option.css | 16 - .../res/components/shipping-option.js | 65 - .../payments/res/containers/address-form.css | 55 - .../payments/res/containers/address-form.js | 447 ------ .../payments/res/containers/address-picker.js | 282 ---- .../res/containers/basic-card-form.css | 43 - .../res/containers/basic-card-form.js | 507 ------- .../res/containers/billing-address-picker.js | 33 - .../res/containers/completion-error-page.js | 114 -- .../res/containers/cvv-hint-image-back.svg | 27 - .../res/containers/cvv-hint-image-front.svg | 25 - .../payments/res/containers/error-page.css | 38 - .../payments/res/containers/order-details.css | 51 - .../payments/res/containers/order-details.js | 143 -- .../payments/res/containers/payment-dialog.js | 593 -------- .../res/containers/payment-method-picker.js | 199 --- .../payments/res/containers/rich-picker.css | 83 -- .../payments/res/containers/rich-picker.js | 114 -- .../res/containers/shipping-option-picker.js | 72 - .../payments/res/containers/timeout.svg | 84 -- .../payments/res/containers/warning.svg | 32 - browser/components/payments/res/debugging.css | 35 - .../components/payments/res/debugging.html | 75 - browser/components/payments/res/debugging.js | 664 --------- .../payments/res/mixins/HandleEventMixin.js | 28 - .../res/mixins/ObservedPropertiesMixin.js | 71 - .../res/mixins/PaymentStateSubscriberMixin.js | 112 -- .../payments/res/paymentRequest.css | 265 ---- .../components/payments/res/paymentRequest.js | 356 ----- .../payments/res/paymentRequest.xhtml | 303 ---- .../payments/res/unprivileged-fallbacks.js | 159 --- browser/components/payments/server.py | 20 - .../payments/test/PaymentTestUtils.jsm | 612 -------- .../payments/test/browser/blank_page.html | 10 - .../payments/test/browser/browser.ini | 34 - .../test/browser/browser_address_edit.js | 1023 -------------- .../browser_address_edit_hidden_fields.js | 473 ------- .../test/browser/browser_card_edit.js | 1225 ---------------- .../test/browser/browser_change_shipping.js | 712 ---------- .../test/browser/browser_dropdowns.js | 82 -- .../test/browser/browser_host_name.js | 50 - .../test/browser/browser_onboarding_wizard.js | 859 ------------ .../test/browser/browser_openPreferences.js | 93 -- .../browser/browser_payerRequestedFields.js | 154 -- .../browser/browser_payment_completion.js | 211 --- .../test/browser/browser_profile_storage.js | 303 ---- .../browser/browser_request_serialization.js | 250 ---- .../test/browser/browser_request_shipping.js | 121 -- .../payments/test/browser/browser_retry.js | 167 --- .../test/browser/browser_retry_fieldErrors.js | 862 ------------ .../browser_shippingaddresschange_error.js | 430 ------ .../test/browser/browser_show_dialog.js | 396 ------ .../test/browser/browser_tab_modal.js | 300 ---- .../payments/test/browser/browser_total.js | 94 -- .../components/payments/test/browser/head.js | 969 ------------- .../test/mochitest/formautofill/mochitest.ini | 10 - .../formautofill/test_editCreditCard.html | 34 - .../payments/test/mochitest/mochitest.ini | 37 - .../test/mochitest/payments_common.js | 154 -- .../test_ObservedPropertiesMixin.html | 116 -- .../test_PaymentStateSubscriberMixin.html | 79 -- .../test/mochitest/test_PaymentsStore.html | 168 --- .../test/mochitest/test_accepted_cards.html | 111 -- .../test/mochitest/test_address_form.html | 955 ------------- .../test/mochitest/test_address_option.html | 177 --- .../test/mochitest/test_address_picker.html | 278 ---- .../test/mochitest/test_basic_card_form.html | 625 --------- .../mochitest/test_basic_card_option.html | 96 -- .../test_billing_address_picker.html | 132 -- .../mochitest/test_completion_error_page.html | 88 -- .../test/mochitest/test_currency_amount.html | 160 --- .../mochitest/test_labelled_checkbox.html | 71 - .../test/mochitest/test_order_details.html | 215 --- .../mochitest/test_payer_address_picker.html | 323 ----- .../mochitest/test_payment_details_item.html | 65 - .../test/mochitest/test_payment_dialog.html | 360 ----- ...yment_dialog_required_top_level_items.html | 254 ---- .../mochitest/test_payment_method_picker.html | 279 ---- .../test/mochitest/test_rich_select.html | 150 -- .../test_shipping_option_picker.html | 180 --- browser/components/payments/test/unit/head.js | 2 - .../test/unit/test_response_creation.js | 149 -- .../payments/test/unit/xpcshell.ini | 6 - browser/installer/allowed-dupes.mn | 7 - dom/base/Document.cpp | 22 - dom/base/Document.h | 15 - dom/base/nsFrameLoader.cpp | 8 - dom/html/HTMLIFrameElement.cpp | 7 +- dom/html/HTMLIFrameElement.h | 6 - dom/interfaces/payments/moz.build | 13 - .../payments/nsIPaymentActionResponse.idl | 405 ------ dom/interfaces/payments/nsIPaymentAddress.idl | 42 - dom/interfaces/payments/nsIPaymentRequest.idl | 92 -- .../payments/nsIPaymentRequestService.idl | 101 -- .../payments/nsIPaymentUIService.idl | 84 -- dom/ipc/BrowserChild.cpp | 12 - dom/ipc/BrowserChild.h | 4 - dom/ipc/BrowserParent.cpp | 13 - dom/ipc/BrowserParent.h | 4 - dom/ipc/PBrowser.ipdl | 4 - dom/moz.build | 2 - dom/payments/BasicCardPayment.cpp | 126 -- dom/payments/BasicCardPayment.h | 37 - dom/payments/MerchantValidationEvent.cpp | 173 --- dom/payments/MerchantValidationEvent.h | 71 - dom/payments/PaymentActionResponse.cpp | 420 ------ dom/payments/PaymentActionResponse.h | 190 --- dom/payments/PaymentAddress.cpp | 87 -- dom/payments/PaymentAddress.h | 76 - dom/payments/PaymentMethodChangeEvent.cpp | 165 --- dom/payments/PaymentMethodChangeEvent.h | 57 - dom/payments/PaymentRequest.cpp | 1233 ----------------- dom/payments/PaymentRequest.h | 274 ---- dom/payments/PaymentRequestData.cpp | 807 ----------- dom/payments/PaymentRequestData.h | 259 ---- dom/payments/PaymentRequestManager.cpp | 722 ---------- dom/payments/PaymentRequestManager.h | 98 -- dom/payments/PaymentRequestService.cpp | 601 -------- dom/payments/PaymentRequestService.h | 61 - dom/payments/PaymentRequestUpdateEvent.cpp | 145 -- dom/payments/PaymentRequestUpdateEvent.h | 59 - dom/payments/PaymentRequestUtils.cpp | 61 - dom/payments/PaymentRequestUtils.h | 28 - dom/payments/PaymentResponse.cpp | 454 ------ dom/payments/PaymentResponse.h | 179 --- dom/payments/components.conf | 78 -- dom/payments/ipc/PPaymentRequest.ipdl | 250 ---- dom/payments/ipc/PaymentRequestChild.cpp | 140 -- dom/payments/ipc/PaymentRequestChild.h | 57 - dom/payments/ipc/PaymentRequestParent.cpp | 468 ------- dom/payments/ipc/PaymentRequestParent.h | 58 - dom/payments/ipc/moz.build | 21 - dom/payments/moz.build | 51 - dom/payments/test/.eslintrc.js | 8 - .../test/BasicCardErrorsChromeScript.js | 129 -- dom/payments/test/BasiccardChromeScript.js | 370 ----- dom/payments/test/Bug1478740ChromeScript.js | 86 -- dom/payments/test/Bug1490698ChromeScript.js | 246 ---- dom/payments/test/ClosePaymentChromeScript.js | 156 --- dom/payments/test/ConstructorChromeScript.js | 486 ------- .../CurrencyAmountValidationChromeScript.js | 63 - dom/payments/test/DefaultData.js | 59 - dom/payments/test/GeneralChromeScript.js | 16 - .../test/PMIValidationChromeScript.js | 78 -- dom/payments/test/PayerDetailsChromeScript.js | 79 -- .../test/RequestShippingChromeScript.js | 112 -- dom/payments/test/RetryPaymentChromeScript.js | 234 ---- .../test/ShippingOptionsChromeScript.js | 116 -- dom/payments/test/ShowPaymentChromeScript.js | 389 ------ dom/payments/test/UpdateErrorsChromeScript.js | 210 --- dom/payments/test/blank_page.html | 16 - dom/payments/test/browser.ini | 10 - .../test/browser_payment_in_different_tabs.js | 37 - dom/payments/test/bug1478740.html | 44 - dom/payments/test/echo_payment_request.html | 37 - dom/payments/test/head.js | 127 -- dom/payments/test/mochitest.ini | 55 - dom/payments/test/simple_payment_request.html | 81 -- dom/payments/test/test_abortPayment.html | 95 -- dom/payments/test/test_basiccard.html | 401 ------ dom/payments/test/test_basiccarderrors.html | 85 -- dom/payments/test/test_block_none10s.html | 58 - dom/payments/test/test_bug1478740.html | 139 -- dom/payments/test/test_bug1490698.html | 119 -- dom/payments/test/test_canMakePayment.html | 167 --- dom/payments/test/test_closePayment.html | 283 ---- dom/payments/test/test_constructor.html | 351 ----- .../test/test_currency_amount_validation.html | 353 ----- dom/payments/test/test_payerDetails.html | 107 -- .../test/test_payment-request-in-iframe.html | 168 --- dom/payments/test/test_pmi_validation.html | 245 ---- dom/payments/test/test_requestShipping.html | 180 --- dom/payments/test/test_retryPayment.html | 354 ----- dom/payments/test/test_shippingOptions.html | 208 --- dom/payments/test/test_showPayment.html | 520 ------- dom/payments/test/test_update_errors.html | 121 -- .../featurepolicy/FeaturePolicyUtils.cpp | 1 - .../test/mochitest/test_featureList.html | 1 - .../mochitest/general/test_interfaces.js | 45 - dom/webidl/BasicCardPayment.webidl | 38 - dom/webidl/HTMLIFrameElement.webidl | 2 - dom/webidl/MerchantValidationEvent.webidl | 30 - dom/webidl/PaymentAddress.webidl | 32 - dom/webidl/PaymentMethodChangeEvent.webidl | 26 - dom/webidl/PaymentRequest.webidl | 131 -- dom/webidl/PaymentRequestUpdateEvent.webidl | 24 - dom/webidl/PaymentResponse.webidl | 41 - dom/webidl/moz.build | 7 - modules/libpref/init/StaticPrefList.yaml | 19 - modules/libpref/init/all.js | 6 - remote/Protocol.jsm | 1 - .../meta/feature-policy/__dir__.ini | 2 +- ...ribute-redirect-on-load.https.sub.html.ini | 27 - ...eature-policy-attribute.https.sub.html.ini | 10 - ...lowed-by-feature-policy.https.sub.html.ini | 22 - ...-default-feature-policy.https.sub.html.ini | 19 - ...abled-by-feature-policy.https.sub.html.ini | 7 - ...orted-by-feature-policy.tentative.html.ini | 3 - .../payment-report-only.https.html.ini | 5 - .../payment-reporting.https.html.ini | 7 - .../meta/payment-handler/__dir__.ini | 4 - ...t-constructor.https.serviceworker.html.ini | 13 - ...ment-event-constructor.https.worker.js.ini | 13 - .../can-make-payment-event.https.html.ini | 32 - .../idlharness.https.any.js.ini | 559 -------- .../payment-instruments.https.html.ini | 52 - ...t-constructor.https.serviceworker.html.ini | 13 - .../payment-request-event.https.html.ini | 3 - .../same-object-attributes.https.html.ini | 4 - .../untrusted-event.https.html.ini | 5 - .../payment-method-basic-card/__dir__.ini | 2 - .../apply_the_modifiers.html.ini | 2 - .../historical.https.html.ini | 6 - ...quest-canmakepayment-method.https.html.ini | 28 - ...for_selecting_the_payment_handler.html.ini | 2 - .../meta/payment-method-id/__dir__.ini | 2 - ...t-request-ctor-pmi-handling.https.html.ini | 16 - .../complete-method.https.html.ini | 5 - .../constructor.https.html.ini | 45 - .../methodDetails-attribute.https.html.ini | 9 - .../methodName-attribute.https.html.ini | 9 - .../constructor.https.html.ini | 13 - .../updatewith-method.https.html.ini | 13 - .../meta/payment-request/__dir__.ini | 2 - ...e-document-cross-origin.https.sub.html.ini | 5 - ...active-document-same-origin.https.html.ini | 5 - ...-cross-origin-bc-containers.https.html.ini | 18 - ...e-same-origin-bc-containers.https.html.ini | 2 - .../allowpaymentrequest/basic.https.html.ini | 5 - ...-cross-origin-bc-containers.https.html.ini | 17 - ...e-same-origin-bc-containers.https.html.ini | 2 - ...ing-allowpaymentrequest.https.sub.html.ini | 4 - ...owpaymentrequest-timing.https.sub.html.ini | 4 - ...ing-allowpaymentrequest.https.sub.html.ini | 4 - ...tructor_convert_method_data.https.html.ini | 16 - .../payment-request/historical.https.html.ini | 36 - .../idlharness.https.window.js.ini | 435 ------ .../payment-request/interfaces.https.html.ini | 551 -------- ...erchantvalidation-attribute.https.html.ini | 17 - ...mentmenthodchange-attribute.https.html.ini | 17 - .../payment-is-showing.https.html.ini | 62 - ...ayment-request-abort-method.https.html.ini | 24 - ...kepayment-method-protection.https.html.ini | 6 - ...quest-canmakepayment-method.https.html.ini | 43 - ...t-request-constructor-crash.https.html.ini | 49 - ...payment-request-constructor.https.html.ini | 613 -------- ...t-ctor-currency-code-checks.https.html.ini | 41 - ...t-request-ctor-pmi-handling.https.html.ini | 21 - ...method-protection.tentative.https.html.ini | 4 - ...instrument-method.tentative.https.html.ini | 10 - ...ayment-request-id-attribute.https.html.ini | 13 - ...pingaddresschange-attribute.https.html.ini | 17 - ...ppingoptionchange-attribute.https.html.ini | 17 - ...t-shippingAddress-attribute.https.html.ini | 9 - ...st-shippingOption-attribute.https.html.ini | 25 - ...uest-shippingType-attribute.https.html.ini | 13 - ...payment-request-show-method.https.html.ini | 21 - ...payerdetailchange-attribute.https.html.ini | 9 - .../rejects_if_not_active.https.html.ini | 2 - ...ejects_if_not_active_manual.https.html.ini | 2 - testing/web-platform/moz.build | 15 - ...-attribute-redirect-on-load.https.sub.html | 39 - ...by-feature-policy-attribute.https.sub.html | 26 - ...t-allowed-by-feature-policy.https.sub.html | 47 - ...d-by-feature-policy.https.sub.html.headers | 1 - ...ment-default-feature-policy.https.sub.html | 47 - ...-disabled-by-feature-policy.https.sub.html | 45 - ...d-by-feature-policy.https.sub.html.headers | 1 - ...supported-by-feature-policy.tentative.html | 11 - .../reporting/payment-report-only.https.html | 37 - .../payment-report-only.https.html.headers | 1 - .../reporting/payment-reporting.https.html | 35 - .../payment-reporting.https.html.headers | 1 - .../tests/interfaces/payment-handler.idl | 96 -- .../interfaces/payment-method-basic-card.idl | 30 - .../tests/interfaces/payment-request.idl | 201 --- .../tests/payment-handler/META.yml | 4 - .../payment-handler/app-can-make-payment.js | 114 -- .../tests/payment-handler/basic-card.js | 93 -- .../tests/payment-handler/basic-card.json | 10 - ...-make-payment-event-constructor.https.html | 14 - ...event-constructor.https.serviceworker.html | 13 - ...t-event-constructor.https.serviceworker.js | 45 - ...-payment-event-constructor.https.worker.js | 7 - .../can-make-payment-event.https.html | 379 ----- .../payment-handler/idlharness.https.any.js | 46 - .../tests/payment-handler/manifest.json | 10 - .../payment-handler/payment-app/payment.html | 5 - .../payment-instruments.https.html | 354 ----- ...yment-request-event-constructor.https.html | 14 - ...event-constructor.https.serviceworker.html | 13 - ...t-event-constructor.https.serviceworker.js | 45 - ...-request-event-constructor.https.worker.js | 7 - .../payment-request-event.https.html | 104 -- .../register-and-activate-service-worker.js | 28 - .../same-object-attributes.https.html | 19 - .../untrusted-event.https.html | 56 - .../tests/payment-handler/untrusted-event.js | 59 - .../tests/payment-method-basic-card/META.yml | 5 - .../apply_the_modifiers.html | 152 -- .../empty-data-manual.https.html | 133 -- .../historical.https.html | 25 - .../idlharness.window.js | 12 - ...t-request-canmakepayment-method.https.html | 89 -- ...eps_for_selecting_the_payment_handler.html | 110 -- .../tests/payment-method-id/META.yml | 3 - .../tests/payment-method-id/README.md | 4 - ...yment-request-ctor-pmi-handling.https.html | 149 -- .../tests/payment-request/META.yml | 8 - .../complete-method.https.html | 15 - .../constructor.http.html | 11 - .../constructor.https.html | 147 -- ...ibutes-and-toJSON-method-manual.https.html | 108 -- .../methodDetails-attribute.https.html | 33 - .../methodName-attribute.https.html | 28 - .../constructor.http.html | 12 - .../constructor.https.html | 62 - ...pdateWith-call-immediate-manual.https.html | 206 --- ...plicate-shipping-options-manual.https.html | 106 -- ...eWith-incremental-update-manual.https.html | 196 --- ...With-method-abort-update-manual.https.html | 280 ---- .../updateWith-state-checks-manual.https.html | 125 -- .../updatewith-method.https.html | 76 - ...retry-shows-error-member-manual.https.html | 50 - ...retry-shows-payer-member-manual.https.html | 65 - ...s-shippingAddress-member-manual.https.html | 98 -- .../algorithms-manual.https.html | 176 --- ...ctive-document-cross-origin.https.sub.html | 26 - .../active-document-same-origin.https.html | 22 - ...bute-cross-origin-bc-containers.https.html | 11 - ...ibute-same-origin-bc-containers.https.html | 11 - .../allowpaymentrequest/basic.https.html | 14 - .../allowpaymentrequest/common.sub.js | 61 - .../echo-PaymentRequest.html | 25 - ...bute-cross-origin-bc-containers.https.html | 11 - ...ibute-same-origin-bc-containers.https.html | 11 - ...emoving-allowpaymentrequest.https.sub.html | 62 - ...-allowpaymentrequest-timing.https.sub.html | 36 - ...setting-allowpaymentrequest.https.sub.html | 38 - .../billing-address-changed-manual.https.html | 115 -- .../tests/payment-request/blank.html | 1 - .../change-shipping-option-manual.https.html | 104 -- ...pping-option-select-last-manual.https.html | 101 -- ...constructor_convert_method_data.https.html | 73 - .../payment-request/historical.https.html | 44 - .../idlharness.https.window.js | 31 - .../payment-request/interfaces.https.html | 32 - .../onmerchantvalidation-attribute.https.html | 78 -- ...npaymentmenthodchange-attribute.https.html | 79 -- .../payment-is-showing.https.html | 380 ----- .../payment-request-abort-method.https.html | 94 -- ...anmakepayment-method-protection.https.html | 65 - ...t-request-canmakepayment-method.https.html | 120 -- ...yment-request-constructor-crash.https.html | 272 ---- .../payment-request-constructor.https.html | 684 --------- ...quest-ctor-currency-code-checks.https.html | 339 ----- ...yment-request-ctor-pmi-handling.https.html | 149 -- ...trument-method-manual.tentative.https.html | 95 -- ...ent-method-protection.tentative.https.html | 68 - ...lledinstrument-method.tentative.https.html | 75 - .../payment-request-id-attribute.https.html | 39 - .../payment-request-insecure.http.html | 13 - ...ayment-request-not-exposed.https.worker.js | 7 - ...shippingaddresschange-attribute.https.html | 78 -- ...nshippingoptionchange-attribute.https.html | 79 -- ...quest-shippingAddress-attribute.https.html | 28 - ...equest-shippingOption-attribute.https.html | 100 -- ...-request-shippingType-attribute.https.html | 72 - .../payment-request-show-method.https.html | 116 -- .../complete-method-manual.https.html | 101 -- .../payment-response/helpers.js | 150 -- .../methodName-attribute-manual.https.html | 28 - ...erdetailchange-attribute-manual.https.html | 73 - .../onpayerdetailchange-attribute.https.html | 14 - .../payerEmail-attribute-manual.https.html | 48 - .../payerName-attribute-manual.https.html | 48 - .../payerPhone-attribute-manual.https.html | 48 - .../rejects_if_not_active-manual.https.html | 160 --- .../requestId-attribute-manual.https.html | 34 - .../retry-method-manual.https.html | 296 ---- .../retry-method-warnings-manual.https.html | 158 --- ...hippingAddress-attribute-manual.https.html | 101 -- ...shippingOption-attribute-manual.https.html | 43 - .../rejects_if_not_active.https.html | 78 -- .../rejects_if_not_active_manual.https.html | 164 --- .../payment-request/resources/page1.html | 1 - .../payment-request/resources/page2.html | 1 - ...shipping-address-changed-manual.https.html | 95 -- ...optional-promise-rejects-manual.https.html | 288 ---- ...ptional-promise-resolves-manual.https.html | 326 ----- .../show-method-postmessage-iframe.html | 49 - .../show-method-postmessage-manual.https.html | 53 - ...With-method-pmi-handling-manual.https.html | 140 -- .../user-abort-algorithm-manual.https.html | 80 -- ...pts-payment-request-algo-manual.https.html | 230 --- toolkit/content/license.html | 38 - .../lib/environments/privileged.js | 5 - xpcom/ds/StaticAtoms.py | 1 - 428 files changed, 2 insertions(+), 52953 deletions(-) delete mode 100644 browser/components/payments/.eslintrc.js delete mode 100644 browser/components/payments/PaymentUIService.jsm delete mode 100644 browser/components/payments/components.conf delete mode 100644 browser/components/payments/content/paymentDialogFrameScript.js delete mode 100644 browser/components/payments/content/paymentDialogWrapper.js delete mode 100644 browser/components/payments/docs/index.rst delete mode 100644 browser/components/payments/jar.mn delete mode 100644 browser/components/payments/moz.build delete mode 100644 browser/components/payments/res/PaymentsStore.js delete mode 100644 browser/components/payments/res/components/accepted-cards.css delete mode 100644 browser/components/payments/res/components/accepted-cards.js delete mode 100644 browser/components/payments/res/components/address-option.css delete mode 100644 browser/components/payments/res/components/address-option.js delete mode 100644 browser/components/payments/res/components/basic-card-option.css delete mode 100644 browser/components/payments/res/components/basic-card-option.js delete mode 100644 browser/components/payments/res/components/card-icon.svg delete mode 100644 browser/components/payments/res/components/csc-input.js delete mode 100644 browser/components/payments/res/components/currency-amount.js delete mode 100644 browser/components/payments/res/components/labelled-checkbox.js delete mode 100644 browser/components/payments/res/components/payment-details-item.css delete mode 100644 browser/components/payments/res/components/payment-details-item.js delete mode 100644 browser/components/payments/res/components/payment-request-page.js delete mode 100644 browser/components/payments/res/components/rich-option.js delete mode 100644 browser/components/payments/res/components/rich-select.css delete mode 100644 browser/components/payments/res/components/rich-select.js delete mode 100644 browser/components/payments/res/components/shipping-option.css delete mode 100644 browser/components/payments/res/components/shipping-option.js delete mode 100644 browser/components/payments/res/containers/address-form.css delete mode 100644 browser/components/payments/res/containers/address-form.js delete mode 100644 browser/components/payments/res/containers/address-picker.js delete mode 100644 browser/components/payments/res/containers/basic-card-form.css delete mode 100644 browser/components/payments/res/containers/basic-card-form.js delete mode 100644 browser/components/payments/res/containers/billing-address-picker.js delete mode 100644 browser/components/payments/res/containers/completion-error-page.js delete mode 100644 browser/components/payments/res/containers/cvv-hint-image-back.svg delete mode 100644 browser/components/payments/res/containers/cvv-hint-image-front.svg delete mode 100644 browser/components/payments/res/containers/error-page.css delete mode 100644 browser/components/payments/res/containers/order-details.css delete mode 100644 browser/components/payments/res/containers/order-details.js delete mode 100644 browser/components/payments/res/containers/payment-dialog.js delete mode 100644 browser/components/payments/res/containers/payment-method-picker.js delete mode 100644 browser/components/payments/res/containers/rich-picker.css delete mode 100644 browser/components/payments/res/containers/rich-picker.js delete mode 100644 browser/components/payments/res/containers/shipping-option-picker.js delete mode 100644 browser/components/payments/res/containers/timeout.svg delete mode 100644 browser/components/payments/res/containers/warning.svg delete mode 100644 browser/components/payments/res/debugging.css delete mode 100644 browser/components/payments/res/debugging.html delete mode 100644 browser/components/payments/res/debugging.js delete mode 100644 browser/components/payments/res/mixins/HandleEventMixin.js delete mode 100644 browser/components/payments/res/mixins/ObservedPropertiesMixin.js delete mode 100644 browser/components/payments/res/mixins/PaymentStateSubscriberMixin.js delete mode 100644 browser/components/payments/res/paymentRequest.css delete mode 100644 browser/components/payments/res/paymentRequest.js delete mode 100644 browser/components/payments/res/paymentRequest.xhtml delete mode 100644 browser/components/payments/res/unprivileged-fallbacks.js delete mode 100644 browser/components/payments/server.py delete mode 100644 browser/components/payments/test/PaymentTestUtils.jsm delete mode 100644 browser/components/payments/test/browser/blank_page.html delete mode 100644 browser/components/payments/test/browser/browser.ini delete mode 100644 browser/components/payments/test/browser/browser_address_edit.js delete mode 100644 browser/components/payments/test/browser/browser_address_edit_hidden_fields.js delete mode 100644 browser/components/payments/test/browser/browser_card_edit.js delete mode 100644 browser/components/payments/test/browser/browser_change_shipping.js delete mode 100644 browser/components/payments/test/browser/browser_dropdowns.js delete mode 100644 browser/components/payments/test/browser/browser_host_name.js delete mode 100644 browser/components/payments/test/browser/browser_onboarding_wizard.js delete mode 100644 browser/components/payments/test/browser/browser_openPreferences.js delete mode 100644 browser/components/payments/test/browser/browser_payerRequestedFields.js delete mode 100644 browser/components/payments/test/browser/browser_payment_completion.js delete mode 100644 browser/components/payments/test/browser/browser_profile_storage.js delete mode 100644 browser/components/payments/test/browser/browser_request_serialization.js delete mode 100644 browser/components/payments/test/browser/browser_request_shipping.js delete mode 100644 browser/components/payments/test/browser/browser_retry.js delete mode 100644 browser/components/payments/test/browser/browser_retry_fieldErrors.js delete mode 100644 browser/components/payments/test/browser/browser_shippingaddresschange_error.js delete mode 100644 browser/components/payments/test/browser/browser_show_dialog.js delete mode 100644 browser/components/payments/test/browser/browser_tab_modal.js delete mode 100644 browser/components/payments/test/browser/browser_total.js delete mode 100644 browser/components/payments/test/browser/head.js delete mode 100644 browser/components/payments/test/mochitest/formautofill/mochitest.ini delete mode 100644 browser/components/payments/test/mochitest/formautofill/test_editCreditCard.html delete mode 100644 browser/components/payments/test/mochitest/mochitest.ini delete mode 100644 browser/components/payments/test/mochitest/payments_common.js delete mode 100644 browser/components/payments/test/mochitest/test_ObservedPropertiesMixin.html delete mode 100644 browser/components/payments/test/mochitest/test_PaymentStateSubscriberMixin.html delete mode 100644 browser/components/payments/test/mochitest/test_PaymentsStore.html delete mode 100644 browser/components/payments/test/mochitest/test_accepted_cards.html delete mode 100644 browser/components/payments/test/mochitest/test_address_form.html delete mode 100644 browser/components/payments/test/mochitest/test_address_option.html delete mode 100644 browser/components/payments/test/mochitest/test_address_picker.html delete mode 100644 browser/components/payments/test/mochitest/test_basic_card_form.html delete mode 100644 browser/components/payments/test/mochitest/test_basic_card_option.html delete mode 100644 browser/components/payments/test/mochitest/test_billing_address_picker.html delete mode 100644 browser/components/payments/test/mochitest/test_completion_error_page.html delete mode 100644 browser/components/payments/test/mochitest/test_currency_amount.html delete mode 100644 browser/components/payments/test/mochitest/test_labelled_checkbox.html delete mode 100644 browser/components/payments/test/mochitest/test_order_details.html delete mode 100644 browser/components/payments/test/mochitest/test_payer_address_picker.html delete mode 100644 browser/components/payments/test/mochitest/test_payment_details_item.html delete mode 100644 browser/components/payments/test/mochitest/test_payment_dialog.html delete mode 100644 browser/components/payments/test/mochitest/test_payment_dialog_required_top_level_items.html delete mode 100644 browser/components/payments/test/mochitest/test_payment_method_picker.html delete mode 100644 browser/components/payments/test/mochitest/test_rich_select.html delete mode 100644 browser/components/payments/test/mochitest/test_shipping_option_picker.html delete mode 100644 browser/components/payments/test/unit/head.js delete mode 100644 browser/components/payments/test/unit/test_response_creation.js delete mode 100644 browser/components/payments/test/unit/xpcshell.ini delete mode 100644 dom/interfaces/payments/moz.build delete mode 100644 dom/interfaces/payments/nsIPaymentActionResponse.idl delete mode 100644 dom/interfaces/payments/nsIPaymentAddress.idl delete mode 100644 dom/interfaces/payments/nsIPaymentRequest.idl delete mode 100644 dom/interfaces/payments/nsIPaymentRequestService.idl delete mode 100644 dom/interfaces/payments/nsIPaymentUIService.idl delete mode 100644 dom/payments/BasicCardPayment.cpp delete mode 100644 dom/payments/BasicCardPayment.h delete mode 100644 dom/payments/MerchantValidationEvent.cpp delete mode 100644 dom/payments/MerchantValidationEvent.h delete mode 100644 dom/payments/PaymentActionResponse.cpp delete mode 100644 dom/payments/PaymentActionResponse.h delete mode 100644 dom/payments/PaymentAddress.cpp delete mode 100644 dom/payments/PaymentAddress.h delete mode 100644 dom/payments/PaymentMethodChangeEvent.cpp delete mode 100644 dom/payments/PaymentMethodChangeEvent.h delete mode 100644 dom/payments/PaymentRequest.cpp delete mode 100644 dom/payments/PaymentRequest.h delete mode 100644 dom/payments/PaymentRequestData.cpp delete mode 100644 dom/payments/PaymentRequestData.h delete mode 100644 dom/payments/PaymentRequestManager.cpp delete mode 100644 dom/payments/PaymentRequestManager.h delete mode 100644 dom/payments/PaymentRequestService.cpp delete mode 100644 dom/payments/PaymentRequestService.h delete mode 100644 dom/payments/PaymentRequestUpdateEvent.cpp delete mode 100644 dom/payments/PaymentRequestUpdateEvent.h delete mode 100644 dom/payments/PaymentRequestUtils.cpp delete mode 100644 dom/payments/PaymentRequestUtils.h delete mode 100644 dom/payments/PaymentResponse.cpp delete mode 100644 dom/payments/PaymentResponse.h delete mode 100644 dom/payments/components.conf delete mode 100644 dom/payments/ipc/PPaymentRequest.ipdl delete mode 100644 dom/payments/ipc/PaymentRequestChild.cpp delete mode 100644 dom/payments/ipc/PaymentRequestChild.h delete mode 100644 dom/payments/ipc/PaymentRequestParent.cpp delete mode 100644 dom/payments/ipc/PaymentRequestParent.h delete mode 100644 dom/payments/ipc/moz.build delete mode 100644 dom/payments/moz.build delete mode 100644 dom/payments/test/.eslintrc.js delete mode 100644 dom/payments/test/BasicCardErrorsChromeScript.js delete mode 100644 dom/payments/test/BasiccardChromeScript.js delete mode 100644 dom/payments/test/Bug1478740ChromeScript.js delete mode 100644 dom/payments/test/Bug1490698ChromeScript.js delete mode 100644 dom/payments/test/ClosePaymentChromeScript.js delete mode 100644 dom/payments/test/ConstructorChromeScript.js delete mode 100644 dom/payments/test/CurrencyAmountValidationChromeScript.js delete mode 100644 dom/payments/test/DefaultData.js delete mode 100644 dom/payments/test/GeneralChromeScript.js delete mode 100644 dom/payments/test/PMIValidationChromeScript.js delete mode 100644 dom/payments/test/PayerDetailsChromeScript.js delete mode 100644 dom/payments/test/RequestShippingChromeScript.js delete mode 100644 dom/payments/test/RetryPaymentChromeScript.js delete mode 100644 dom/payments/test/ShippingOptionsChromeScript.js delete mode 100644 dom/payments/test/ShowPaymentChromeScript.js delete mode 100644 dom/payments/test/UpdateErrorsChromeScript.js delete mode 100644 dom/payments/test/blank_page.html delete mode 100644 dom/payments/test/browser.ini delete mode 100644 dom/payments/test/browser_payment_in_different_tabs.js delete mode 100644 dom/payments/test/bug1478740.html delete mode 100644 dom/payments/test/echo_payment_request.html delete mode 100644 dom/payments/test/head.js delete mode 100644 dom/payments/test/mochitest.ini delete mode 100644 dom/payments/test/simple_payment_request.html delete mode 100644 dom/payments/test/test_abortPayment.html delete mode 100644 dom/payments/test/test_basiccard.html delete mode 100644 dom/payments/test/test_basiccarderrors.html delete mode 100644 dom/payments/test/test_block_none10s.html delete mode 100644 dom/payments/test/test_bug1478740.html delete mode 100644 dom/payments/test/test_bug1490698.html delete mode 100644 dom/payments/test/test_canMakePayment.html delete mode 100644 dom/payments/test/test_closePayment.html delete mode 100644 dom/payments/test/test_constructor.html delete mode 100644 dom/payments/test/test_currency_amount_validation.html delete mode 100644 dom/payments/test/test_payerDetails.html delete mode 100644 dom/payments/test/test_payment-request-in-iframe.html delete mode 100644 dom/payments/test/test_pmi_validation.html delete mode 100644 dom/payments/test/test_requestShipping.html delete mode 100644 dom/payments/test/test_retryPayment.html delete mode 100644 dom/payments/test/test_shippingOptions.html delete mode 100644 dom/payments/test/test_showPayment.html delete mode 100644 dom/payments/test/test_update_errors.html delete mode 100644 dom/webidl/BasicCardPayment.webidl delete mode 100644 dom/webidl/MerchantValidationEvent.webidl delete mode 100644 dom/webidl/PaymentAddress.webidl delete mode 100644 dom/webidl/PaymentMethodChangeEvent.webidl delete mode 100644 dom/webidl/PaymentRequest.webidl delete mode 100644 dom/webidl/PaymentRequestUpdateEvent.webidl delete mode 100644 dom/webidl/PaymentResponse.webidl delete mode 100644 testing/web-platform/meta/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html.ini delete mode 100644 testing/web-platform/meta/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html.ini delete mode 100644 testing/web-platform/meta/feature-policy/payment-allowed-by-feature-policy.https.sub.html.ini delete mode 100644 testing/web-platform/meta/feature-policy/payment-default-feature-policy.https.sub.html.ini delete mode 100644 testing/web-platform/meta/feature-policy/payment-disabled-by-feature-policy.https.sub.html.ini delete mode 100644 testing/web-platform/meta/feature-policy/payment-supported-by-feature-policy.tentative.html.ini delete mode 100644 testing/web-platform/meta/feature-policy/reporting/payment-report-only.https.html.ini delete mode 100644 testing/web-platform/meta/feature-policy/reporting/payment-reporting.https.html.ini delete mode 100644 testing/web-platform/meta/payment-handler/__dir__.ini delete mode 100644 testing/web-platform/meta/payment-handler/can-make-payment-event-constructor.https.serviceworker.html.ini delete mode 100644 testing/web-platform/meta/payment-handler/can-make-payment-event-constructor.https.worker.js.ini delete mode 100644 testing/web-platform/meta/payment-handler/can-make-payment-event.https.html.ini delete mode 100644 testing/web-platform/meta/payment-handler/idlharness.https.any.js.ini delete mode 100644 testing/web-platform/meta/payment-handler/payment-instruments.https.html.ini delete mode 100644 testing/web-platform/meta/payment-handler/payment-request-event-constructor.https.serviceworker.html.ini delete mode 100644 testing/web-platform/meta/payment-handler/payment-request-event.https.html.ini delete mode 100644 testing/web-platform/meta/payment-handler/same-object-attributes.https.html.ini delete mode 100644 testing/web-platform/meta/payment-handler/untrusted-event.https.html.ini delete mode 100644 testing/web-platform/meta/payment-method-basic-card/__dir__.ini delete mode 100644 testing/web-platform/meta/payment-method-basic-card/apply_the_modifiers.html.ini delete mode 100644 testing/web-platform/meta/payment-method-basic-card/historical.https.html.ini delete mode 100644 testing/web-platform/meta/payment-method-basic-card/payment-request-canmakepayment-method.https.html.ini delete mode 100644 testing/web-platform/meta/payment-method-basic-card/steps_for_selecting_the_payment_handler.html.ini delete mode 100644 testing/web-platform/meta/payment-method-id/__dir__.ini delete mode 100644 testing/web-platform/meta/payment-method-id/payment-request-ctor-pmi-handling.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/MerchantValidationEvent/complete-method.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/MerchantValidationEvent/constructor.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/PaymentRequestUpdateEvent/constructor.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/__dir__.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/active-document-cross-origin.https.sub.html.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/active-document-same-origin.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/allowpaymentrequest-attribute-cross-origin-bc-containers.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/allowpaymentrequest-attribute-same-origin-bc-containers.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/basic.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/no-attribute-cross-origin-bc-containers.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/no-attribute-same-origin-bc-containers.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/removing-allowpaymentrequest.https.sub.html.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html.ini delete mode 100644 testing/web-platform/meta/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html.ini delete mode 100644 testing/web-platform/meta/payment-request/constructor_convert_method_data.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/historical.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/idlharness.https.window.js.ini delete mode 100644 testing/web-platform/meta/payment-request/interfaces.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/onmerchantvalidation-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/onpaymentmenthodchange-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-is-showing.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-abort-method.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-canmakepayment-method-protection.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-canmakepayment-method.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-constructor-crash.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-constructor.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-ctor-currency-code-checks.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-ctor-pmi-handling.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-id-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-onshippingaddresschange-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-onshippingoptionchange-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-shippingAddress-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-shippingOption-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-shippingType-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-request-show-method.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/payment-response/onpayerdetailchange-attribute.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/rejects_if_not_active.https.html.ini delete mode 100644 testing/web-platform/meta/payment-request/rejects_if_not_active_manual.https.html.ini delete mode 100644 testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html delete mode 100644 testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy-attribute.https.sub.html delete mode 100644 testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html delete mode 100644 testing/web-platform/tests/feature-policy/payment-allowed-by-feature-policy.https.sub.html.headers delete mode 100644 testing/web-platform/tests/feature-policy/payment-default-feature-policy.https.sub.html delete mode 100644 testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html delete mode 100644 testing/web-platform/tests/feature-policy/payment-disabled-by-feature-policy.https.sub.html.headers delete mode 100644 testing/web-platform/tests/feature-policy/payment-supported-by-feature-policy.tentative.html delete mode 100644 testing/web-platform/tests/feature-policy/reporting/payment-report-only.https.html delete mode 100644 testing/web-platform/tests/feature-policy/reporting/payment-report-only.https.html.headers delete mode 100644 testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html delete mode 100644 testing/web-platform/tests/feature-policy/reporting/payment-reporting.https.html.headers delete mode 100644 testing/web-platform/tests/interfaces/payment-handler.idl delete mode 100644 testing/web-platform/tests/interfaces/payment-method-basic-card.idl delete mode 100644 testing/web-platform/tests/interfaces/payment-request.idl delete mode 100644 testing/web-platform/tests/payment-handler/META.yml delete mode 100644 testing/web-platform/tests/payment-handler/app-can-make-payment.js delete mode 100644 testing/web-platform/tests/payment-handler/basic-card.js delete mode 100644 testing/web-platform/tests/payment-handler/basic-card.json delete mode 100644 testing/web-platform/tests/payment-handler/can-make-payment-event-constructor.https.html delete mode 100644 testing/web-platform/tests/payment-handler/can-make-payment-event-constructor.https.serviceworker.html delete mode 100644 testing/web-platform/tests/payment-handler/can-make-payment-event-constructor.https.serviceworker.js delete mode 100644 testing/web-platform/tests/payment-handler/can-make-payment-event-constructor.https.worker.js delete mode 100644 testing/web-platform/tests/payment-handler/can-make-payment-event.https.html delete mode 100644 testing/web-platform/tests/payment-handler/idlharness.https.any.js delete mode 100644 testing/web-platform/tests/payment-handler/manifest.json delete mode 100644 testing/web-platform/tests/payment-handler/payment-app/payment.html delete mode 100644 testing/web-platform/tests/payment-handler/payment-instruments.https.html delete mode 100644 testing/web-platform/tests/payment-handler/payment-request-event-constructor.https.html delete mode 100644 testing/web-platform/tests/payment-handler/payment-request-event-constructor.https.serviceworker.html delete mode 100644 testing/web-platform/tests/payment-handler/payment-request-event-constructor.https.serviceworker.js delete mode 100644 testing/web-platform/tests/payment-handler/payment-request-event-constructor.https.worker.js delete mode 100644 testing/web-platform/tests/payment-handler/payment-request-event.https.html delete mode 100644 testing/web-platform/tests/payment-handler/register-and-activate-service-worker.js delete mode 100644 testing/web-platform/tests/payment-handler/same-object-attributes.https.html delete mode 100644 testing/web-platform/tests/payment-handler/untrusted-event.https.html delete mode 100644 testing/web-platform/tests/payment-handler/untrusted-event.js delete mode 100644 testing/web-platform/tests/payment-method-basic-card/META.yml delete mode 100644 testing/web-platform/tests/payment-method-basic-card/apply_the_modifiers.html delete mode 100644 testing/web-platform/tests/payment-method-basic-card/empty-data-manual.https.html delete mode 100644 testing/web-platform/tests/payment-method-basic-card/historical.https.html delete mode 100644 testing/web-platform/tests/payment-method-basic-card/idlharness.window.js delete mode 100644 testing/web-platform/tests/payment-method-basic-card/payment-request-canmakepayment-method.https.html delete mode 100644 testing/web-platform/tests/payment-method-basic-card/steps_for_selecting_the_payment_handler.html delete mode 100644 testing/web-platform/tests/payment-method-id/META.yml delete mode 100644 testing/web-platform/tests/payment-method-id/README.md delete mode 100644 testing/web-platform/tests/payment-method-id/payment-request-ctor-pmi-handling.https.html delete mode 100644 testing/web-platform/tests/payment-request/META.yml delete mode 100644 testing/web-platform/tests/payment-request/MerchantValidationEvent/complete-method.https.html delete mode 100644 testing/web-platform/tests/payment-request/MerchantValidationEvent/constructor.http.html delete mode 100644 testing/web-platform/tests/payment-request/MerchantValidationEvent/constructor.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentMethodChangeEvent/methodName-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/algorithms-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/active-document-cross-origin.https.sub.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/active-document-same-origin.https.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/allowpaymentrequest-attribute-cross-origin-bc-containers.https.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/allowpaymentrequest-attribute-same-origin-bc-containers.https.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/basic.https.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/common.sub.js delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/no-attribute-cross-origin-bc-containers.https.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/no-attribute-same-origin-bc-containers.https.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/removing-allowpaymentrequest.https.sub.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html delete mode 100644 testing/web-platform/tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html delete mode 100644 testing/web-platform/tests/payment-request/billing-address-changed-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/blank.html delete mode 100644 testing/web-platform/tests/payment-request/change-shipping-option-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/change-shipping-option-select-last-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/constructor_convert_method_data.https.html delete mode 100644 testing/web-platform/tests/payment-request/historical.https.html delete mode 100644 testing/web-platform/tests/payment-request/idlharness.https.window.js delete mode 100644 testing/web-platform/tests/payment-request/interfaces.https.html delete mode 100644 testing/web-platform/tests/payment-request/onmerchantvalidation-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/onpaymentmenthodchange-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-is-showing.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-abort-method.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-canmakepayment-method-protection.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-canmakepayment-method.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-constructor-crash.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-constructor.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-ctor-currency-code-checks.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-ctor-pmi-handling.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-manual.tentative.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-id-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-insecure.http.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-not-exposed.https.worker.js delete mode 100644 testing/web-platform/tests/payment-request/payment-request-onshippingaddresschange-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-onshippingoptionchange-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-shippingAddress-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-shippingOption-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-shippingType-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-request-show-method.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/complete-method-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/helpers.js delete mode 100644 testing/web-platform/tests/payment-request/payment-response/methodName-attribute-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/onpayerdetailchange-attribute.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/payerEmail-attribute-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/payerName-attribute-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/payerPhone-attribute-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/rejects_if_not_active-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/requestId-attribute-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/retry-method-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/retry-method-warnings-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/payment-response/shippingOption-attribute-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/rejects_if_not_active.https.html delete mode 100644 testing/web-platform/tests/payment-request/rejects_if_not_active_manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/resources/page1.html delete mode 100644 testing/web-platform/tests/payment-request/resources/page2.html delete mode 100644 testing/web-platform/tests/payment-request/shipping-address-changed-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/show-method-optional-promise-rejects-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/show-method-optional-promise-resolves-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/show-method-postmessage-iframe.html delete mode 100644 testing/web-platform/tests/payment-request/show-method-postmessage-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/updateWith-method-pmi-handling-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html delete mode 100644 testing/web-platform/tests/payment-request/user-accepts-payment-request-algo-manual.https.html diff --git a/.eslintignore b/.eslintignore index 77ff185905..1704980586 100644 --- a/.eslintignore +++ b/.eslintignore @@ -26,8 +26,6 @@ browser/branding/**/firefox-branding.js # Gzipped test file. browser/base/content/test/general/gZipOfflineChild.html browser/base/content/test/urlbar/file_blank_but_not_blank.html -# Third-party code. -browser/components/payments/res/vendor/* # Test files that are really json not js, and don't need to be linted. browser/components/sessionstore/test/unit/data/sessionstore_valid.js browser/components/sessionstore/test/unit/data/sessionstore_invalid.js diff --git a/.eslintrc.js b/.eslintrc.js index 287ec913ea..caa53dd19e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -269,7 +269,6 @@ module.exports = { "dom/messagechannel/**", "dom/midi/**", "dom/network/**", - "dom/payments/**", "dom/performance/**", "dom/permission/**", "dom/quota/**", diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index 987e7d9024..b021c2c78f 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -30,9 +30,6 @@ var gExceptionPaths = [ "resource://gre/modules/commonjs/", "resource://gre/defaults/pref/", - // These resources are referenced using relative paths from html files. - "resource://payments/", - // https://github.com/mozilla/activity-stream/issues/3053 "resource://activity-stream/data/content/tippytop/images/", // https://github.com/mozilla/activity-stream/issues/3758 diff --git a/browser/base/content/test/static/browser_parsable_script.js b/browser/base/content/test/static/browser_parsable_script.js index 015542054d..db0231202d 100644 --- a/browser/base/content/test/static/browser_parsable_script.js +++ b/browser/base/content/test/static/browser_parsable_script.js @@ -12,13 +12,6 @@ const kWhitelist = new Set([ /browser\/content\/browser\/places\/controller.js$/, ]); -const kESModuleList = new Set([ - /browser\/res\/payments\/(components|containers|mixins)\/.*\.js$/, - /browser\/res\/payments\/paymentRequest\.js$/, - /browser\/res\/payments\/PaymentsStore\.js$/, - /browser\/aboutlogins\/components\/.*\.js$/, -]); - // Normally we would use reflect.jsm to get Reflect.parse. However, if // we do that, then all the AST data is allocated in reflect.jsm's // zone. That exposes a bug in our GC. The GC collects reflect.jsm's diff --git a/browser/components/moz.build b/browser/components/moz.build index aaa2c47ad2..2cf1f56357 100644 --- a/browser/components/moz.build +++ b/browser/components/moz.build @@ -56,7 +56,6 @@ DIRS += ['build'] if CONFIG['NIGHTLY_BUILD']: DIRS += [ 'aboutconfig', - 'payments', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': diff --git a/browser/components/payments/.eslintrc.js b/browser/components/payments/.eslintrc.js deleted file mode 100644 index e45b829271..0000000000 --- a/browser/components/payments/.eslintrc.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; - -module.exports = { - overrides: [ - { - files: [ - "res/components/*.js", - "res/containers/*.js", - "res/mixins/*.js", - "res/paymentRequest.js", - "res/PaymentsStore.js", - "test/mochitest/test_*.html", - ], - parserOptions: { - sourceType: "module", - }, - }, - { - "files": "test/unit/head.js", - "rules": { - "no-unused-vars": ["error", { - "args": "none", - "vars": "local", - }], - }, - }, - ], - rules: { - "mozilla/var-only-at-top-level": "error", - - "block-scoped-var": "error", - complexity: ["error", { - max: 20, - }], - "max-nested-callbacks": ["error", 4], - "no-console": ["error", { allow: ["error"] }], - "no-fallthrough": "error", - "no-multi-str": "error", - "no-proto": "error", - "no-unused-expressions": "error", - "no-unused-vars": ["error", { - args: "none", - vars: "all" - }], - "no-use-before-define": ["error", { - functions: false, - }], - radix: "error", - "valid-jsdoc": ["error", { - prefer: { - return: "returns", - }, - preferType: { - Boolean: "boolean", - Number: "number", - String: "string", - bool: "boolean", - }, - requireParamDescription: false, - requireReturn: false, - requireReturnDescription: false, - }], - yoda: "error", - }, -}; diff --git a/browser/components/payments/PaymentUIService.jsm b/browser/components/payments/PaymentUIService.jsm deleted file mode 100644 index ce48988bcb..0000000000 --- a/browser/components/payments/PaymentUIService.jsm +++ /dev/null @@ -1,352 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * Singleton service acting as glue between the DOM APIs and the payment dialog UI. - * - * Communication from the DOM to the UI happens via the nsIPaymentUIService interface. - * The UI talks to the DOM code via the nsIPaymentRequestService interface. - * PaymentUIService is started by the DOM code lazily. - * - * For now the UI is shown in a native dialog but that is likely to change. - * Tests should try to avoid relying on that implementation detail. - */ - -"use strict"; - -const XHTML_NS = "http://www.w3.org/1999/xhtml"; - -const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); -const { XPCOMUtils } = ChromeUtils.import( - "resource://gre/modules/XPCOMUtils.jsm" -); - -ChromeUtils.defineModuleGetter( - this, - "BrowserWindowTracker", - "resource:///modules/BrowserWindowTracker.jsm" -); - -XPCOMUtils.defineLazyServiceGetter( - this, - "paymentSrv", - "@mozilla.org/dom/payments/payment-request-service;1", - "nsIPaymentRequestService" -); - -function PaymentUIService() { - this.wrappedJSObject = this; - XPCOMUtils.defineLazyGetter(this, "log", () => { - let { ConsoleAPI } = ChromeUtils.import( - "resource://gre/modules/Console.jsm" - ); - return new ConsoleAPI({ - maxLogLevelPref: "dom.payments.loglevel", - prefix: "Payment UI Service", - }); - }); - this.log.debug("constructor"); -} - -PaymentUIService.prototype = { - classID: Components.ID("{01f8bd55-9017-438b-85ec-7c15d2b35cdc}"), - QueryInterface: ChromeUtils.generateQI([Ci.nsIPaymentUIService]), - - // nsIPaymentUIService implementation: - - showPayment(requestId) { - this.log.debug("showPayment:", requestId); - let request = paymentSrv.getPaymentRequestById(requestId); - let merchantBrowser = this.findBrowserByOuterWindowId( - request.topOuterWindowId - ); - let chromeWindow = merchantBrowser.ownerGlobal; - let { gBrowser } = chromeWindow; - let browserContainer = gBrowser.getBrowserContainer(merchantBrowser); - let container = chromeWindow.document.createElementNS(XHTML_NS, "div"); - container.dataset.requestId = requestId; - container.classList.add("paymentDialogContainer"); - container.hidden = true; - let paymentsBrowser = this._createPaymentFrame( - chromeWindow.document, - requestId - ); - - let pdwGlobal = {}; - Services.scriptloader.loadSubScript( - "chrome://payments/content/paymentDialogWrapper.js", - pdwGlobal - ); - - paymentsBrowser.paymentDialogWrapper = pdwGlobal.paymentDialogWrapper; - - // Create an wrapper to absolutely position the - // because XUL elements don't support position:absolute. - let absDiv = chromeWindow.document.createElementNS(XHTML_NS, "div"); - container.appendChild(absDiv); - - // append the frame to start the loading - absDiv.appendChild(paymentsBrowser); - browserContainer.prepend(container); - - // Initialize the wrapper once the is connected. - paymentsBrowser.paymentDialogWrapper.init(requestId, paymentsBrowser); - - this._attachBrowserEventListeners(merchantBrowser); - - // Only show the frame and change the UI when the dialog is ready to show. - paymentsBrowser.addEventListener( - "tabmodaldialogready", - function readyToShow() { - if (!container) { - // The dialog was closed by the DOM code before it was ready to be shown. - return; - } - container.hidden = false; - this._showDialog(merchantBrowser); - }.bind(this), - { - once: true, - } - ); - }, - - abortPayment(requestId) { - this.log.debug("abortPayment:", requestId); - let abortResponse = Cc[ - "@mozilla.org/dom/payments/payment-abort-action-response;1" - ].createInstance(Ci.nsIPaymentAbortActionResponse); - let found = this.closeDialog(requestId); - - // if `win` is falsy, then we haven't found the dialog, so the abort fails - // otherwise, the abort is successful - let response = found - ? Ci.nsIPaymentActionResponse.ABORT_SUCCEEDED - : Ci.nsIPaymentActionResponse.ABORT_FAILED; - - abortResponse.init(requestId, response); - paymentSrv.respondPayment(abortResponse); - }, - - completePayment(requestId) { - // completeStatus should be one of "timeout", "success", "fail", "" - let { completeStatus } = paymentSrv.getPaymentRequestById(requestId); - this.log.debug( - `completePayment: requestId: ${requestId}, completeStatus: ${completeStatus}` - ); - - let closed; - switch (completeStatus) { - case "fail": - case "timeout": - break; - default: - closed = this.closeDialog(requestId); - break; - } - - let paymentFrame; - if (!closed) { - // We need to call findDialog before we respond below as getPaymentRequestById - // may fail due to the request being removed upon completion. - paymentFrame = this.findDialog(requestId).paymentFrame; - if (!paymentFrame) { - this.log.error("completePayment: no dialog found"); - return; - } - } - - let responseCode = closed - ? Ci.nsIPaymentActionResponse.COMPLETE_SUCCEEDED - : Ci.nsIPaymentActionResponse.COMPLETE_FAILED; - let completeResponse = Cc[ - "@mozilla.org/dom/payments/payment-complete-action-response;1" - ].createInstance(Ci.nsIPaymentCompleteActionResponse); - completeResponse.init(requestId, responseCode); - paymentSrv.respondPayment( - completeResponse.QueryInterface(Ci.nsIPaymentActionResponse) - ); - - if (!closed) { - paymentFrame.paymentDialogWrapper.updateRequest(); - } - }, - - updatePayment(requestId) { - let { paymentFrame } = this.findDialog(requestId); - this.log.debug("updatePayment:", requestId); - if (!paymentFrame) { - this.log.error("updatePayment: no dialog found"); - return; - } - paymentFrame.paymentDialogWrapper.updateRequest(); - }, - - closePayment(requestId) { - this.closeDialog(requestId); - }, - - // other helper methods - - _createPaymentFrame(doc, requestId) { - let frame = doc.createXULElement("browser"); - frame.classList.add("paymentDialogContainerFrame"); - frame.setAttribute("type", "content"); - frame.setAttribute("remote", "true"); - frame.setAttribute("disablehistory", "true"); - frame.setAttribute("nodefaultsrc", "true"); - frame.setAttribute("transparent", "true"); - frame.setAttribute("selectmenulist", "ContentSelectDropdown"); - frame.setAttribute("autocompletepopup", "PopupAutoComplete"); - return frame; - }, - - _attachBrowserEventListeners(merchantBrowser) { - merchantBrowser.addEventListener("SwapDocShells", this); - }, - - _showDialog(merchantBrowser) { - let chromeWindow = merchantBrowser.ownerGlobal; - // Prevent focusing or interacting with the . - merchantBrowser.setAttribute("tabmodalPromptShowing", "true"); - - // Darken the merchant content area. - let tabModalBackground = chromeWindow.document.createXULElement("box"); - tabModalBackground.classList.add( - "tabModalBackground", - "paymentDialogBackground" - ); - // Insert the same way as . - merchantBrowser.parentNode.insertBefore( - tabModalBackground, - merchantBrowser.nextElementSibling - ); - }, - - /** - * @param {string} requestId - Payment Request ID of the dialog to close. - * @returns {boolean} whether the specified dialog was closed. - */ - closeDialog(requestId) { - let { browser, dialogContainer, paymentFrame } = this.findDialog(requestId); - if (!dialogContainer) { - return false; - } - this.log.debug(`closing: ${requestId}`); - paymentFrame.paymentDialogWrapper.uninit(); - dialogContainer.remove(); - browser.removeEventListener("SwapDocShells", this); - - if (!dialogContainer.hidden) { - // If the container is no longer hidden then the background was added after - // `tabmodaldialogready` so remove it. - browser.parentElement.querySelector(".paymentDialogBackground").remove(); - - if ( - !browser.tabModalPromptBox || - browser.tabModalPromptBox.listPrompts().length == 0 - ) { - browser.removeAttribute("tabmodalPromptShowing"); - } - } - return true; - }, - - getDialogContainerForMerchantBrowser(merchantBrowser) { - return merchantBrowser.ownerGlobal.gBrowser - .getBrowserContainer(merchantBrowser) - .querySelector(".paymentDialogContainer"); - }, - - findDialog(requestId) { - for (let win of BrowserWindowTracker.orderedWindows) { - for (let dialogContainer of win.document.querySelectorAll( - ".paymentDialogContainer" - )) { - if (dialogContainer.dataset.requestId == requestId) { - return { - dialogContainer, - paymentFrame: dialogContainer.querySelector( - ".paymentDialogContainerFrame" - ), - browser: dialogContainer.parentElement.querySelector( - ".browserStack > browser" - ), - }; - } - } - } - return {}; - }, - - findBrowserByOuterWindowId(outerWindowId) { - for (let win of BrowserWindowTracker.orderedWindows) { - let browser = win.gBrowser.getBrowserForOuterWindowID(outerWindowId); - if (!browser) { - continue; - } - return browser; - } - - this.log.error( - "findBrowserByOuterWindowId: No browser found for outerWindowId:", - outerWindowId - ); - return null; - }, - - _moveDialogToNewBrowser(oldBrowser, newBrowser) { - // Re-attach event listeners to the new browser. - newBrowser.addEventListener("SwapDocShells", this); - - let dialogContainer = this.getDialogContainerForMerchantBrowser(oldBrowser); - let newBrowserContainer = newBrowser.ownerGlobal.gBrowser.getBrowserContainer( - newBrowser - ); - - // Clone the container tree - let newDialogContainer = newBrowserContainer.ownerDocument.importNode( - dialogContainer, - true - ); - - let oldFrame = dialogContainer.querySelector( - ".paymentDialogContainerFrame" - ); - let newFrame = newDialogContainer.querySelector( - ".paymentDialogContainerFrame" - ); - - // We need a document to be synchronously loaded in order to do the swap and - // there's no point in wasting resources loading a dialog we're going to replace. - newFrame.setAttribute("src", "about:blank"); - newFrame.setAttribute("nodefaultsrc", "true"); - - newBrowserContainer.prepend(newDialogContainer); - - // Force the to be created so that it'll have a document loaded and frame created. - // See `ourChildDocument` and `ourFrame` checks in nsFrameLoader::SwapWithOtherLoader. - /* eslint-disable-next-line no-unused-expressions */ - newFrame.clientTop; - - // Swap the frameLoaders to preserve the frame state - newFrame.swapFrameLoaders(oldFrame); - newFrame.paymentDialogWrapper = oldFrame.paymentDialogWrapper; - newFrame.paymentDialogWrapper.changeAttachedFrame(newFrame); - dialogContainer.remove(); - - this._showDialog(newBrowser); - }, - - handleEvent(event) { - switch (event.type) { - case "SwapDocShells": { - this._moveDialogToNewBrowser(event.target, event.detail); - break; - } - } - }, -}; - -var EXPORTED_SYMBOLS = ["PaymentUIService"]; diff --git a/browser/components/payments/components.conf b/browser/components/payments/components.conf deleted file mode 100644 index 138922c5f0..0000000000 --- a/browser/components/payments/components.conf +++ /dev/null @@ -1,12 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -Classes = [ - { - 'cid': '{01f8bd55-9017-438b-85ec-7c15d2b35cdc}', - 'contract_ids': ['@mozilla.org/dom/payments/payment-ui-service;1'], - 'jsm': 'resource:///modules/PaymentUIService.jsm', - 'constructor': 'PaymentUIService', - }, -] diff --git a/browser/components/payments/content/paymentDialogFrameScript.js b/browser/components/payments/content/paymentDialogFrameScript.js deleted file mode 100644 index 4397ba2f85..0000000000 --- a/browser/components/payments/content/paymentDialogFrameScript.js +++ /dev/null @@ -1,181 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * This frame script only exists to mediate communications between the - * unprivileged frame in a content process and the privileged dialog wrapper - * in the UI process on the main thread. - * - * `paymentChromeToContent` messages from the privileged wrapper are converted - * into DOM events of the same name. - * `paymentContentToChrome` custom DOM events from the unprivileged frame are - * converted into messages of the same name. - * - * Business logic should stay out of this shim. - */ - -"use strict"; - -/* eslint-env mozilla/frame-script */ -/* global Services */ - -const { XPCOMUtils } = ChromeUtils.import( - "resource://gre/modules/XPCOMUtils.jsm" -); - -ChromeUtils.defineModuleGetter( - this, - "FormAutofill", - "resource://formautofill/FormAutofill.jsm" -); -ChromeUtils.defineModuleGetter( - this, - "FormAutofillUtils", - "resource://formautofill/FormAutofillUtils.jsm" -); -ChromeUtils.defineModuleGetter( - this, - "AppConstants", - "resource://gre/modules/AppConstants.jsm" -); - -const SAVE_CREDITCARD_DEFAULT_PREF = "dom.payments.defaults.saveCreditCard"; -const SAVE_ADDRESS_DEFAULT_PREF = "dom.payments.defaults.saveAddress"; - -let PaymentFrameScript = { - init() { - XPCOMUtils.defineLazyGetter(this, "log", () => { - let { ConsoleAPI } = ChromeUtils.import( - "resource://gre/modules/Console.jsm" - ); - return new ConsoleAPI({ - maxLogLevelPref: "dom.payments.loglevel", - prefix: "paymentDialogFrameScript", - }); - }); - - addEventListener("paymentContentToChrome", this, false, true); - - addMessageListener("paymentChromeToContent", this); - }, - - handleEvent(event) { - this.sendToChrome(event); - }, - - receiveMessage({ data: { messageType, data } }) { - this.sendToContent(messageType, data); - }, - - setupContentConsole() { - let privilegedLogger = content.window.console.createInstance({ - maxLogLevelPref: "dom.payments.loglevel", - prefix: "paymentDialogContent", - }); - - let contentLogObject = Cu.waiveXrays(content).log; - for (let name of ["error", "warn", "info", "debug"]) { - Cu.exportFunction( - privilegedLogger[name].bind(privilegedLogger), - contentLogObject, - { - defineAs: name, - } - ); - } - }, - - /** - * Expose privileged utility functions to the unprivileged page. - */ - exposeUtilityFunctions() { - let waivedContent = Cu.waiveXrays(content); - let PaymentDialogUtils = { - DEFAULT_REGION: FormAutofill.DEFAULT_REGION, - countries: FormAutofill.countries, - - getAddressLabel(address, addressFields = null) { - return FormAutofillUtils.getAddressLabel(address, addressFields); - }, - - getCreditCardNetworks() { - let networks = FormAutofillUtils.getCreditCardNetworks(); - return Cu.cloneInto(networks, waivedContent); - }, - - isCCNumber(value) { - return FormAutofillUtils.isCCNumber(value); - }, - - getFormFormat(country) { - let format = FormAutofillUtils.getFormFormat(country); - return Cu.cloneInto(format, waivedContent); - }, - - findAddressSelectOption(selectEl, address, fieldName) { - return FormAutofillUtils.findAddressSelectOption( - selectEl, - address, - fieldName - ); - }, - - getDefaultPreferences() { - let prefValues = Cu.cloneInto( - { - saveCreditCardDefaultChecked: Services.prefs.getBoolPref( - SAVE_CREDITCARD_DEFAULT_PREF, - false - ), - saveAddressDefaultChecked: Services.prefs.getBoolPref( - SAVE_ADDRESS_DEFAULT_PREF, - false - ), - }, - waivedContent - ); - return Cu.cloneInto(prefValues, waivedContent); - }, - - isOfficialBranding() { - return AppConstants.MOZILLA_OFFICIAL; - }, - }; - waivedContent.PaymentDialogUtils = Cu.cloneInto( - PaymentDialogUtils, - waivedContent, - { - cloneFunctions: true, - } - ); - }, - - sendToChrome({ detail }) { - let { messageType } = detail; - if (messageType == "initializeRequest") { - this.setupContentConsole(); - this.exposeUtilityFunctions(); - } - this.log.debug("sendToChrome:", messageType, detail); - this.sendMessageToChrome(messageType, detail); - }, - - sendToContent(messageType, detail = {}) { - this.log.debug("sendToContent", messageType, detail); - let response = Object.assign({ messageType }, detail); - let event = new content.CustomEvent("paymentChromeToContent", { - detail: Cu.cloneInto(response, content), - }); - content.dispatchEvent(event); - }, - - sendMessageToChrome(messageType, data = {}) { - sendAsyncMessage( - "paymentContentToChrome", - Object.assign(data, { messageType }) - ); - }, -}; - -PaymentFrameScript.init(); diff --git a/browser/components/payments/content/paymentDialogWrapper.js b/browser/components/payments/content/paymentDialogWrapper.js deleted file mode 100644 index 4475ff571f..0000000000 --- a/browser/components/payments/content/paymentDialogWrapper.js +++ /dev/null @@ -1,926 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * Runs in the privileged outer dialog. Each dialog loads this script in its - * own scope. - */ - -/* exported paymentDialogWrapper */ - -"use strict"; - -const paymentSrv = Cc[ - "@mozilla.org/dom/payments/payment-request-service;1" -].getService(Ci.nsIPaymentRequestService); - -const paymentUISrv = Cc[ - "@mozilla.org/dom/payments/payment-ui-service;1" -].getService(Ci.nsIPaymentUIService); - -const { AppConstants } = ChromeUtils.import( - "resource://gre/modules/AppConstants.jsm" -); -const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); -const { XPCOMUtils } = ChromeUtils.import( - "resource://gre/modules/XPCOMUtils.jsm" -); - -ChromeUtils.defineModuleGetter( - this, - "BrowserWindowTracker", - "resource:///modules/BrowserWindowTracker.jsm" -); -ChromeUtils.defineModuleGetter( - this, - "FormAutofillUtils", - "resource://formautofill/FormAutofillUtils.jsm" -); -ChromeUtils.defineModuleGetter( - this, - "OSKeyStore", - "resource://formautofill/OSKeyStore.jsm" -); -ChromeUtils.defineModuleGetter( - this, - "PrivateBrowsingUtils", - "resource://gre/modules/PrivateBrowsingUtils.jsm" -); - -XPCOMUtils.defineLazyGetter(this, "formAutofillStorage", () => { - let storage; - try { - storage = ChromeUtils.import( - "resource://formautofill/FormAutofillStorage.jsm", - {} - ).formAutofillStorage; - storage.initialize(); - } catch (ex) { - storage = null; - Cu.reportError(ex); - } - - return storage; -}); - -XPCOMUtils.defineLazyGetter(this, "reauthPasswordPromptMessage", () => { - const brandShortName = FormAutofillUtils.brandBundle.GetStringFromName( - "brandShortName" - ); - return FormAutofillUtils.stringBundle.formatStringFromName( - `useCreditCardPasswordPrompt.${AppConstants.platform}`, - [brandShortName] - ); -}); - -/** - * Temporary/transient storage for address and credit card records - * - * Implements a subset of the FormAutofillStorage collection class interface, and delegates to - * those classes for some utility methods - */ -class TempCollection { - constructor(type, data = {}) { - /** - * The name of the collection. e.g. 'addresses' or 'creditCards' - * Used to access methods from the FormAutofillStorage collections - */ - this._type = type; - this._data = data; - } - - get _formAutofillCollection() { - // lazy getter for the formAutofill collection - to resolve on first access - Object.defineProperty(this, "_formAutofillCollection", { - value: formAutofillStorage[this._type], - writable: false, - configurable: true, - }); - return this._formAutofillCollection; - } - - get(guid) { - return this._data[guid]; - } - - async update(guid, record, preserveOldProperties) { - let recordToSave = Object.assign( - preserveOldProperties ? this._data[guid] : {}, - record - ); - await this._formAutofillCollection.computeFields(recordToSave); - return (this._data[guid] = recordToSave); - } - - async add(record) { - let guid = "temp-" + Math.abs((Math.random() * 0xffffffff) | 0); - let timeLastModified = Date.now(); - let recordToSave = Object.assign({ guid, timeLastModified }, record); - await this._formAutofillCollection.computeFields(recordToSave); - this._data[guid] = recordToSave; - return guid; - } - - getAll() { - return this._data; - } -} - -var paymentDialogWrapper = { - componentsLoaded: new Map(), - frameWeakRef: null, - mm: null, - request: null, - temporaryStore: null, - - QueryInterface: ChromeUtils.generateQI([ - Ci.nsIObserver, - Ci.nsISupportsWeakReference, - ]), - - /** - * @param {string} guid - * @returns {object} containing only the requested payer values. - */ - async _convertProfileAddressToPayerData(guid) { - let addressData = - this.temporaryStore.addresses.get(guid) || - (await formAutofillStorage.addresses.get(guid)); - if (!addressData) { - throw new Error(`Payer address not found: ${guid}`); - } - - let { - requestPayerName, - requestPayerEmail, - requestPayerPhone, - } = this.request.paymentOptions; - - let payerData = { - payerName: requestPayerName ? addressData.name : "", - payerEmail: requestPayerEmail ? addressData.email : "", - payerPhone: requestPayerPhone ? addressData.tel : "", - }; - - return payerData; - }, - - /** - * @param {string} guid - * @returns {nsIPaymentAddress} - */ - async _convertProfileAddressToPaymentAddress(guid) { - let addressData = - this.temporaryStore.addresses.get(guid) || - (await formAutofillStorage.addresses.get(guid)); - if (!addressData) { - throw new Error(`Address not found: ${guid}`); - } - - let address = this.createPaymentAddress({ - addressLines: addressData["street-address"].split("\n"), - city: addressData["address-level2"], - country: addressData.country, - dependentLocality: addressData["address-level3"], - organization: addressData.organization, - phone: addressData.tel, - postalCode: addressData["postal-code"], - recipient: addressData.name, - region: addressData["address-level1"], - // TODO (bug 1474905), The regionCode will be available when bug 1474905 is fixed - // and the region text box is changed to a dropdown with the regionCode being the - // value of the option and the region being the label for the option. - // A regionCode should be either the empty string or one to three code points - // that represent a region as the code element of an [ISO3166-2] country subdivision - // name (i.e., the characters after the hyphen in an ISO3166-2 country subdivision - // code element, such as "CA" for the state of California in the USA, or "11" for - // the Lisbon district of Portugal). - regionCode: "", - }); - - return address; - }, - - /** - * @param {string} guid The GUID of the basic card record from storage. - * @param {string} cardSecurityCode The associated card security code (CVV/CCV/etc.) - * @throws If there is an error decrypting - * @returns {nsIBasicCardResponseData?} returns response data or null (if the - * master password dialog was cancelled); - */ - async _convertProfileBasicCardToPaymentMethodData(guid, cardSecurityCode) { - let cardData = - this.temporaryStore.creditCards.get(guid) || - (await formAutofillStorage.creditCards.get(guid)); - if (!cardData) { - throw new Error(`Basic card not found in storage: ${guid}`); - } - - let cardNumber; - try { - cardNumber = await OSKeyStore.decrypt( - cardData["cc-number-encrypted"], - reauthPasswordPromptMessage - ); - } catch (ex) { - if (ex.result != Cr.NS_ERROR_ABORT) { - throw ex; - } - // User canceled master password entry - return null; - } - - let billingAddressGUID = cardData.billingAddressGUID; - let billingAddress; - try { - billingAddress = await this._convertProfileAddressToPaymentAddress( - billingAddressGUID - ); - } catch (ex) { - // The referenced address may not exist if it was deleted or hasn't yet synced to this profile - Cu.reportError(ex); - } - let methodData = this.createBasicCardResponseData({ - cardholderName: cardData["cc-name"], - cardNumber, - expiryMonth: cardData["cc-exp-month"].toString().padStart(2, "0"), - expiryYear: cardData["cc-exp-year"].toString(), - cardSecurityCode, - billingAddress, - }); - - return methodData; - }, - - init(requestId, frame) { - if (!requestId || typeof requestId != "string") { - throw new Error("Invalid PaymentRequest ID"); - } - - // The Request object returned by the Payment Service is live and - // will automatically get updated if event.updateWith is used. - this.request = paymentSrv.getPaymentRequestById(requestId); - - if (!this.request) { - throw new Error(`PaymentRequest not found: ${requestId}`); - } - - this._attachToFrame(frame); - this.mm.loadFrameScript( - "chrome://payments/content/paymentDialogFrameScript.js", - true - ); - // Until we have bug 1446164 and bug 1407418 we use form autofill's temporary - // shim for data-localization* attributes. - this.mm.loadFrameScript("chrome://formautofill/content/l10n.js", true); - frame.setAttribute("src", "resource://payments/paymentRequest.xhtml"); - - this.temporaryStore = { - addresses: new TempCollection("addresses"), - creditCards: new TempCollection("creditCards"), - }; - }, - - uninit() { - try { - Services.obs.removeObserver(this, "message-manager-close"); - Services.obs.removeObserver(this, "formautofill-storage-changed"); - } catch (ex) { - // Observers may not have been added yet - } - }, - - /** - * Code here will be re-run at various times, e.g. initial show and - * when a tab is detached to a different window. - * - * Code that should only run once belongs in `init`. - * Code to only run upon detaching should be in `changeAttachedFrame`. - * - * @param {Element} frame - */ - _attachToFrame(frame) { - this.frameWeakRef = Cu.getWeakReference(frame); - this.mm = frame.frameLoader.messageManager; - this.mm.addMessageListener("paymentContentToChrome", this); - Services.obs.addObserver(this, "message-manager-close", true); - }, - - /** - * Called only when a frame is changed from one to another. - * - * @param {Element} frame - */ - changeAttachedFrame(frame) { - this.mm.removeMessageListener("paymentContentToChrome", this); - this._attachToFrame(frame); - // This isn't in `attachToFrame` because we only want to do it once we've sent records. - Services.obs.addObserver(this, "formautofill-storage-changed", true); - }, - - createShowResponse({ - acceptStatus, - methodName = "", - methodData = null, - payerName = "", - payerEmail = "", - payerPhone = "", - }) { - let showResponse = this.createComponentInstance( - Ci.nsIPaymentShowActionResponse - ); - - showResponse.init( - this.request.requestId, - acceptStatus, - methodName, - methodData, - payerName, - payerEmail, - payerPhone - ); - return showResponse; - }, - - createBasicCardResponseData({ - cardholderName = "", - cardNumber, - expiryMonth = "", - expiryYear = "", - cardSecurityCode = "", - billingAddress = null, - }) { - const basicCardResponseData = Cc[ - "@mozilla.org/dom/payments/basiccard-response-data;1" - ].createInstance(Ci.nsIBasicCardResponseData); - basicCardResponseData.initData( - cardholderName, - cardNumber, - expiryMonth, - expiryYear, - cardSecurityCode, - billingAddress - ); - return basicCardResponseData; - }, - - createPaymentAddress({ - addressLines = [], - city = "", - country = "", - dependentLocality = "", - organization = "", - postalCode = "", - phone = "", - recipient = "", - region = "", - regionCode = "", - sortingCode = "", - }) { - const paymentAddress = Cc[ - "@mozilla.org/dom/payments/payment-address;1" - ].createInstance(Ci.nsIPaymentAddress); - const addressLine = Cc["@mozilla.org/array;1"].createInstance( - Ci.nsIMutableArray - ); - for (let line of addressLines) { - const address = Cc["@mozilla.org/supports-string;1"].createInstance( - Ci.nsISupportsString - ); - address.data = line; - addressLine.appendElement(address); - } - paymentAddress.init( - country, - addressLine, - region, - regionCode, - city, - dependentLocality, - postalCode, - sortingCode, - organization, - recipient, - phone - ); - return paymentAddress; - }, - - createComponentInstance(componentInterface) { - let componentName; - switch (componentInterface) { - case Ci.nsIPaymentShowActionResponse: { - componentName = - "@mozilla.org/dom/payments/payment-show-action-response;1"; - break; - } - case Ci.nsIGeneralResponseData: { - componentName = "@mozilla.org/dom/payments/general-response-data;1"; - break; - } - } - let component = this.componentsLoaded.get(componentName); - - if (!component) { - component = Cc[componentName]; - this.componentsLoaded.set(componentName, component); - } - - return component.createInstance(componentInterface); - }, - - async fetchSavedAddresses() { - let savedAddresses = {}; - for (let address of await formAutofillStorage.addresses.getAll()) { - savedAddresses[address.guid] = address; - } - return savedAddresses; - }, - - async fetchSavedPaymentCards() { - let savedBasicCards = {}; - for (let card of await formAutofillStorage.creditCards.getAll()) { - savedBasicCards[card.guid] = card; - // Filter out the encrypted card number since the dialog content is - // considered untrusted and runs in a content process. - delete card["cc-number-encrypted"]; - - // ensure each card has a methodName property - if (!card.methodName) { - card.methodName = "basic-card"; - } - } - return savedBasicCards; - }, - - fetchTempPaymentCards() { - let creditCards = this.temporaryStore.creditCards.getAll(); - for (let card of Object.values(creditCards)) { - // Ensure each card has a methodName property. - if (!card.methodName) { - card.methodName = "basic-card"; - } - } - return creditCards; - }, - - async onAutofillStorageChange() { - let [savedAddresses, savedBasicCards] = await Promise.all([ - this.fetchSavedAddresses(), - this.fetchSavedPaymentCards(), - ]); - - this.sendMessageToContent("updateState", { - savedAddresses, - savedBasicCards, - }); - }, - - sendMessageToContent(messageType, data = {}) { - this.mm.sendAsyncMessage("paymentChromeToContent", { - data, - messageType, - }); - }, - - updateRequest() { - // There is no need to update this.request since the object is live - // and will automatically get updated if event.updateWith is used. - let requestSerialized = this._serializeRequest(this.request); - - this.sendMessageToContent("updateState", { - request: requestSerialized, - }); - }, - - /** - * Recursively convert and filter input to the subset of data types supported by JSON - * - * @param {*} value - any type of input to serialize - * @param {string?} name - name or key associated with this input. - * E.g. property name or array index. - * @returns {*} serialized deep copy of the value - */ - _serializeRequest(value, name = null) { - // Primitives: String, Number, Boolean, null - let type = typeof value; - if ( - value === null || - type == "string" || - type == "number" || - type == "boolean" - ) { - return value; - } - if (name == "topLevelPrincipal") { - // Manually serialize the nsIPrincipal. - let displayHost = value.URI.displayHost; - return { - URI: { - displayHost, - }, - }; - } - if (type == "function" || type == "undefined") { - return undefined; - } - // Structures: nsIArray - if (value instanceof Ci.nsIArray) { - let iface; - let items = []; - switch (name) { - case "displayItems": // falls through - case "additionalDisplayItems": - iface = Ci.nsIPaymentItem; - break; - case "shippingOptions": - iface = Ci.nsIPaymentShippingOption; - break; - case "paymentMethods": - iface = Ci.nsIPaymentMethodData; - break; - case "modifiers": - iface = Ci.nsIPaymentDetailsModifier; - break; - } - if (!iface) { - throw new Error( - `No interface associated with the members of the ${name} nsIArray` - ); - } - for (let i = 0; i < value.length; i++) { - let item = value.queryElementAt(i, iface); - let result = this._serializeRequest(item, i); - if (result !== undefined) { - items.push(result); - } - } - return items; - } - // Structures: Arrays - if (Array.isArray(value)) { - let items = value - .map(item => this._serializeRequest(item)) - .filter(item => item !== undefined); - return items; - } - // Structures: Objects - let obj = {}; - for (let [key, item] of Object.entries(value)) { - let result = this._serializeRequest(item, key); - if (result !== undefined) { - obj[key] = result; - } - } - return obj; - }, - - async initializeFrame() { - // We don't do this earlier as it's only necessary once this function sends - // the initial saved records. - Services.obs.addObserver(this, "formautofill-storage-changed", true); - - let requestSerialized = this._serializeRequest(this.request); - let chromeWindow = this.frameWeakRef.get().ownerGlobal; - let isPrivate = PrivateBrowsingUtils.isWindowPrivate(chromeWindow); - - let [savedAddresses, savedBasicCards] = await Promise.all([ - this.fetchSavedAddresses(), - this.fetchSavedPaymentCards(), - ]); - - this.sendMessageToContent("showPaymentRequest", { - request: requestSerialized, - savedAddresses, - tempAddresses: this.temporaryStore.addresses.getAll(), - savedBasicCards, - tempBasicCards: this.fetchTempPaymentCards(), - isPrivate, - }); - }, - - debugFrame() { - // To avoid self-XSS-type attacks, ensure that Browser Chrome debugging is enabled. - if (!Services.prefs.getBoolPref("devtools.chrome.enabled", false)) { - Cu.reportError( - "devtools.chrome.enabled must be enabled to debug the frame" - ); - return; - } - let { gDevToolsBrowser } = ChromeUtils.import( - "resource://devtools/client/framework/gDevTools.jsm" - ); - gDevToolsBrowser.openContentProcessToolbox({ - selectedBrowser: this.frameWeakRef.get(), - }); - }, - - onOpenPreferences() { - BrowserWindowTracker.getTopWindow().openPreferences( - "privacy-form-autofill" - ); - }, - - onPaymentCancel() { - const showResponse = this.createShowResponse({ - acceptStatus: Ci.nsIPaymentActionResponse.PAYMENT_REJECTED, - }); - - paymentSrv.respondPayment(showResponse); - paymentUISrv.closePayment(this.request.requestId); - }, - - async onPay({ - selectedPayerAddressGUID: payerGUID, - selectedPaymentCardGUID: paymentCardGUID, - selectedPaymentCardSecurityCode: cardSecurityCode, - selectedShippingAddressGUID: shippingGUID, - }) { - let methodData; - try { - methodData = await this._convertProfileBasicCardToPaymentMethodData( - paymentCardGUID, - cardSecurityCode - ); - } catch (ex) { - // TODO (Bug 1498403): Some kind of "credit card storage error" here, perhaps asking user - // to re-enter credit card # from management UI. - Cu.reportError(ex); - return; - } - - if (!methodData) { - // TODO (Bug 1429265/Bug 1429205): Handle when a user hits cancel on the - // Master Password dialog. - Cu.reportError( - "Bug 1429265/Bug 1429205: User canceled master password entry" - ); - return; - } - - let payerName = ""; - let payerEmail = ""; - let payerPhone = ""; - if (payerGUID) { - let payerData = await this._convertProfileAddressToPayerData(payerGUID); - payerName = payerData.payerName; - payerEmail = payerData.payerEmail; - payerPhone = payerData.payerPhone; - } - - // Update the lastUsedTime for the payerAddress and paymentCard. Check if - // the record exists in formAutofillStorage because it may be temporary. - if ( - shippingGUID && - (await formAutofillStorage.addresses.get(shippingGUID)) - ) { - formAutofillStorage.addresses.notifyUsed(shippingGUID); - } - if (payerGUID && (await formAutofillStorage.addresses.get(payerGUID))) { - formAutofillStorage.addresses.notifyUsed(payerGUID); - } - if (await formAutofillStorage.creditCards.get(paymentCardGUID)) { - formAutofillStorage.creditCards.notifyUsed(paymentCardGUID); - } - - this.pay({ - methodName: "basic-card", - methodData, - payerName, - payerEmail, - payerPhone, - }); - }, - - pay({ payerName, payerEmail, payerPhone, methodName, methodData }) { - const showResponse = this.createShowResponse({ - acceptStatus: Ci.nsIPaymentActionResponse.PAYMENT_ACCEPTED, - payerName, - payerEmail, - payerPhone, - methodName, - methodData, - }); - paymentSrv.respondPayment(showResponse); - this.sendMessageToContent("responseSent"); - }, - - async onChangePayerAddress({ payerAddressGUID }) { - if (payerAddressGUID) { - // If a payer address was de-selected e.g. the selected address was deleted, we'll - // just wait to send the address change when the payer address is eventually selected - // before clicking Pay since it's a required field. - let { - payerName, - payerEmail, - payerPhone, - } = await this._convertProfileAddressToPayerData(payerAddressGUID); - paymentSrv.changePayerDetail( - this.request.requestId, - payerName, - payerEmail, - payerPhone - ); - } - }, - - async onChangePaymentMethod({ - selectedPaymentCardBillingAddressGUID: billingAddressGUID, - }) { - const methodName = "basic-card"; - let methodDetails; - try { - let billingAddress = await this._convertProfileAddressToPaymentAddress( - billingAddressGUID - ); - const basicCardChangeDetails = Cc[ - "@mozilla.org/dom/payments/basiccard-change-details;1" - ].createInstance(Ci.nsIBasicCardChangeDetails); - basicCardChangeDetails.initData(billingAddress); - methodDetails = basicCardChangeDetails.QueryInterface( - Ci.nsIMethodChangeDetails - ); - } catch (ex) { - // TODO (Bug 1498403): Some kind of "credit card storage error" here, perhaps asking user - // to re-enter credit card # from management UI. - Cu.reportError(ex); - return; - } - - paymentSrv.changePaymentMethod( - this.request.requestId, - methodName, - methodDetails - ); - }, - - async onChangeShippingAddress({ shippingAddressGUID }) { - if (shippingAddressGUID) { - // If a shipping address was de-selected e.g. the selected address was deleted, we'll - // just wait to send the address change when the shipping address is eventually selected - // before clicking Pay since it's a required field. - let address = await this._convertProfileAddressToPaymentAddress( - shippingAddressGUID - ); - paymentSrv.changeShippingAddress(this.request.requestId, address); - } - }, - - onChangeShippingOption({ optionID }) { - // Note, failing here on browser_host_name.js because the test closes - // the dialog before the onChangeShippingOption is called, thus - // deleting the request and making the requestId invalid. Unclear - // why we aren't seeing the same issue with onChangeShippingAddress. - paymentSrv.changeShippingOption(this.request.requestId, optionID); - }, - - onCloseDialogMessage() { - // The PR is complete(), just close the dialog - paymentUISrv.closePayment(this.request.requestId); - }, - - async onUpdateAutofillRecord(collectionName, record, guid, messageID) { - let responseMessage = { - guid, - messageID, - stateChange: {}, - }; - try { - let isTemporary = record.isTemporary; - let collection = isTemporary - ? this.temporaryStore[collectionName] - : formAutofillStorage[collectionName]; - - if (guid) { - // We want to preserve old properties since the edit forms are often - // shown without all fields visible/enabled and we don't want those - // fields to be blanked upon saving. Examples of hidden/disabled fields: - // email, cc-number, mailing-address on the payer forms, and payer fields - // not requested in the payer form. - let preserveOldProperties = true; - await collection.update(guid, record, preserveOldProperties); - } else { - responseMessage.guid = await collection.add(record); - } - - if (isTemporary && collectionName == "addresses") { - // there will be no formautofill-storage-changed event to update state - // so add updated collection here - Object.assign(responseMessage.stateChange, { - tempAddresses: this.temporaryStore.addresses.getAll(), - }); - } - if (isTemporary && collectionName == "creditCards") { - // there will be no formautofill-storage-changed event to update state - // so add updated collection here - Object.assign(responseMessage.stateChange, { - tempBasicCards: this.fetchTempPaymentCards(), - }); - } - } catch (ex) { - responseMessage.error = true; - Cu.reportError(ex); - } finally { - this.sendMessageToContent( - "updateAutofillRecord:Response", - responseMessage - ); - } - }, - - /** - * @implements {nsIObserver} - * @param {nsISupports} subject - * @param {string} topic - * @param {string} data - */ - observe(subject, topic, data) { - switch (topic) { - case "formautofill-storage-changed": { - if (data == "notifyUsed") { - break; - } - this.onAutofillStorageChange(); - break; - } - case "message-manager-close": { - if (this.mm && subject == this.mm) { - // Remove the observer to avoid message manager errors while the dialog - // is closing and tests are cleaning up autofill storage. - Services.obs.removeObserver(this, "formautofill-storage-changed"); - } - break; - } - } - }, - - receiveMessage({ data }) { - let { messageType } = data; - - switch (messageType) { - case "debugFrame": { - this.debugFrame(); - break; - } - case "initializeRequest": { - this.initializeFrame(); - break; - } - case "changePayerAddress": { - this.onChangePayerAddress(data); - break; - } - case "changePaymentMethod": { - this.onChangePaymentMethod(data); - break; - } - case "changeShippingAddress": { - this.onChangeShippingAddress(data); - break; - } - case "changeShippingOption": { - this.onChangeShippingOption(data); - break; - } - case "closeDialog": { - this.onCloseDialogMessage(); - break; - } - case "openPreferences": { - this.onOpenPreferences(); - break; - } - case "paymentCancel": { - this.onPaymentCancel(); - break; - } - case "paymentDialogReady": { - this.frameWeakRef.get().dispatchEvent( - new Event("tabmodaldialogready", { - bubbles: true, - }) - ); - break; - } - case "pay": { - this.onPay(data); - break; - } - case "updateAutofillRecord": { - this.onUpdateAutofillRecord( - data.collectionName, - data.record, - data.guid, - data.messageID - ); - break; - } - default: { - throw new Error( - `paymentDialogWrapper: Unexpected messageType: ${messageType}` - ); - } - } - }, -}; diff --git a/browser/components/payments/docs/index.rst b/browser/components/payments/docs/index.rst deleted file mode 100644 index e34d64577c..0000000000 --- a/browser/components/payments/docs/index.rst +++ /dev/null @@ -1,110 +0,0 @@ -============== -WebPayments UI -============== - -User Interface for the WebPayments `Payment Request API `_ and `Payment Handler API `_. - - - `Project Wiki `_ | - `#payments on IRC `_ | - `File a bug `_ - -JSDoc style comments are used within the JS files of the component. This document will focus on higher-level and shared concepts. - -.. toctree:: - :maxdepth: 5 - - -Debugging/Development -===================== - -Relevant preferences: ``dom.payments.*`` - -Must Have Electrolysis ----------------------- - -Web Payments `does not work without e10s `_! - -Logging -------- - -Set the pref ``dom.payments.loglevel`` to "Debug" to increase the verbosity of console messages. - -Unprivileged UI Development ---------------------------- -During development of the unprivileged custom elements, you can load the dialog in a tab with -the url `resource://payments/paymentRequest.xhtml`. -You can then use the debugging console to load sample data. Autofill add/edit form strings -will not appear when developing this way until they are converted to FTL. -You can force localization of Form Autofill strings using the following in the Browser Console when -the `paymentRequest.xhtml` tab is selected then reloading:: - - gBrowser.selectedBrowser.messageManager.loadFrameScript("chrome://formautofill/content/l10n.js", true) - - -Debugging Console ------------------ - -To open the debugging console in the dialog, use the keyboard shortcut -**Ctrl-Alt-d (Ctrl-Option-d on macOS)**. While loading `paymentRequest.xhtml` directly in the -browser, add `?debug=1` to have the debugging console open by default. - -Debugging the unprivileged frame with the developer tools -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To open a debugger in the context of the remote payment frame, click the "Debug frame" button in the -debugging console. - -Use the ``tabs`` variable in the Browser Content Toolbox's console to access the frame contents. -There can be multiple frames loaded in the same process so you will need to find the correct tab -in the array by checking the file name is `paymentRequest.xhtml` (e.g. ``tabs[0].content.location``). - - -Dialog Architecture -=================== - -Privileged wrapper XUL document (paymentDialogWrapper.xul) containing a remote ```` containing unprivileged XHTML (paymentRequest.xhtml). -Keeping the dialog contents unprivileged is useful since the dialog will render payment line items and shipping options that are provided by web developers and should therefore be considered untrusted. -In order to communicate across the process boundary a privileged frame script (`paymentDialogFrameScript.js`) is loaded into the iframe to relay messages. -This is because the unprivileged document cannot access message managers. -Instead, all communication across the privileged/unprivileged boundary is done via custom DOM events: - -* A ``paymentContentToChrome`` event is dispatched when the dialog contents want to communicate with the privileged dialog wrapper. -* A ``paymentChromeToContent`` event is dispatched on the ``window`` with the ``detail`` property populated when the privileged dialog wrapper communicates with the unprivileged dialog. - -These events are converted to/from message manager messages of the same name to communicate to the other process. -The purpose of `paymentDialogFrameScript.js` is to simply convert unprivileged DOM events to/from messages from the other process. - -The dialog depends on the add/edit forms and storage from :doc:`Form Autofill ` for addresses and credit cards. - -Communication with the DOM --------------------------- - -Communication from the DOM to the UI happens via the `paymentUIService.js` (implementing ``nsIPaymentUIService``). -The UI talks to the DOM code via the ``nsIPaymentRequestService`` interface. - - -Custom Elements ---------------- - -The Payment Request UI uses `Custom Elements `_ for the UI components. - -Some guidelines: - -* There are some `mixins `_ - to provide commonly needed functionality to a custom element. -* `res/containers/ `_ - contains elements that react to application state changes, - `res/components/ `_ - contains elements that aren't connected to the state directly. -* Elements should avoid having their own internal/private state and should react to state changes. - Containers primarily use the application state (``requestStore``) while components primarily use attributes. -* If you're overriding a lifecycle callback, don't forget to call that method on - ``super`` from the implementation to ensure that mixins and ancestor classes - work properly. -* From within a custom element, don't use ``document.getElementById`` or - ``document.querySelector*`` because they can return elements that are outside - of the component, thus breaking the modularization. It can also cause problems - if the elements you're looking for aren't attached to the document yet. Use - ``querySelector*`` on ``this`` (the custom element) or one of its descendants - instead. diff --git a/browser/components/payments/jar.mn b/browser/components/payments/jar.mn deleted file mode 100644 index 73e8b00a2a..0000000000 --- a/browser/components/payments/jar.mn +++ /dev/null @@ -1,26 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -browser.jar: -% content payments %content/payments/ - content/payments/paymentDialogFrameScript.js (content/paymentDialogFrameScript.js) - content/payments/paymentDialogWrapper.js (content/paymentDialogWrapper.js) - -% resource payments %res/payments/ - res/payments (res/paymentRequest.*) - res/payments/components/ (res/components/*.css) - res/payments/components/ (res/components/*.js) - res/payments/components/ (res/components/*.svg) - res/payments/containers/ (res/containers/*.js) - res/payments/containers/ (res/containers/*.css) - res/payments/containers/ (res/containers/*.svg) - res/payments/debugging.css (res/debugging.css) - res/payments/debugging.html (res/debugging.html) - res/payments/debugging.js (res/debugging.js) - res/payments/formautofill/autofillEditForms.js (../../../browser/extensions/formautofill/content/autofillEditForms.js) - res/payments/formautofill/editAddress.xhtml (../../../browser/extensions/formautofill/content/editAddress.xhtml) - res/payments/formautofill/editCreditCard.xhtml (../../../browser/extensions/formautofill/content/editCreditCard.xhtml) - res/payments/unprivileged-fallbacks.js (res/unprivileged-fallbacks.js) - res/payments/mixins/ (res/mixins/*.js) - res/payments/PaymentsStore.js (res/PaymentsStore.js) diff --git a/browser/components/payments/moz.build b/browser/components/payments/moz.build deleted file mode 100644 index 6a13d595a7..0000000000 --- a/browser/components/payments/moz.build +++ /dev/null @@ -1,34 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] - -with Files('**'): - BUG_COMPONENT = ('Firefox', 'WebPayments UI') - -EXTRA_JS_MODULES += [ - 'PaymentUIService.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', -] - -JAR_MANIFESTS += ['jar.mn'] - -MOCHITEST_MANIFESTS += [ - 'test/mochitest/formautofill/mochitest.ini', - 'test/mochitest/mochitest.ini', -] - -SPHINX_TREES['docs'] = 'docs' - -with Files('docs/**'): - SCHEDULES.exclusive = ['docs'] - -TESTING_JS_MODULES += [ - 'test/PaymentTestUtils.jsm', -] - -XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] diff --git a/browser/components/payments/res/PaymentsStore.js b/browser/components/payments/res/PaymentsStore.js deleted file mode 100644 index 7e439076d8..0000000000 --- a/browser/components/payments/res/PaymentsStore.js +++ /dev/null @@ -1,97 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * The PaymentsStore class provides lightweight storage with an async publish/subscribe mechanism. - * Synchronous state changes are batched to improve application performance and to reduce partial - * state propagation. - */ - -export default class PaymentsStore { - /** - * @param {object} [defaultState = {}] The initial state of the store. - */ - constructor(defaultState = {}) { - this._defaultState = Object.assign({}, defaultState); - this._state = defaultState; - this._nextNotifification = 0; - this._subscribers = new Set(); - } - - /** - * Get the current state as a shallow clone with a shallow freeze. - * You shouldn't modify any part of the returned state object as that would bypass notifying - * subscribers and could lead to subscribers assuming old state. - * - * @returns {Object} containing the current state - */ - getState() { - return Object.freeze(Object.assign({}, this._state)); - } - - /** - * Used for testing to reset to the default state from the constructor. - * @returns {Promise} returned by setState. - */ - async reset() { - return this.setState(this._defaultState); - } - - /** - * Augment the current state with the keys of `obj` and asynchronously notify - * state subscribers. As a result, multiple synchronous state changes will lead - * to a single subscriber notification which leads to better performance and - * reduces partial state changes. - * - * @param {Object} obj The object to augment the state with. Keys in the object - * will be shallow copied with Object.assign. - * - * @example If the state is currently {a:3} then setState({b:"abc"}) will result in a state of - * {a:3, b:"abc"}. - */ - async setState(obj) { - Object.assign(this._state, obj); - let thisChangeNum = ++this._nextNotifification; - - // Let any synchronous setState calls that happen after the current setState call - // complete first. - // Their effects on the state will be batched up before the callback is actually called below. - await Promise.resolve(); - - // Don't notify for state changes that are no longer the most recent. We only want to call the - // callback once with the latest state. - if (thisChangeNum !== this._nextNotifification) { - return; - } - - for (let subscriber of this._subscribers) { - try { - subscriber.stateChangeCallback(this.getState()); - } catch (ex) { - console.error(ex); - } - } - } - - /** - * Subscribe the object to state changes notifications via a `stateChangeCallback` method. - * - * @param {Object} component to receive state change callbacks via a `stateChangeCallback` method. - * If the component is already subscribed, do nothing. - */ - subscribe(component) { - if (this._subscribers.has(component)) { - return; - } - - this._subscribers.add(component); - } - - /** - * @param {Object} component to stop receiving state change callbacks. - */ - unsubscribe(component) { - this._subscribers.delete(component); - } -} diff --git a/browser/components/payments/res/components/accepted-cards.css b/browser/components/payments/res/components/accepted-cards.css deleted file mode 100644 index a45d6e2513..0000000000 --- a/browser/components/payments/res/components/accepted-cards.css +++ /dev/null @@ -1,104 +0,0 @@ -accepted-cards { - margin: 1em 0; - display: flex; - flex-wrap: nowrap; - align-items: first baseline; -} - -.accepted-cards-label { - display: inline-block; - font-size: smaller; - flex: 0 2 content; - white-space: nowrap; -} - -.accepted-cards-list { - display: inline-block; - list-style-type: none; - margin: 0; - padding: 0; - flex: 2 1 auto; -} - -.accepted-cards-list > .accepted-cards-item { - display: inline-block; - width: 32px; - height: 32px; - padding: 0; - margin: 5px 0; - margin-inline-start: 10px; - vertical-align: middle; - background-repeat: no-repeat; - background-position: center; - background-size: contain; -} - -/* placeholders for specific card icons we don't yet have assets for */ -accepted-cards:not(.branded) .accepted-cards-item[data-network-id] { - width: 48px; - text-align: center; - background-image: url("./card-icon.svg"); - -moz-context-properties: fill-opacity; - fill-opacity: 0.5; -} -accepted-cards:not(.branded) .accepted-cards-item[data-network-id]::after { - box-sizing: border-box; - content: attr(data-network-id); - padding: 8px 4px 0 4px; - text-align: center; - font-size: 0.7rem; - display: inline-block; - overflow: hidden; - width: 100%; -} - -/* - We use .png / @2x.png images where we don't yet have a vector version of a logo -*/ -.accepted-cards-item[data-network-id="amex"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-amex.png"); -} - -.accepted-cards-item[data-network-id="cartebancaire"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-cartebancaire.png"); -} - -.accepted-cards-item[data-network-id="diners"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-diners.svg"); -} - -.accepted-cards-item[data-network-id="discover"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-discover.png"); -} - -.accepted-cards-item[data-network-id="jcb"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-jcb.svg"); -} - -.accepted-cards-item[data-network-id="mastercard"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-mastercard.svg"); -} - -.accepted-cards-item[data-network-id="mir"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-mir.svg"); -} - -.accepted-cards-item[data-network-id="unionpay"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-unionpay.svg"); -} - -.accepted-cards-item[data-network-id="visa"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-visa.svg"); -} - -@media (min-resolution: 1.1dppx) { - .accepted-cards-item[data-network-id="amex"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-amex@2x.png"); - } - .accepted-cards-item[data-network-id="cartebancaire"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-cartebancaire@2x.png"); - } - .accepted-cards-item[data-network-id="discover"] { - background-image: url("chrome://formautofill/content/third-party/cc-logo-discover@2x.png"); - } -} diff --git a/browser/components/payments/res/components/accepted-cards.js b/browser/components/payments/res/components/accepted-cards.js deleted file mode 100644 index c66e040576..0000000000 --- a/browser/components/payments/res/components/accepted-cards.js +++ /dev/null @@ -1,75 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -import PaymentStateSubscriberMixin from "../mixins/PaymentStateSubscriberMixin.js"; -/* import-globals-from ../unprivileged-fallbacks.js */ - -/** - * - */ - -export default class AcceptedCards extends PaymentStateSubscriberMixin( - HTMLElement -) { - constructor() { - super(); - - this._listEl = document.createElement("ul"); - this._listEl.classList.add("accepted-cards-list"); - this._labelEl = document.createElement("span"); - this._labelEl.classList.add("accepted-cards-label"); - } - - connectedCallback() { - this.label = this.getAttribute("label"); - this.appendChild(this._labelEl); - - this._listEl.textContent = ""; - let allNetworks = PaymentDialogUtils.getCreditCardNetworks(); - for (let network of allNetworks) { - let item = document.createElement("li"); - item.classList.add("accepted-cards-item"); - item.dataset.networkId = network; - item.setAttribute("aria-role", "image"); - item.setAttribute("aria-label", network); - this._listEl.appendChild(item); - } - let isBranded = PaymentDialogUtils.isOfficialBranding(); - this.classList.toggle("branded", isBranded); - this.appendChild(this._listEl); - // Only call the connected super callback(s) once our markup is fully - // connected - super.connectedCallback(); - } - - render(state) { - let basicCardMethod = state.request.paymentMethods.find( - method => method.supportedMethods == "basic-card" - ); - let merchantNetworks = - basicCardMethod && - basicCardMethod.data && - basicCardMethod.data.supportedNetworks; - if (merchantNetworks && merchantNetworks.length) { - for (let item of this._listEl.children) { - let network = item.dataset.networkId; - item.hidden = !(network && merchantNetworks.includes(network)); - } - this.hidden = false; - } else { - // hide the whole list if the merchant didn't specify a preference - this.hidden = true; - } - } - - set label(value) { - this._labelEl.textContent = value; - } - - get acceptedItems() { - return Array.from(this._listEl.children).filter(item => !item.hidden); - } -} - -customElements.define("accepted-cards", AcceptedCards); diff --git a/browser/components/payments/res/components/address-option.css b/browser/components/payments/res/components/address-option.css deleted file mode 100644 index 9619048ae6..0000000000 --- a/browser/components/payments/res/components/address-option.css +++ /dev/null @@ -1,29 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -address-option.rich-option { - grid-row-gap: 5px; -} - -address-option > .line { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -address-option > .line:empty { - /* Hide the 2nd line in cases where it's empty - (e.g. payer field with one or two fields requested) */ - display: none; -} - -address-option > .line > span { - white-space: nowrap; -} - -address-option > .line > span:empty::before { - /* Show the string for missing fields in grey when the field is empty */ - color: GrayText; - content: attr(data-missing-string); -} diff --git a/browser/components/payments/res/components/address-option.js b/browser/components/payments/res/components/address-option.js deleted file mode 100644 index f0c06a0268..0000000000 --- a/browser/components/payments/res/components/address-option.js +++ /dev/null @@ -1,159 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* import-globals-from ../../../../../browser/extensions/formautofill/content/autofillEditForms.js*/ -import ObservedPropertiesMixin from "../mixins/ObservedPropertiesMixin.js"; -import RichOption from "./rich-option.js"; -/* import-globals-from ../unprivileged-fallbacks.js */ - -/** - * Up to two-line address display. After bug 1475684 this will also be used for - * the single-line