tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

html-spec-comms-isvalid.html (21404B)


      1 <!DOCTYPE html><html class=split lang=en-US-x-hixie><script src=/link-fixup.js defer=""></script><meta charset=utf-8><meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name=viewport><title>HTML Standard</title><meta content=#3c790a name=theme-color><link rel=stylesheet href=https://resources.whatwg.org/standard.css><link rel=icon href=https://resources.whatwg.org/logo.svg><script>
      2   function toggleStatus(div) {
      3     div.parentNode.classList.toggle('wrapped');
      4   }
      5  </script><style>
      6   .status { min-height: 0.6em; font: 1em sans-serif; width: 9em; padding: 0.3em; position: absolute; z-index: 8; right: 0.3em; background: #EEE; color: black; box-shadow: 0 0 3px #999; overflow: hidden; margin: -2em 0 0 0; border-collapse: initial; border-spacing: initial; }
      7   .status:hover { z-index: 9; }
      8   .status:focus-within { z-index: 9; }
      9   .status.wrapped > :not(input) { display: none; }
     10   .status > input { position: absolute; left: 0; top: 0; width: 1em; height: 1em; border: none; background: transparent; padding: 0; margin: 0; }
     11   .status > p { font-size: 0.6em; margin: 0; padding: 0; }
     12   .status > p + p { padding-top: 0.5em; }
     13   .status > p > strong { margin-left: 1.5em; }
     14   .status > .support { display: block; }
     15   .status > .support > span { padding: 0.2em 0; display: block; display: table; }
     16   .status > .support > span.partial { color: #666666; filter: grayscale(50%); }
     17   .status > .support > span.no { color: #CCCCCC; filter: grayscale(100%); }
     18   .status > .support > span.no::before { opacity: 0.5; }
     19   .status > .support > span:first-of-type { padding-top: 0.5em; }
     20   .status > .support > span > span { padding: 0 0.5em; display: table-cell; vertical-align: top; }
     21   .status > .support > span > span:first-child { width: 100%; }
     22   .status > .support > span > span:last-child { width: 100%; white-space: pre; padding: 0; }
     23   .status > .support > span::before { content: ' '; display: table-cell; min-width: 1.5em; height: 1.5em; background: no-repeat center center; background-size: contain; text-align: right; font-size: 0.75em; font-weight: bold; }
     24   .status > .support > .and_chr::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); }
     25   .status > .support > .and_ff::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); }
     26   .status > .support > .and_uc::before { background-image: url(https://resources.whatwg.org/browser-logos/uc.png); } /* UC Browser for Android */
     27   .status > .support > .android::before { background-image: url(https://resources.whatwg.org/browser-logos/android.svg); }
     28   .status > .support > .bb::before { background-image: url(https://resources.whatwg.org/browser-logos/bb.jpg); } /* Blackberry Browser */
     29   .status > .support > .chrome::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); }
     30   .status > .support > .edge::before { background-image: url(https://resources.whatwg.org/browser-logos/edge.svg); }
     31   .status > .support > .firefox::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); }
     32   .status > .support > .ie::before { background-image: url(https://resources.whatwg.org/browser-logos/ie.png); }
     33   .status > .support > .ie_mob::before { background-image: url(https://resources.whatwg.org/browser-logos/ie-mobile.svg); }
     34   .status > .support > .ios_saf::before { background-image: url(https://resources.whatwg.org/browser-logos/safari-ios.svg); }
     35   .status > .support > .op_mini::before { background-image: url(https://resources.whatwg.org/browser-logos/opera-mini.png); }
     36   .status > .support > .op_mob::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.png); }
     37   .status > .support > .opera::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.png); }
     38   .status > .support > .safari::before { background-image: url(https://resources.whatwg.org/browser-logos/safari.png); }
     39   .status > .support > .samsung::before { background-image: url(https://resources.whatwg.org/browser-logos/samsung.png); }
     40   .status > .caniuse { text-align: right; font-style: italic; width: 100%; }
     41   .status > .caniuse + p { margin-top: 0.5em; border-top: 1px solid silver; }
     42 
     43   @media (max-width: 767px) {
     44     .status { right: -9em; }
     45   }
     46  </style><style>
     47   [hidden] { display: none; }
     48 
     49   .bad, .bad *:not(.X\58X) { color: gray; border-color: gray; background: transparent; }
     50 
     51   .fingerprint { position: absolute; right: 0; z-index: 5; }
     52   @media (max-width: 767px) {
     53     .fingerprint { max-width: 35px; }
     54   }
     55 
     56   .applies .yes, .yesno .yes { background: yellow; }
     57   .yesno .yes, .yesno .no { text-align: center; }
     58 
     59   .applies thead th > * { display: block; }
     60   .applies thead code { display: block; }
     61   .applies td { text-align: center; }
     62 
     63   .matrix, .matrix td { border: hidden; text-align: right; }
     64   .matrix { margin-left: 2em; }
     65 
     66   .vertical-summary-table tr > th[rowspan="2"]:first-child + th,
     67   .vertical-summary-table tr > td[rowspan="2"]:first-child + td { border-bottom: hidden; }
     68 
     69   .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
     70   .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
     71   .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
     72 
     73   td.eg { border-width: thin; text-align: center; }
     74 
     75   #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
     76   #table-example-1 caption { padding-bottom: 0.5em; }
     77   #table-example-1 thead, #table-example-1 tbody { border: none; }
     78   #table-example-1 th, #table-example-1 td { border: solid thin; }
     79   #table-example-1 th { font-weight: normal; }
     80   #table-example-1 td { border-style: none solid; vertical-align: top; }
     81   #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
     82   #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
     83   #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
     84   #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
     85   #table-example-1 tbody td:first-child::after { content: leader(". "); }
     86   #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
     87   #table-example-1 tbody td:first-child + td { width: 10em; }
     88   #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
     89   #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
     90 
     91   .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
     92   .apple-table-examples * { font-family: "Times", serif; }
     93   .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
     94   .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
     95   .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
     96   .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
     97   .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
     98   .apple-table-examples td { text-align: right; vertical-align: top; }
     99   .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
    100   .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
    101   .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
    102   .apple-table-examples sup { line-height: 0; }
    103 
    104   .three-column-nowrap tr > td:first-child,
    105   .three-column-nowrap tr > td:first-child + td,
    106   .three-column-nowrap tr > td:first-child + td + td { white-space: nowrap; }
    107 
    108   .details-example img { vertical-align: top; }
    109 
    110   .parse-error-table td > p:first-child { margin-top: 0; }
    111 
    112   #named-character-references-table {
    113     white-space: nowrap;
    114     font-size: 0.6em;
    115     column-width: 30em;
    116     column-gap: 1em;
    117     -webkit-column-width: 30em;
    118     -webkit-column-gap: 1em;
    119   }
    120   #named-character-references-table > table > tbody > tr > td:first-child + td,
    121   #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
    122   #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
    123   #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
    124 
    125   .glyph.control { color: red; }
    126 
    127   #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
    128   @font-face {
    129     font-family: 'Essays1743';
    130     src: url('/fonts/Essays1743.ttf');
    131   }
    132   @font-face {
    133     font-family: 'Essays1743';
    134     font-weight: bold;
    135     src: url('/fonts/Essays1743-Bold.ttf');
    136   }
    137   @font-face {
    138     font-family: 'Essays1743';
    139     font-style: italic;
    140     src: url('/fonts/Essays1743-Italic.ttf');
    141   }
    142   @font-face {
    143     font-family: 'Essays1743';
    144     font-style: italic;
    145     font-weight: bold;
    146     src: url('/fonts/Essays1743-BoldItalic.ttf');
    147   }
    148 
    149   @media (max-width: 767px) {
    150     #abstractimg { width: 100%; }
    151   }
    152   #abstractimg, #abstractimg text { font: inherit; }
    153   #abstractimg rect { fill: #424242; }
    154   #abstractimg text { fill: #ffffff; font-size: 18px }
    155   #abstractimg .top { word-spacing: 50px; text-anchor: middle; }
    156   #abstractimg .left, #abstractimg .bottom { word-spacing: 12px; }
    157   #abstractimg .right { font-size: 25px; }
    158  </style><body>
    159  
    160  <script async="" src=/html-dfn.js></script>
    161  <script data-file-issue-url=https://github.com/whatwg/html/issues/new src=https://resources.whatwg.org/file-issue.js async=""></script>
    162  <header id=head class="head with-buttons">
    163   <a href=https://whatwg.org/ class=logo><img alt=WHATWG src=https://resources.whatwg.org/logo.svg width=100 height=100></a>
    164   <h1 class=allcaps>HTML</h1><h2 id=living-standard class="no-num no-toc">Living Standard — Last Updated <span class=pubdate>9 December 2017</span></h2>
    165   
    166   
    167 
    168   
    169  </header>
    170 
    171  
    172 
    173  
    174  
    175 
    176  
    177  
    178 
    179  
    180 
    181  <nav><a href=imagebitmap-and-animations.html>← 8.8 Images</a><a href=./>Table of Contents</a><a href=server-sent-events.html>9.2 Server-sent events →</a></nav><ol class=toc><li id=toc-comms><a href=comms.html#comms><span class=secno>9</span> Communication</a><ol><li><a href=comms.html#the-messageevent-interface><span class=secno>9.1</span> The <code>MessageEvent</code> interface</a></ol></ol><h2 id=comms><span class=secno>9</span> Communication<a href=#comms class=self-link></a></h2>
    182 
    183  <h3 id=the-messageevent-interface><span class=secno>9.1</span> The <code id=the-messageevent-interface:messageevent><a href=#messageevent>MessageEvent</a></code> interface<a href=#the-messageevent-interface class=self-link></a></h3>
    184 
    185  <p>Messages in <a id=the-messageevent-interface:server-sent-events href=server-sent-events.html#server-sent-events>server-sent events</a>, <a id=the-messageevent-interface:network href=web-sockets.html#network>Web sockets</a>, <a id=the-messageevent-interface:web-messaging href=web-messaging.html#web-messaging>cross-document
    186  messaging</a>, <a id=the-messageevent-interface:channel-messaging href=web-messaging.html#channel-messaging>channel messaging</a>, and <a id=the-messageevent-interface:broadcasting-to-other-browsing-contexts href=web-messaging.html#broadcasting-to-other-browsing-contexts>broadcast channels</a> use the
    187  <code id=the-messageevent-interface:messageevent-2><a href=#messageevent>MessageEvent</a></code> interface for their <code id=the-messageevent-interface:event-message><a href=indices.html#event-message>message</a></code>
    188  events:</p>
    189 
    190  <pre class=idl>[Constructor(DOMString type, optional <a href=#messageeventinit id=the-messageevent-interface:messageeventinit>MessageEventInit</a> eventInitDict), Exposed=(Window,Worker,AudioWorklet)]
    191 interface <dfn id=messageevent>MessageEvent</dfn> : <a id=the-messageevent-interface:event href=https://dom.spec.whatwg.org/#interface-event data-x-internal=event>Event</a> {
    192  readonly attribute any <a href=#dom-messageevent-data id=the-messageevent-interface:dom-messageevent-data>data</a>;
    193  readonly attribute USVString <a href=#dom-messageevent-origin id=the-messageevent-interface:dom-messageevent-origin>origin</a>;
    194  readonly attribute DOMString <a href=#dom-messageevent-lasteventid id=the-messageevent-interface:dom-messageevent-lasteventid>lastEventId</a>;
    195  readonly attribute <a href=#messageeventsource id=the-messageevent-interface:messageeventsource>MessageEventSource</a>? <a href=#dom-messageevent-source id=the-messageevent-interface:dom-messageevent-source>source</a>;
    196  readonly attribute FrozenArray&lt;<a id=the-messageevent-interface:messageport href=web-messaging.html#messageport>MessagePort</a>> <a href=#dom-messageevent-ports id=the-messageevent-interface:dom-messageevent-ports>ports</a>;
    197 
    198  void <a href=#dom-messageevent-initmessageevent id=the-messageevent-interface:dom-messageevent-initmessageevent>initMessageEvent</a>(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional any data = null, optional USVString origin = "", optional DOMString lastEventId = "", optional <a href=#messageeventsource id=the-messageevent-interface:messageeventsource-2>MessageEventSource</a>? source = null, optional sequence&lt;<a id=the-messageevent-interface:messageport-2 href=web-messaging.html#messageport>MessagePort</a>> ports = []);
    199 };
    200 
    201 dictionary <dfn id=messageeventinit>MessageEventInit</dfn> : <a id=the-messageevent-interface:eventinit href=https://dom.spec.whatwg.org/#dictdef-eventinit data-x-internal=eventinit>EventInit</a> {
    202  any data = null;
    203  USVString origin = "";
    204  DOMString lastEventId = "";
    205  <a href=#messageeventsource id=the-messageevent-interface:messageeventsource-3>MessageEventSource</a>? source = null;
    206  sequence&lt;<a id=the-messageevent-interface:messageport-3 href=web-messaging.html#messageport>MessagePort</a>> ports = [];
    207 };
    208 
    209 typedef (<a id=the-messageevent-interface:windowproxy href=window-object.html#windowproxy>WindowProxy</a> or <a id=the-messageevent-interface:messageport-4 href=web-messaging.html#messageport>MessagePort</a> or <a id=the-messageevent-interface:serviceworker href=https://w3c.github.io/ServiceWorker/#serviceworker data-x-internal=serviceworker>ServiceWorker</a>) <dfn id=messageeventsource>MessageEventSource</dfn>;</pre>
    210 
    211  <dl class=domintro><dt><var>event</var> . <code id=dom-messageevent-data-dev><a href=#dom-messageevent-data>data</a></code><dd>
    212 
    213    <p>Returns the data of the message.</p>
    214 
    215   <dt><var>event</var> . <code id=dom-messageevent-origin-dev><a href=#dom-messageevent-origin>origin</a></code><dd>
    216 
    217    <p>Returns the origin of the message, for <a id=the-messageevent-interface:server-sent-events-2 href=server-sent-events.html#server-sent-events>server-sent events</a> and
    218    <a id=the-messageevent-interface:web-messaging-2 href=web-messaging.html#web-messaging>cross-document messaging</a>.</p>
    219 
    220   <dt><var>event</var> . <code id=dom-messageevent-lasteventid-dev><a href=#dom-messageevent-lasteventid>lastEventId</a></code><dd>
    221 
    222    <p>Returns the <a href=server-sent-events.html#concept-event-stream-last-event-id id=the-messageevent-interface:concept-event-stream-last-event-id>last event ID string</a>, for
    223    <a id=the-messageevent-interface:server-sent-events-3 href=server-sent-events.html#server-sent-events>server-sent events</a>.</p>
    224 
    225   <dt><var>event</var> . <code id=dom-messageevent-source-dev><a href=#dom-messageevent-source>source</a></code><dd>
    226 
    227    <p>Returns the <code id=the-messageevent-interface:windowproxy-2><a href=window-object.html#windowproxy>WindowProxy</a></code> of the source window, for <a id=the-messageevent-interface:web-messaging-3 href=web-messaging.html#web-messaging>cross-document
    228    messaging</a>, and the <code id=the-messageevent-interface:messageport-5><a href=web-messaging.html#messageport>MessagePort</a></code> being attached, in the <code id=the-messageevent-interface:event-workerglobalscope-connect><a href=indices.html#event-workerglobalscope-connect>connect</a></code> event fired at
    229    <code id=the-messageevent-interface:sharedworkerglobalscope><a href=workers.html#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> objects.</p>
    230 
    231   <dt><var>event</var> . <code id=dom-messageevent-ports-dev><a href=#dom-messageevent-ports>ports</a></code><dd>
    232 
    233    <p>Returns the <code id=the-messageevent-interface:messageport-6><a href=web-messaging.html#messageport>MessagePort</a></code> array sent with the message, for <a id=the-messageevent-interface:web-messaging-4 href=web-messaging.html#web-messaging>cross-document
    234    messaging</a> and <a id=the-messageevent-interface:channel-messaging-2 href=web-messaging.html#channel-messaging>channel messaging</a>.</p>
    235 
    236   </dl>
    237 
    238  
    239 
    240  <p>The <dfn id=dom-messageevent-data><code>data</code></dfn> attribute must return the value
    241  it was initialized to. It represents the message being sent.</p>
    242 
    243  <p>The <dfn id=dom-messageevent-origin><code>origin</code></dfn> attribute must return the
    244  value it was initialized to. It represents, in <a id=the-messageevent-interface:server-sent-events-4 href=server-sent-events.html#server-sent-events>server-sent events</a> and
    245  <a id=the-messageevent-interface:web-messaging-5 href=web-messaging.html#web-messaging>cross-document messaging</a>, the <a id=the-messageevent-interface:concept-origin href=origin.html#concept-origin>origin</a> of the document that sent the
    246  message (typically the scheme, hostname, and port of the document, but not its path or <a href=https://url.spec.whatwg.org/#concept-url-fragment id=the-messageevent-interface:concept-url-fragment data-x-internal=concept-url-fragment>fragment</a>).</p>
    247 
    248  <p>The <dfn id=dom-messageevent-lasteventid><code>lastEventId</code></dfn> attribute must
    249  return the value it was initialized to. It represents, in <a id=the-messageevent-interface:server-sent-events-5 href=server-sent-events.html#server-sent-events>server-sent events</a>, the
    250  <a href=server-sent-events.html#concept-event-stream-last-event-id id=the-messageevent-interface:concept-event-stream-last-event-id-2>last event ID string</a> of the event
    251  source.</p>
    252 
    253  <p>The <dfn id=dom-messageevent-source><code>source</code></dfn> attribute must return the
    254  value it was initialized to. It represents, in <a id=the-messageevent-interface:web-messaging-6 href=web-messaging.html#web-messaging>cross-document messaging</a>, the
    255  <code id=the-messageevent-interface:windowproxy-3><a href=window-object.html#windowproxy>WindowProxy</a></code> of the <a id=the-messageevent-interface:browsing-context href=browsers.html#browsing-context>browsing context</a> of the <code id=the-messageevent-interface:window><a href=window-object.html#window>Window</a></code> object
    256  from which the message came; and in the <code id=the-messageevent-interface:event-workerglobalscope-connect-2><a href=indices.html#event-workerglobalscope-connect>connect</a></code> events used by <a href=workers.html#sharedworkerglobalscope id=the-messageevent-interface:sharedworkerglobalscope-2>shared workers</a>, the newly connecting
    257  <code id=the-messageevent-interface:messageport-7><a href=web-messaging.html#messageport>MessagePort</a></code>.</p>
    258 
    259  <p>The <dfn id=dom-messageevent-ports><code>ports</code></dfn> attribute must return the
    260  value it was initialized to. It represents, in <a id=the-messageevent-interface:web-messaging-7 href=web-messaging.html#web-messaging>cross-document messaging</a> and
    261  <a id=the-messageevent-interface:channel-messaging-3 href=web-messaging.html#channel-messaging>channel messaging</a>, the <code id=the-messageevent-interface:messageport-8><a href=web-messaging.html#messageport>MessagePort</a></code> array being sent.</p>
    262 
    263  
    264  <p>The <dfn id=dom-messageevent-initmessageevent><code>initMessageEvent()</code></dfn>
    265  method must initialize the event in a manner analogous to the similarly-named <code id=the-messageevent-interface:dom-event-initevent><a data-x-internal=dom-event-initevent href=https://dom.spec.whatwg.org/#dom-event-initevent>initEvent()</a></code> method. <a href=references.html#refsDOM>[DOM]</a></p>
    266 
    267  
    268 
    269  <p class=note>Various APIs (e.g., <code id=the-messageevent-interface:websocket><a href=web-sockets.html#websocket>WebSocket</a></code>, <code id=the-messageevent-interface:eventsource><a href=server-sent-events.html#eventsource>EventSource</a></code>) use the
    270  <code id=the-messageevent-interface:messageevent-3><a href=#messageevent>MessageEvent</a></code> interface for their <code id=the-messageevent-interface:event-message-2><a href=indices.html#event-message>message</a></code> event
    271  without using the <code id=the-messageevent-interface:messageport-9><a href=web-messaging.html#messageport>MessagePort</a></code> API.</p>
    272 
    273 
    274  <nav><a href=imagebitmap-and-animations.html>← 8.8 Images</a><a href=./>Table of Contents</a><a href=server-sent-events.html>9.2 Server-sent events →</a></nav>