From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out.smtp-auth.no-ip.com (smtp-auth.no-ip.com [8.23.224.60]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 07F2D21DE04 for ; Thu, 17 Sep 2020 05:25:52 -0700 (PDT) X-No-IP: carhart.net@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from phoenix.carhart.net (unknown [99.57.137.251]) (Authenticated sender: carhart.net@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 9510F37FE7B for ; Thu, 17 Sep 2020 05:25:52 -0700 (PDT) Received: from unknown (carhart.net [127.0.0.1]) by phoenix.carhart.net (8.15.2/8.15.2) with ESMTP id 08HCPpue001815; Thu, 17 Sep 2020 05:25:52 -0700 To:Edbrowse-dev@lists.the-brannons.com CC:kevin@carhart.net From: Kevin Carhart Reply-to: Kevin Carhart User-Agent: edbrowse/3.7.2 Subject: [edbrowse-dev] [PATCH] postMessage Date: Thu, 17 Sep 2020 05:25:51 -0700 Message-ID: <20200817052551.kevin@carhart.net > X-BeenThere: edbrowse-dev@edbrowse.org List-Id: Edbrowse Development List Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=nextpart-eb-735450 Content-Transfer-Encoding: 7bit This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --nextpart-eb-735450 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >From 47af154701fc0f143f3bd924cb308f65be284aba Mon Sep 17 00:00:00 2001 From: Kevin Carhart Date: Thu, 17 Sep 2020 05:16:01 -0700 Subject: [PATCH] implement window.postMessage --- src/startwindow.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/startwindow.js b/src/startwindow.js index 196e626..5d27536 100644 --- a/src/startwindow.js +++ b/src/startwindow.js @@ -1136,6 +1136,25 @@ if(this.height =3D=3D=3D 0 || this.width = =3D=3D=3D 0) return "data:,"; return = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAD= ElEQVQImWNgoBMAAABpAAFEI8ARAAAAAElFTkSuQmCC"; } =20 +mw0.postMessage =3D function (message,target_origin) +{ +if (this.location.protocol + "//" + this.location.hostname =3D=3D = target_origin || target_origin =3D=3D "*") +{ +if (this.onmessage || this.onmessage$$array) +{ +// whose responsibility is it to add the event handler? The web = developer's? +// Because we (the browser implementers) don't have any way of knowing = what in particular +// they want the handler to actually do with the message. Right? +var me =3D new Event; +me.name =3D "message"; +me.type =3D "message"; +me.data =3D message +this.onmessage(me); +} +} +} + + /********************************************************************* AudioContext, for playing music etc. This one we could implement, but I'm not sure if we should. @@ -3626,6 +3645,7 @@ Timer =3D mw0.Timer; Audio =3D mw0.Audio; Canvas =3D mw0.Canvas; AudioContext =3D mw0.AudioContext; +window.postMessage =3D postMessage =3D mw0.postMessage; Document =3D mw0.Document; CSSStyleSheet =3D mw0.CSSStyleSheet; CSSStyleDeclaration =3D mw0.CSSStyleDeclaration; --=20 1.8.3.2 --nextpart-eb-735450--