commit 39b3fd7fc6a1dcf0e36d3ab8e5081c268a663fad
parent 5bea586218258e538cb79fcacf34f6c4bfd80ff7
Author: tg(x) <*@tg-x.net>
Date: Wed, 5 Oct 2016 02:10:56 +0200
use cloneInto when passing objects from content_script to page
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/lib/shopApi.ts b/lib/shopApi.ts
@@ -22,7 +22,9 @@
* @author Florian Dold
*/
+"use strict";
+declare var cloneInto: any;
function subst(url: string, H_contract: string) {
url = url.replace("${H_contract}", H_contract);
@@ -122,13 +124,17 @@ export function fetchPayment(H_contract: any, offering_url: any) {
// We have the details for then payment, the merchant page
// is responsible to give it to the merchant.
- let evt = new CustomEvent("taler-notify-payment", {
+ let opts = {
detail: {
H_contract: H_contract,
contract: resp.contract,
payment: resp.payReq,
}
- });
+ };
+ if ("function" == typeof cloneInto) {
+ opts = cloneInto(opts, document.defaultView);
+ }
+ let evt = new CustomEvent("taler-notify-payment", opts);
document.dispatchEvent(evt);
});
}
@@ -166,4 +172,4 @@ function offerContractFrom(url: string) {
+ contract_request.statusText);
};
contract_request.send();
-}
-\ No newline at end of file
+}