2015 Mar 11, 9:57 2015 Mar 4, 4:44 2013 Jul 15, 1:00
In IE10 and other new browsers one may create MessageChannel objects that have two MessagePorts each connected (w3c spec calls it entangled) to one another such that postMessage on one port
results in the message event firing on the other. You can pass an array of ports as the last parameter to postMessage and they show up in the ports property of the message event arg.
Origin
The postMessage here is like the worker postMessage and unlike the window and iframe postMessage in that it applies no origin checking:
- No origin postMessage in workers and MessagePorts: postMessage(messageData, ports)
- Origin postMessage in windows and iframes: postMessage(messageData, targetOrigin, ports)
Unfortunately the origin isn't an optional parameter at the end to make the two postMessages have the same signature.
On the event handler side, the event arg always has an origin property. But in the no origin case it is always the empty string.
Source
There is also a source property on the message event arg which if set is an object that has a postMessage property allowing you to post back to your caller. It is set for the origin case,
however, in the no origin case this property is null. This is somewhat reasonable because in the case of MessagePort and Workers there are only two endpoints so you always know the source of a
message implicitly. Unlike the origin case in which any iframe or window can be calling postMessage on any other iframe or window and the caller is unknown. So not unreasonable but it would be
nice if the source property was always set for consistency.
MessageChannel start
When a MessageChannel is created it has two MessagePorts, but until those ports are started they will queue up any messages they receive. Once started they will dispatch all queued messages.
Ports don't have to be started to send messages.
A port may be started in two ways, either by explicitly calling the start method on the port, or by setting the onmessage callback property on the port. However, adding an event listener via
addEventListener("message", does not start the port. It works this way in IE and Chrome and the spec states this as well.
The justification is that since you can have only one callback via onmessage that once set you must implicitly be ready to receive messages and its fine to start the port. As opposed to the
addEventListener in which case the user agent cannot start implicitly because it doesn't know how many event listeners will be added. I found Hixie stating this justification in geoloc meeting notes.
Links
W3C Spec
Opera introduction
DOM html javascript postMessage technical web-worker worker 2009 Oct 8, 4:59A brief introduction to Hadoop, its history, subprojects, and current status
via:pskomoroch hadoop introduction google yahoo facebook database technical 2009 Sep 12, 3:57"An introduction to Apple's Hypercard... Originally broadcast in 1987."
history apple hypercard mac computer programming video 2009 Apr 29, 1:06More than three decades after the Clean Water Act, iconic American waterways like the Chesapeake Bay and Puget Sound are in perilous condition and facing new sources of contamination.
todo via:jen video pbs environment 2008 Jul 22, 10:58"ICANN Generic Names Supporting Organisation - Final Report: Introduction of New Generic Top-Level Domains"
icann tld dns reference 2007 Oct 3, 11:29University of Michigan's collection 'Traditions of Magic'.
magic history research michigan 2007 Sep 12, 6:54I'm visiting
Wikipedia more and more recently but I always find myself reading the referenced webpages to get the full context of quotes and for
more info. Basically I use Wikipedia as an introduction and a place to look for links. For times when I'm looking for opinions rather than facts I like to use
Everything2. No need to check references there.
There's the much hyped
WikiScanner tool which reports who has been making anonymous (thought to be anonymous at the time anyway) edits to
Wikipedia. Its humorous and interesting in a few cases, but in general I think its stretching to say that because an IP address range is owned by a corporation and someone edited Wikipedia on an IP
in that range that you can attribute that edit to that corporation. If I edited Wikipedia I'd probably do a bit of that during my lunch break, but that wouldn't mean that Microsoft wants the
Wikipedia pages for Weird Al, Dave Risney, URIs, or whatever else I would edit on Wikipedia changed.
Also, via
Everything Is Miscellaneous I found the tool
Wiki Dashboard. Wiki Dashboard proxies
Wikipedia and on each page shows a timeline view at the top with who made edits and when. Its nice to see a gentle curve down from an initial spike at the beginning for topics you don't imagine to be
controversial. As the canonical test page for this service I looked up 'Elephant' the
Wikipedia page Stephen Colbert
suggested folks vandalize on his show on 2006 July 31st. If you look at the
Wiki Dashboard Elephant page you can see a very large spike
in edits on that date. That's all I need to see.
As a side note, for the link on Stephen Colbert suggesting folks vandalize Wikipedia I linked to a Wikipedia article. Is it inappropriate to provide info about Wikipedia being vandalized and thus
incorrect via a link to a Wikipedia article?
wikidashboard stephen-colbert wikality wikipedia wikiscanner colbert-report 2007 Apr 18, 1:04I just purchased this camera.
camera photo review shopping photography canon sd800 2005 Jul 15, 8:09A Gentle Introduction to SGML
sgml html xml w3c reference 2005 Mar 27, 5:54Introduction of the Bad Boys of Punctuation
comic penny-arcade punctuation humor