Skip to content

Commit

Permalink
[o] (2) Include a lastEventId field on the event for <event-source>.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@1479 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 23, 2008
1 parent 3db6c86 commit a787d77
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 40 deletions.
67 changes: 42 additions & 25 deletions index
Expand Up @@ -36785,18 +36785,19 @@ XXX Once we resolve the style="" issue, address these:

<h3 id=event1><span class=secno>6.1 </span>Event definitions</h3>

<p>Messages in <a href="#cross-document">cross-document messaging</a> and,
by default, in <a href="#server-sent">server-sent DOM events</a>, use the
<dfn id=message0 title=event-message><code>message</code></dfn> event.
<p>Messages in <a href="#cross-document">cross-document messaging</a> and
in <a href="#server-sent">server-sent DOM events</a>, use the <dfn
id=message0 title=event-message><code>message</code></dfn> event.

<p>The following interface is defined for this event:

<pre class=idl>interface <dfn id=messageevent>MessageEvent</dfn> : Event {
readonly attribute DOMString <a href="#data4" title=dom-MessageEvent-data>data</a>;
readonly attribute DOMString <span title=dom-MessageEvent-origin>origin</span>;
readonly attribute DOMString <a href="#origin1" title=dom-MessageEvent-origin>origin</a>;
readonly attribute DOMString <a href="#lasteventid" title=dom-MessageEvent-lastEventId>lastEventId</a>;
readonly attribute <a href="#window">Window</a> <a href="#source2" title=dom-MessageEvent-source>source</a>;
void <a href="#initmessageevent" title=dom-MessageEvent-initMessageEvent>initMessageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in Window sourceArg);
void <a href="#initmessageeventns" title=dom-MessageEvent-initMessageEventNS>initMessageEventNS</a>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in Window sourceArg);
void <a href="#initmessageevent" title=dom-MessageEvent-initMessageEvent>initMessageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in Window sourceArg);
void <a href="#initmessageeventns" title=dom-MessageEvent-initMessageEventNS>initMessageEventNS</a>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in Window sourceArg);
};</pre>

<p>The <dfn id=initmessageevent
Expand All @@ -36811,12 +36812,17 @@ XXX Once we resolve the style="" issue, address these:
attribute represents the message being sent.

<p>The <dfn id=origin1
title=dom-MessageEvent-domain><code>origin</code></dfn> attribute
title=dom-MessageEvent-origin><code>origin</code></dfn> attribute
represents, in <a href="#cross-document">cross-document messaging</a>, the
<a href="#origin0">origin</a> of the document that sent the message
(typically the scheme, hostname, and port of the document, but not its
path or fragment identifier).

<p>The <dfn id=lasteventid
title=dom-MessageEvent-lastEventId><code>lastEventId</code></dfn>
attribute represents, in <a href="#server-sent">server-sent dom
events</a>, the <span>last event ID string</span> of the event source.

<p>The <dfn id=source2
title=dom-MessageEvent-source><code>source</code></dfn> attribute
represents, in <a href="#cross-document">cross-document messaging</a>, the
Expand Down Expand Up @@ -37107,8 +37113,7 @@ XXX Once we resolve the style="" issue, address these:
<dt>If the field name is "event"

<dd>
<p>Set the <var title="">event name</var> buffer the field value. <a
href="#refsXMLNS">[XMLNS]</a>
<p>Set the <var title="">event name</var> buffer the to field value.

<dt>If the field name is "data"

Expand Down Expand Up @@ -37141,7 +37146,7 @@ XXX Once we resolve the style="" issue, address these:
<p>The field is ignored.
</dl>

<p id=dispatchEvent>When the user agent is required to <dfn id=dispatch
<p id=dispatchMessage>When the user agent is required to <dfn id=dispatch
title="">dispatch the event</dfn>, then the user agent must act as
follows:

