Bug 966942 - Convert nsIDOMPaymentRequestInfo to a dictionary. r=bz, r=ferjm
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 05 Feb 2014 13:11:14 -0500
changeset 178057 67c9d01668dfbf6aba9fb99d324c482041bd499d
parent 178056 f4784457271eadee12bf650f6a716efa1d8d7996
child 178058 1e9f169c97155f464e7c623c5e504d55248c23a0
child 178183 cd6558ae6711ac2c52ac8fa4015a00eeff284260
push id5439
push userffxbld
push dateMon, 17 Mar 2014 23:08:15 +0000
treeherdermozilla-aurora@c0befb3c8038 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, ferjm
bugs966942
milestone30.0a1
Bug 966942 - Convert nsIDOMPaymentRequestInfo to a dictionary. r=bz, r=ferjm
b2g/installer/package-manifest.in
browser/installer/package-manifest.in
dom/payment/Payment.jsm
dom/payment/Payment.manifest
dom/payment/PaymentRequestInfo.js
dom/payment/interfaces/moz.build
dom/payment/interfaces/nsIDOMPaymentRequestInfo.idl
dom/payment/moz.build
mobile/android/installer/package-manifest.in
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -559,17 +559,16 @@
 
 @BINPATH@/components/TCPSocket.js
 @BINPATH@/components/TCPServerSocket.js
 @BINPATH@/components/TCPSocketParentIntermediary.js
 @BINPATH@/components/TCPSocket.manifest
 
 @BINPATH@/components/Payment.js
 @BINPATH@/components/PaymentFlowInfo.js
-@BINPATH@/components/PaymentRequestInfo.js
 @BINPATH@/components/Payment.manifest
 
 @BINPATH@/components/DownloadsAPI.js
 @BINPATH@/components/DownloadsAPI.manifest
 
 ; InputMethod API
 @BINPATH@/components/MozKeyboard.js
 @BINPATH@/components/InputMethod.manifest
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -564,17 +564,16 @@
 @BINPATH@/components/ActivityProxy.js
 @BINPATH@/components/ActivityRequestHandler.js
 @BINPATH@/components/ActivityWrapper.js
 @BINPATH@/components/ActivityMessageConfigurator.js
 #endif
 
 @BINPATH@/components/Payment.js
 @BINPATH@/components/PaymentFlowInfo.js
-@BINPATH@/components/PaymentRequestInfo.js
 @BINPATH@/components/Payment.manifest
 
 #ifdef MOZ_WEBRTC
 @BINPATH@/components/PeerConnection.js
 @BINPATH@/components/PeerConnection.manifest
 #endif
 
 @BINPATH@/components/HttpDataUsage.manifest
