edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Kevin Carhart <kevin@carhart.net>
To: Edbrowse-dev@lists.the-brannons.com
Cc: kevin@carhart.net
Subject: [edbrowse-dev] [PATCH] postMessage
Date: Thu, 17 Sep 2020 16:42:07 -0700
Message-ID: <20200817164207.kevin@carhart.net > (raw)

[-- Attachment #1: Type: text/plain, Size: 1683 bytes --]

From 47af154701fc0f143f3bd924cb308f65be284aba Mon Sep 17 00:00:00 2001
From: Kevin Carhart <kevin@carhart.net>
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 === 0 || this.width === 0) return "data:,";
 return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAADElEQVQImWNgoBMAAABpAAFEI8ARAAAAAElFTkSuQmCC";
 }
 
+mw0.postMessage = function (message,target_origin)
+{
+if (this.location.protocol + "//" + this.location.hostname == target_origin || target_origin == "*")
+{
+if (typeof this.onmessage == "function")
+{
+// 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 = new Event;
+me.name = "message";
+me.type = "message";
+me.data = 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 = mw0.Timer;
 Audio = mw0.Audio;
 Canvas = mw0.Canvas;
 AudioContext = mw0.AudioContext;
+postMessage = mw0.postMessage;
 Document = mw0.Document;
 CSSStyleSheet = mw0.CSSStyleSheet;
 CSSStyleDeclaration = mw0.CSSStyleDeclaration;
-- 
1.8.3.2



             reply	other threads:[~2020-09-17 23:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 23:42 Kevin Carhart [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-09-17 12:25 Kevin Carhart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20200817164207.kevin@carhart.net ' \
    --to=kevin@carhart.net \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

edbrowse-dev - development list for edbrowse

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/edbrowse-dev

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 edbrowse-dev edbrowse-dev/ http://inbox.vuxu.org/edbrowse-dev \
		edbrowse-dev@edbrowse.org
	public-inbox-index edbrowse-dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.edbrowse.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git