From 39b3fd7fc6a1dcf0e36d3ab8e5081c268a663fad Mon Sep 17 00:00:00 2001 From: "tg(x)" <*@tg-x.net> Date: Wed, 5 Oct 2016 02:10:56 +0200 Subject: use cloneInto when passing objects from content_script to page --- lib/shopApi.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/shopApi.ts') diff --git a/lib/shopApi.ts b/lib/shopApi.ts index 7cc37a9db..bd0993068 100644 --- 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 +} -- cgit v1.2.3