--- a/dom/payment/Payment.jsm
+++ b/dom/payment/Payment.jsm
@@ -88,19 +88,16 @@ let PaymentManager =  {
         // information.
         let paymentRequests = [];
         let jwtTypes = [];
         for (let i in msg.jwts) {
           let pr = this.getPaymentRequestInfo(requestId, msg.jwts[i]);
           if (!pr) {
             continue;
           }
-          if (!(pr instanceof Ci.nsIDOMPaymentRequestInfo)) {
-            return;
-          }
           // We consider jwt type repetition an error.
           if (jwtTypes[pr.type]) {
             this.paymentFailed(requestId,
                                "PAY_REQUEST_ERROR_DUPLICATED_JWT_TYPE");
             return;
           }
           jwtTypes[pr.type] = true;
           paymentRequests.push(pr);
@@ -337,27 +334,17 @@ let PaymentManager =  {
         this.LOG("Payment provider uris must be https: " + provider.uri);
       }
       this.paymentFailed(aRequestId,
                          "INTERNAL_ERROR_NON_HTTPS_PROVIDER_URI");
       return true;
     }
 
     let pldRequest = payloadObject.request;
-    let request = Cc["@mozilla.org/payment/request-info;1"]
-                  .createInstance(Ci.nsIDOMPaymentRequestInfo);
-    if (!request) {
-      this.paymentFailed(aRequestId,
-                         "INTERNAL_ERROR_ERROR_CREATING_PAY_REQUEST");
-      return true;
-    }
-    request.wrappedJSObject.init(aJwt,
-                                 payloadObject.typ,
-                                 provider.name);
-    return request;
+    return { jwt: aJwt, type: payloadObject.typ, providerName: provider.name };
   },
 
   showPaymentFlow: function showPaymentFlow(aRequestId,
                                             aPaymentProvider,
                                             aJwt) {
     let paymentFlowInfo = Cc["@mozilla.org/payment/flow-info;1"]
                           .createInstance(Ci.nsIPaymentFlowInfo);
     paymentFlowInfo.uri = aPaymentProvider.uri;
--- a/dom/payment/Payment.manifest
+++ b/dom/payment/Payment.manifest
@@ -1,9 +1,6 @@
 component {a920adc0-c36e-4fd0-8de0-aac1ac6ebbd0} Payment.js
 contract @mozilla.org/payment/content-helper;1 {a920adc0-c36e-4fd0-8de0-aac1ac6ebbd0}
 category JavaScript-navigator-property mozPay @mozilla.org/payment/content-helper;1
 
 component {b8bce4e7-fbf0-4719-a634-b1bf9018657c} PaymentFlowInfo.js
 contract @mozilla.org/payment/flow-info;1 {b8bce4e7-fbf0-4719-a634-b1bf9018657c}
-
-component {0a58c67d-f003-48da-81d1-bd8f605f4b1c} PaymentRequestInfo.js
-contract @mozilla.org/payment/request-info;1 {0a58c67d-f003-48da-81d1-bd8f605f4b1c}
deleted file mode 100644
--- a/dom/payment/PaymentRequestInfo.js
+++ /dev/null
@@ -1,41 +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/. */
-
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-const PAYMENTREQUESTINFO_CID =
-  Components.ID("{0a58c67d-f003-48da-81d1-bd8f605f4b1c}");
-
-// nsIDOMPaymentRequestInfo
-
-function PaymentRequestInfo() {
-  this.wrappedJSObject = this;
-};
-
-PaymentRequestInfo.prototype = {
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMPaymentRequestInfo]),
-  classID: PAYMENTREQUESTINFO_CID,
-  classInfo: XPCOMUtils.generateCI({
-    classID: PAYMENTREQUESTINFO_CID,
-    contractID: "@mozilla.org/payment/request-info;1",
-    classDescription: "Payment request information",
-    flags: Ci.nsIClassInfo.DOM_OBJECT,
-    interfaces: [Ci.nsIDOMPaymentRequestInfo]
-  }),
-  jwt: null,
-  type: null,
-  providerName: null,
-
-  init: function init(aJwt, aType, aProviderName) {
-    this.jwt = aJwt;
-    this.type = aType;
-    this.providerName = aProviderName;
-  }
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PaymentRequestInfo]);
--- a/dom/payment/interfaces/moz.build
+++ b/dom/payment/interfaces/moz.build
@@ -1,15 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 XPIDL_SOURCES += [
-    'nsIDOMPaymentRequestInfo.idl',
     'nsINavigatorPayment.idl',
     'nsIPaymentFlowInfo.idl',
     'nsIPaymentUIGlue.idl',
 ]
 
 XPIDL_MODULE = 'dom_payment'
 
deleted file mode 100644
--- a/dom/payment/interfaces/nsIDOMPaymentRequestInfo.idl
+++ /dev/null
@@ -1,19 +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/. */
-
-#include "nsISupports.idl"
-
-[scriptable, uuid(93462984-0e9a-4016-bdb4-a24a88c08a29)]
-interface nsIDOMPaymentRequestInfo : nsISupports
-{
-  // Base64 encoded and digitally signed payment request.
-  readonly attribute DOMString jwt;
-
-  // JWT type that identifies the payment provider owner of the payment request
-  // format.
-  readonly attribute DOMString type;
-
-  // Payment provider name.
-  readonly attribute DOMString providerName;
-};
--- a/dom/payment/moz.build
+++ b/dom/payment/moz.build
@@ -11,11 +11,10 @@ TEST_DIRS += ['tests']
 EXTRA_JS_MODULES += [
     'Payment.jsm',
 ]
 
 EXTRA_COMPONENTS += [
     'Payment.js',
     'Payment.manifest',
     'PaymentFlowInfo.js',
-    'PaymentRequestInfo.js',
 ]
 
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -580,17 +580,16 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DL
 @BINPATH@/components/NSSDialogService.js
 @BINPATH@/components/PromptService.js
 @BINPATH@/components/SessionStore.js
 @BINPATH@/components/Sidebar.js
 @BINPATH@/components/Snippets.js
 
 @BINPATH@/components/Payment.js
 @BINPATH@/components/PaymentFlowInfo.js
-@BINPATH@/components/PaymentRequestInfo.js
 @BINPATH@/components/Payment.manifest
 @BINPATH@/components/PaymentsUI.js
 
 #ifdef MOZ_SAFE_BROWSING
 @BINPATH@/components/SafeBrowsing.jsm
 #endif
 @BINPATH@/components/XPIDialogService.js
 @BINPATH@/components/browsercomps.xpt