Expand All @@ -37165,10 +37170,14 @@ XXX Once we resolve the style="" issue, address these:
which does not bubble, is cancelable, and has no default action. The
<code title=dom-MessageEvent-data><a href="#data4">data</a></code>
attribute must be set to the value of the <var title="">data</var>
buffer, the <code title=dom-MessageEvent-origin>origin</code> attribute
must be set to the <a href="#origin0">origin</a> of the event stream,
and the <code title=dom-MessageEvent-source><a
href="#source2">source</a></code> attribute must be set to null.
buffer, the <code title=dom-MessageEvent-origin><a
href="#origin1">origin</a></code> attribute must be set to the <a
href="#origin0">origin</a> of the event stream, the <code
title=dom-MessageEvent-lastEventId><a
href="#lasteventid">lastEventId</a></code> attribute must be set to the
<span>last event ID string</span> of the event source, and the <code
title=dom-MessageEvent-source><a href="#source2">source</a></code>
attribute must be set to null.

<li>
<p>If the <var title="">event name</var> buffer has a value other than
Expand All @@ -37185,6 +37194,12 @@ XXX Once we resolve the style="" issue, address these:
the event stream is registered.
</ol>

<p class=note>If an event doesn't have an "id" field, but an earlier event
did set the event source's <span>last event ID string</span>, then the
event's <code title=dom-MessageEvent-lastEventId><a
href="#lasteventid">lastEventId</a></code> field will be set to the value
of whatever the last seen "id" field was.

<div class=example>
<p>The following event stream, once followed by a blank line:</p>

Expand Down Expand Up @@ -38227,13 +38242,15 @@ data:&nbsp;test</pre>
title="">message</var> argument to the <code
title=dom-window-postMessage><a
href="#postmessage">postMessage()</a></code> method, the <code
title=dom-MessageEvent-origin>origin</code> attribute must be set to the
<a href="#origin0">origin</a> of the document that the script that
invoked the methods is associated with, and the <code
title=dom-MessageEvent-source><a href="#source2">source</a></code>
attribute must be set to the <code><a href="#window">Window</a></code>
object of the default view of the browsing context with which that
document is associated.</p>
title=dom-MessageEvent-origin><a href="#origin1">origin</a></code>
attribute must be set to the <a href="#origin0">origin</a> of the
document that the script that invoked the methods is associated with,
the <code title=dom-MessageEvent-lastEventId><a
href="#lasteventid">lastEventId</a></code> attribute must be set to the
empty string, and the <code title=dom-MessageEvent-source><a
href="#source2">source</a></code> attribute must be set to the <code><a
href="#window">Window</a></code> object of the default view of the
browsing context with which that document is associated.</p>

<p class=issue>Define 'origin' more exactly -- IDN vs no IDN, effect of
window.document.domain on its value, etc</p>
Expand All @@ -38250,10 +38267,10 @@ data:&nbsp;test</pre>
and event listeners have been executed as appropriate).

<p class=warning>Authors should check the <code
title=dom-MessageEvent-origin>origin</code> attribute to ensure that
messages are only accepted from domains that they expect to receive
messages from. Otherwise, bugs in the author's message handling code could
be exploited by hostile sites.
title=dom-MessageEvent-origin><a href="#origin1">origin</a></code>
attribute to ensure that messages are only accepted from domains that they
expect to receive messages from. Otherwise, bugs in the author's message
handling code could be exploited by hostile sites.

<p class=warning>Authors should include the <var title="">origin</var>
argument in messages that contain any confidential information, to make
Expand Down
47 changes: 32 additions & 15 deletions source
Expand Up @@ -34224,18 +34224,19 @@ XXX Once we resolve the style="" issue, address these:

<h3>Event definitions</h3>

<p>Messages in <span>cross-document messaging</span> and, by
default, in <span>server-sent DOM events</span>, use the <dfn
<p>Messages in <span>cross-document messaging</span> and in
<span>server-sent DOM events</span>, use the <dfn
title="event-message"><code>message</code></dfn> event.</p>

<p>The following interface is defined for this event:</p>

<pre class="idl">interface <dfn>MessageEvent</dfn> : Event {
readonly attribute DOMString <span title="dom-MessageEvent-data">data</span>;
readonly attribute DOMString <span title="dom-MessageEvent-origin">origin</span>;
readonly attribute DOMString <span title="dom-MessageEvent-lastEventId">lastEventId</span>;
readonly attribute <span>Window</span> <span title="dom-MessageEvent-source">source</span>;
void <span title="dom-MessageEvent-initMessageEvent">initMessageEvent</span>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in Window sourceArg);
void <span title="dom-MessageEvent-initMessageEventNS">initMessageEventNS</span>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in Window sourceArg);
void <span title="dom-MessageEvent-initMessageEvent">initMessageEvent</span>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in Window sourceArg);
void <span title="dom-MessageEvent-initMessageEventNS">initMessageEventNS</span>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in Window sourceArg);
};</pre>

<p>The <dfn
Expand All @@ -34251,12 +34252,17 @@ XXX Once we resolve the style="" issue, address these:
attribute represents the message being sent.</p>

<p>The <dfn
title="dom-MessageEvent-domain"><code>origin</code></dfn> attribute
title="dom-MessageEvent-origin"><code>origin</code></dfn> attribute
represents, in <span>cross-document messaging</span>, the
<span>origin</span> of the document that sent the message (typically
the scheme, hostname, and port of the document, but not its path or
fragment identifier).</p>

<p>The <dfn
title="dom-MessageEvent-lastEventId"><code>lastEventId</code></dfn>
attribute represents, in <span>server-sent dom events</span>, the
<span>last event ID string</span> of the event source.</p>

<p>The <dfn
title="dom-MessageEvent-source"><code>source</code></dfn> attribute
represents, in <span>cross-document messaging</span>, the
Expand Down Expand Up @@ -34570,8 +34576,8 @@ XXX Once we resolve the style="" issue, address these:

<dt>If the field name is "event"</dt>

<dd><p>Set the <var title="">event name</var> buffer the field
value. <a href="#refsXMLNS">[XMLNS]</a></p></dd>
<dd><p>Set the <var title="">event name</var> buffer the to field
value.</p></dd>


<dt>If the field name is "data"</dt>
Expand Down Expand Up @@ -34605,8 +34611,9 @@ XXX Once we resolve the style="" issue, address these:
</dl>


<p id="dispatchEvent">When the user agent is required to <dfn
title="">dispatch the event</dfn>, then the user agent must act as follows:
<p id="dispatchMessage">When the user agent is required to <dfn
title="">dispatch the event</dfn>, then the user agent must act as
follows:

<ol>

Expand All @@ -34629,7 +34636,10 @@ XXX Once we resolve the style="" issue, address these:
title="dom-MessageEvent-data">data</code> attribute must be set to
the value of the <var title="">data</var> buffer, the <code
title="dom-MessageEvent-origin">origin</code> attribute must be set
to the <span>origin</span> of the event stream, and the <code
to the <span>origin</span> of the event stream, the <code
title="dom-MessageEvent-lastEventId">lastEventId</code>
attribute must be set to the <span>last event ID string</span> of
the event source, and the <code
title="dom-MessageEvent-source">source</code> attribute must be set
to null.</p></li>

Expand All @@ -34647,6 +34657,12 @@ XXX Once we resolve the style="" issue, address these:

</ol>

<p class="note">If an event doesn't have an "id" field, but an
earlier event did set the event source's <span>last event ID
string</span>, then the event's <code
title="dom-MessageEvent-lastEventId">lastEventId</code> field will
be set to the value of whatever the last seen "id" field was.</p>


<div class="example">

Expand Down Expand Up @@ -35716,11 +35732,12 @@ data:&nbsp;test</pre>
the <code title="dom-window-postMessage">postMessage()</code>
method, the <code title="dom-MessageEvent-origin">origin</code>
attribute must be set to the <span>origin</span> of the document
that the script that invoked the methods is associated with, and
the <code title="dom-MessageEvent-source">source</code> attribute
must be set to the <code>Window</code> object of the default view
of the browsing context with which that document is
associated.</p>
that the script that invoked the methods is associated with, the
<code title="dom-MessageEvent-lastEventId">lastEventId</code>
attribute must be set to the empty string, and the <code
title="dom-MessageEvent-source">source</code> attribute must be
set to the <code>Window</code> object of the default view of the
browsing context with which that document is associated.</p>

<p class="issue">Define 'origin' more exactly -- IDN vs no IDN,
effect of window.document.domain on its value, etc</p>
Expand Down

0 comments on commit a787d77

Please sign in to comment.