-
Notifications
You must be signed in to change notification settings - Fork 4
/
155.txt
709 lines (565 loc) · 35.4 KB
/
155.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
[2] [DFN[[CODE(DOMm)@en[postMessage]]]] [[メソッド]]は、
[[Web]] における[[プロセス間通信]]のための[[メソッド]]です。
* 仕様書
[REFS[
- [18] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2015-05-06 10:42:35 +09:00]] 版) <https://html.spec.whatwg.org/#crossDocumentMessages>
- [111] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2016-12-05 14:51:53 +09:00]]) <https://html.spec.whatwg.org/#dom-messageport-postmessage>
- [138] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2016-12-06 07:17:59 +09:00]]) <https://html.spec.whatwg.org/#dom-broadcastchannel-postmessage>
- [156] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2016-12-06 07:17:59 +09:00]]) <https://html.spec.whatwg.org/#dom-dedicatedworkerglobalscope-postmessage>
- [158] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2016-12-06 07:17:59 +09:00]]) <https://html.spec.whatwg.org/#dom-worker-postmessage>
]REFS]
* 文脈
[112] [CODE(DOMi)@en[Window]] [[オブジェクト]]、
[CODE(DOMi)@en[MessagePort]] [[オブジェクト]]、
[CODE(DOMi)@en[DedicatedWorkerGlobalScope]] [[オブジェクト]]、
[CODE(DOMi)@en[Worker]] [[オブジェクト]]、
[CODE(DOMi)@en[BroadcastChannel]] [[オブジェクト]]に存在します。
[159] [CODE(DOMi)@en[SharedWorker]] [[オブジェクト]]には存在しませんが、
かわりに [CODE(DOMa)@en[port][MessagePort]] [[IDL属性]]があって、
[CODE(DOMi)@en[MessagePort]] [[オブジェクト]]にアクセスできます。
* 引数
[160] 第1引数は送信するデータです。 [CODE(DOMm)@en[postMessage]] [[メソッド]]ではこれを
「メッセージ」と呼んでいます。
メッセージとしては任意の [[JavaScript値]]を指定できます。
[176] ただし、送信されるのは指定された値そのものではなく、
[[構造化クローン]]です。
-*-*-
[161] 第2引数以後は[[文脈オブジェクト]]によって異なります。
元は[[引数]]をいくつか順に指定する形式でしたが、
[TIME[2018年][year:2018]]の改訂以後省略可能な[[辞書]]
[DFN[[CODE[PostMessageOptions]]]]
形式の引数 [SRC[>>18]] で指定できるようになりました
[SRC[>>22]]。
** [CODE(DOMi)@en[Window]] オブジェクトの場合
[25] 第2引数 [CODE[USVString]] または[[辞書]]引数 [DFN[[CODE[WindowPostMessageOptions]]]]
([CODE[PostMessageOptions]] を[[継承]] [SRC[>>18]])
の省略可能な [CODE[USVString]] の値 [DFN[[CODE[targetOrigin]]]] [SRC[>>18]]
には、投函先の[[起源]]を指定します。投函先が実際には異なる[[起源]]なら、
メッセージは無視されます (エラーにもなりません)。
[26] [[起源]]は、次のいずれかの値を指定できます。
[FIG(list)[
- [20] [[絶対URL]] は、その [[URL]] の[[起源]]を表します。
- [28] [CODE[[[/]]]] は、送信元の[[文書]]と[[同じ起源]]を表します。
[[同じ起源]]同士でも、異なる[[起源]]の場合と同じように投函できます。
その場合でもやはりメッセージは[[構造化クローン]]が引き渡されます。
- [27] [CODE[[[*]]]] は、任意の[[起源]]を表します。
[[著者]]は、機密情報を含むメッセージの場合、対象の起源として
[CODE[[[*]]]] を指定する[['''べきではありません''']] [SRC[>>18]]。
]FIG]
[29] [[相対URL]]は指定できません。
[EG[
[30] 例えば [CODE[https://hoge.example/foo/bar]] を指定すると、
[CODE[https://hoge.example]] 下の任意の[[文書]]などが受信できます。
]EG]
[31] 第3引数または[[辞書]]引数 [CODE[PostMessageOptions]]
の省略可能な値 [DFN[[CODE[transfer]]]] [SRC[>>18]]
には、
[CODE[[[Transferable]]]] の[[配列]]を指定できます。
該当するものがなければ、省略できます。
** [CODE(DOMi)@en[MessagePort]] と [CODE(DOMi)@en[DedicatedWorkerGlobalScope]] と [CODE(DOMi)@en[Worker]] の場合
[114] 第2引数または[[辞書]]引数 [CODE[PostMessageOptions]]
の省略可能な値 [CODE[transfer]] [SRC[>>18]]
には、 [CODE[[[Transferable]]]] の[[配列]]を指定できます。
該当するものがなければ、省略できます。
** [CODE(DOMi)@en[BroadcastChannel]] オブジェクトの場合
[139] 第1引数のみです。
* 処理
** [CODE(DOMi)@en[Window]] の場合
[21] [CODE(DOMi)@en[[[Window]]]] [[インターフェイス]]の
[CODE(DOMm)@en[[[postMessage]]]] [[メソッド]]は、
[DFN[window post message steps]]、
すなわち次のようにしなければ[MUST[なりません]] [SRC[>>18]]。
[FIG(steps)[
= [177] 引数群を必須の [CODE(IDL)[any]]、
必須の [CODE[USVString]]、
省略可能な [CODE[[[sequence]]<[[object]]>]]
か、
必須の [CODE(IDL)[any]]、
省略可能な [CODE[WindowPostMessageOptions]]
のいずれかとして解釈します。
== [96] [VAR[メッセージ]]を、第1引数を [CODE(IDL)@en[any]] として解釈した結果に設定します。
== [178] 前者の場合、
=== [97] [VAR[対象起源]]を、第2引数を [CODE(IDL)@en[USVString]] として解釈した結果に設定します。
=== [98] [VAR[transfer]] を、第3引数を [CODE[[[sequence]]<[[object]]>]] として解釈した結果に設定します。
[[既定値]]は、[[空リスト]]とします。
== [113] 後者の場合、
=== [179] [VAR[オプション群]]を、第2引数を [CODE[WindowPostMessageOptions]]
と解釈した結果に設定します。
=== [180] [VAR[対象起源]]を、 [VAR[オプション群]]の [F[[CODE[targetOrigin]]]]
に設定します。
=== [181] [VAR[transfer]]を、 [VAR[オプション群]]の [F[[CODE[transfer]]]]
に設定します。
= [106] [VAR[対象窓]]を、[[文脈オブジェクト]]に設定します。
= [108] [VAR[対象Realm]] を、[VAR[対象窓]]の[F[Realm]]に設定します。
= [83] [VAR[現職設定群]]を、[[現職設定群オブジェクト]]に設定します。
= [109] [VAR[対象起源]]により、
[FIG(switch)[
: [CODE[*]] :
[VAR[対象起源]]はそのまま [CODE[*]] とします。
: [CODE[/]] :
[VAR[対象起源]]を、[VAR[現職設定群]]の[F[起源]]に設定します。
: それ以外 :
[FIG(steps)[
= [100] [VAR[URL]] を、[VAR[対象起源]]に[[URL構文解析器]]を適用した結果に設定します。
= [101] [VAR[URL]] が[[失敗]]の場合、
== [102] [CODE(DOMe)@en[SyntaxError]] [CODE(DOMi)@en[DOMException]] を[[投げ]]、
ここで停止します。
= [103] [VAR[対象起源]]を、[VAR[URL]] の[F[起源][URLの起源]]に設定します。
]FIG]
]FIG]
= [99] [VAR[直列化結果]]を、 [VAR[メッセージ]]と [VAR[transfer]] に
[CODE[StructuredSerializeWithTransfer]] を適用した結果に設定します。
[[例外]]が[[投げ]]られれば、[[再び投げ]]、ここで停止します。
= [130] [[タスクをキューに追加]]します。
[FIG(list members)[
: [VAR[[[タスク源]]]] :
[VAR[対象窓]]の[F[関連エージェント]]の[F[イベントループ]]の[[投稿済みメッセージタスク源]]
: [VAR[処理]] :
[FIG(steps)[
= [82] [VAR[対象起源]]が [CODE[*]] ''以外''で、
[VAR[対象窓]]の[F[文書]]の[F[起源][文書の起源]]が[VAR[対象起源]]と[[同じ起源]]で''な''ければ、
== [93] ここで停止します。
= [81] [VAR[起源]]を、[VAR[現職設定群]]の[F[起源]]の[F[直列化][ASCII直列化]]に設定します。
= [104] [VAR[始点]]を、[VAR[現職設定群]]の[F[大域オブジェクト]]の
[F[[CODE[WindowProxy]]]] に設定します。
= [110] [VAR[記録]]を、[VAR[直列化結果]]と[VAR[対象Realm]]について
[CODE[StructuredDeserializeWithTransfer]] した結果に設定します。
[[例外]]が[[投げ]]られた場合、
[FIG(steps)[
= [131] [[イベントを発火]]します。
[FIG(list members)[
: [VAR[[[対象][イベント対象]]]] : [VAR[対象窓]]
: [VAR[[[型][イベント型]]]] : [CODE[messageerror]]
: [VAR[インターフェイス][イベントインターフェイス]] : [CODE(DOMi)@en[MessageEvent]]
: [CODE[origin][origin (MessageEvent)]] : [VAR[起源]]
: [CODE[source][source (MessageEvent)]] : [VAR[始点]]
]FIG]
= [132] ここで停止します。
]FIG]
= [91] [[イベントを発火]]します。
[FIG(list members)[
: [VAR[[[対象][イベント対象]]]] : [VAR[対象窓]]
: [VAR[[[型][イベント型]]]] : [CODE(DOMe)@en[message][onmessage]]
: [VAR[インターフェイス][イベントインターフェイス]] : [CODE(DOMi)@en[MessageEvent]]
: [CODE[origin][origin (MessageEvent)]] : [VAR[起源]]
: [CODE[source][source (MessageEvent)]] : [VAR[始点]]
: [CODE[data][data (MessageEvent)]] : [VAR[記録]]の[F(ss)[Deserialized]]
: [CODE[ports]] : [VAR[記録]]の[F(ss)[TransferredValues]]の
[CODE(DOMi)@en[MessagePort]] をすべて同じ順に含めた[[凍結配列]]
]FIG]
]FIG]
]FIG]
]FIG]
[33] 送信したメッセージは、 [CODE(DOMi)@en[[[Window]]]] の [CODE(DOMe)@en[message][onmessage]]
[[イベント]]として受信することができます。
;; [CODE(DOMe)@en[message][onmessage]] を参照。
** [CODE(DOMi)@en[MessagePort]] と [CODE(DOMi)@en[DedicatedWorkerGlobalScope]] と [CODE(DOMi)@en[Worker]] の場合
[115] [CODE(DOMi)@en[MessagePort]] [[オブジェクト]]と
[CODE(DOMi)@en[Worker]] [[オブジェクト]]と
[CODE(DOMi)@en[DedicatedWorkerGlobalScope]] [[オブジェクト]]の
[CODE(DOMm)@en[postMessage]] は、
[DFN[message port post message options]]、
すなわち次のようにしなければ[MUST[なりません]] [SRC[>>111, >>156, >>158]]。
[FIG(steps)[
= [157] [VAR[ポート]]を、[[文脈オブジェクト]]により、次の値に設定します。
[FIG(switch)[
: [CODE(DOMi)@en[MessagePort]] :
[[文脈オブジェクト]]
: [CODE(DOMi)@en[DedicatedWorkerGlobalScope]] :
[[ 文脈オブジェクト]]の[F[暗示的ポート]]
: [CODE(DOMi)@en[Worker]] :
[[ 文脈オブジェクト]]の[F[暗示的ポート]]
]FIG]
= [116] [VAR[メッセージ]]を、必須の第1引数を [CODE[any]]
として解釈した結果に設定します。
= [117] [VAR[オプション群]]を、省略可能な第2引数を[[オブジェクト]]の[[配列]]または
[CODE[MessagePortOptions]] として解釈した結果に設定します。
= [182] [VAR[オプション群]]が [CODE[MessagePortOptions]] の場合、
== [183] [VAR[transfer]] を、 [VAR[オプション群]]の [F[[CODE[transfer]]]] に設定します。
= [184] それ以外の場合、
== [185] [VAR[transfer]] を、 [VAR[オプション群]]に設定します。
= [120] [VAR[transfer]] に[VAR[ポート]]が含まれる場合、
== [121] [CODE[DataCloneError]] を[[投げ]]、ここで停止します。
= [118] [VAR[対象ポート]]を、[VAR[ポート]]の[F[[[entangle]] されているポート]]に設定します。
= [122] [VAR[対象ポート]]が [CODE[null]] 以外で、
[VAR[transfer]] に[VAR[対象ポート]]が含まれるなら、
== [123] [VAR[doomed]] を、[[真]]に設定します。
== [124] [[開発者コンソール]]に、
[[通信路]]が失われることを報告しても構いません。
= [126] それ以外の場合、
== [119] [VAR[doomed]] を、[[偽]]に設定します。
= [163] [VAR[結果]]を、
[CODE[[[StructuredSerializeWithTransfer]] ([VAR[メッセージ]]、[VAR[transfer]])]]
の結果に設定します。[[例外]]が[[投げ]]られたら、[[再び投げ]]、ここで停止します。
= [133] [VAR[対象ポート]]が [CODE[null]] 以外で、
[VAR[doomed]] が[[偽]]なら、
== [142] [VAR[結果]]についての処理 (>>125)
を[VAR[対象ポート]]の[[ポートメッセージキューに追加]]します。
]FIG]
]FIG]
[125] [VAR[結果]]についての処理は、次のようなものです [SRC[>>111]]。
ここで、[VAR[最終対象ポート]]は、実行側で指定される[[変数]]です
([[ポートメッセージキューに追加]]参照)。
[FIG(steps)[
= [85] [VAR[Realm]]を、[VAR[最終対象ポート]]の[F[関連Realm]]に設定します。
= [165] [VAR[記録]]を、 [CODE[[[StructuredDeserializeWithTransfer]] ([VAR[結果]], [VAR[Realm]])]]
の結果に設定します。
[[例外]]が[[投げ]]られた場合、
[FIG(steps)[
= [92] [[イベントを発火]]します。
[FIG(list members)[
: [VAR[[[インターフェイス][イベントインターフェイス]]]] : [CODE(DOMi)@en[MessageEvent]]
: [VAR[[[対象][イベント対象]]]] : [VAR[最終対象ポート]]
: [VAR[[[型][イベント型]]]] : [CODE(DOMe)@en[messageerror]]
]FIG]
= [105] ここで停止します。
]FIG]
= [168] [[イベントを発火]]します。
[FIG(list members)[
: [VAR[[[インターフェイス][イベントインターフェイス]]]] : [CODE(DOMi)@en[MessageEvent]]
: [VAR[[[対象][イベント対象]]]] : [VAR[最終対象ポート]]
: [VAR[[[型][イベント型]]]] : [CODE(DOMe)@en[message][onmessage]]
: [VAR[[CODE[data][data (MessageEvent)]]]] : [VAR[記録]]の [F(ss)[Deserialized]]
: [VAR[[CODE[ports]]]] : [VAR[記録]]の [F(ss)[TransferredValues]]
内の各 [CODE(DOMi)@en[MessagePort]] を同じ順序で含めた[[凍結済み配列]]
]FIG]
]FIG]
** [CODE(DOMi)@en[BroadcastChannel]] オブジェクトの場合
[140] [CODE(DOMi)@en[BroadcastChannel]] [[オブジェクト]]の
[CODE(DOMm)@en[postMessage]] は、
次のようにしなければ[MUST[なりません]] [SRC[>>138]]。
[FIG(steps)[
= [141] [VAR[メッセージ]]を、必須の第1引数を [CODE[any]]
として解釈した結果に設定します。
= [143] [VAR[始点]]を、[[文脈オブジェクト]]に設定します。
= [145] [VAR[始点]]の[F[閉じ済みフラグ]]が[[真]]なら、
== [146] [CODE(DOMe)@en[InvalidStateError]] を[[投げ]]、ここで停止します。
= [144] [VAR[始点設定群]]を、[VAR[始点]]の[F[[[[CODE(DOMi)@en[BroadcastChannel]]設定群オブジェクト]]]]に設定します。
= [147] [VAR[始点通信路]]を、[VAR[始点]]の[F[通信路名]]に設定します。
= [149] [VAR[複製メッセージ]]を、[CODE[[[StructuredSerialize]]([VAR[メッセージ]]、[VAR[対象Realm]])]] の結果に設定します。
[[例外]]が[[投げ]]られれば、[[再び投げ]]、ここで停止します。
= [150] [VAR[終点群]]を、[VAR[始点設定群]]と[VAR[始点通信路]]の[[[CODE(DOMi)@en[BroadcastChannel]]すべてのリスト]]に設定します。
= [151] [VAR[終点群]]から、[VAR[始点]]を除去します。
= [152] [VAR[終点群]]の各項目[VAR[終点]]について、順に、
== [153] [[タスクをキューに追加]]します。
[FIG(list members)[
: [VAR[処理]] :
[FIG(steps)[
= [154] [VAR[対象Realm]]を、[VAR[終点]]の[F[関連設定群オブジェクト]]の[F[Realm]]に設定します。
= [136] [VAR[起源]]を、[VAR[始点設定群]]の[F[起源]]の[F[直列化][ASCII直列化]]に設定します。
= [127] [VAR[データ]]を、 [CODE[[[StructuredDeserialize]] ([VAR[複製メッセージ]], [VAR[対象Realm]])]] の結果に設定します。
[[例外]]が[[投げ]]られた場合、
[FIG(steps)[
= [134] [[イベントを発火]]します。
[FIG(list members)[
: [VAR[[[インターフェイス][イベントインターフェイス]]]] : [CODE(DOMi)@en[MessageEvent]]
: [VAR[[[型][イベント型]]]] : [CODE(DOMe)@en[messageerror]]
: [VAR[[[対象][イベント対象]]]] : [VAR[終点]]
: [CODE(DOMa)@en[origin][origin (MessageEvent)]] : [VAR[起源]]
]FIG]
= [135] ここで停止します。
]FIG]
= [155] [[イベントを発火]]します。
[FIG(list members)[
: [VAR[[[インターフェイス][イベントインターフェイス]]]] : [CODE(DOMi)@en[MessageEvent]]
: [VAR[[[型][イベント型]]]] : [CODE(DOMe)@en[message][onmessage]]
: [VAR[[[対象][イベント対象]]]] : [VAR[終点]]
: [CODE(DOMa)@en[origin][origin (MessageEvent)]] : [VAR[起源]]
: [CODE(DOMa)@en[data][data (MessageEvent)]] : [VAR[データ]]
]FIG]
]FIG]
: [VAR[タスク源]] :
[VAR[終点]]の[F[関連エージェント]]の[F[イベントループ]]の[[DOM操作タスク源]]
: [[タスク]]の[F[文書]] :
[VAR[終点]]の[F[関連エージェント]]の[F[イベントループ]]が[[窓イベントループ]]の場合、
[VAR[終点]]の[F[[[[CODE[BoardcastChannel]]設定群オブジェクト]]]]の[F[有責文書]]
]FIG]
]FIG]
;; [128] [[メッセージポート]]等を送ることはできません。
[CODE[BroadcastMessage]] でできないことをするには、[[共有ワーカー]]を作って中継する必要があります。
* 歴史
** 登場
[14] 最初 [[Web Applications 1.0]] に追加された時は [CODE(DOMi)@en[[[Document]]]]
[[オブジェクト]]に属していました。
[15] しかし[[同一起源ポリシー]]に関する検査が複雑になるとして、より「外側」
である [CODE(DOMi)@en[[[Window]]]] [[オブジェクト]]へと移動されました。
[16] [[Opera]] ははじめに [CODE(DOMi)@en[[[Document]]]] [[オブジェクト]]に実装しましたが、
後に [CODE(DOMi)@en[[[Window]]]] [[オブジェクト]]に移動しました。
他の[[Webブラウザー]]ははじめから [CODE(DOMi)@en[[[Window]]]]
[[オブジェクト]]に実装しました。
[17] [CODE(DOMm)@en[[[postMessage]]]] は [[HTML5]] の新機能の中では最も早期に実装されたものの一つでした。
** 実装開始
- [51] [[IE]] 8+ (2009/3) [SRC[>>52]]
- [54] [[Gecko]] 1.9+ / [[Firefox]] 3+ (2008/6) [SRC[>>55]]
- [56] [[WebKit]] 2007年末+ [SRC[>>59]]
-- [57] [[Chrome]] 4+ (2010/1) [SRC[>>58]]
-- [63] [[Safari]] 4+ (2009/6) [SRC[>>64]]
- [60] [[Opera]]
-- [62] [CODE(DOMi)@en[[[Document]]]] (旧仕様): 9+ (2006/6) [SRC[>>59]]
-- [61] [CODE(DOMi)@en[[[Window]]]]: 9.5+ (2008/6) [SRC[>>59]]
[REFS[
- [52] [CITE@en-us[postMessage Method (window, Window Constructor)]] ([TIME[2011-04-24 11:40:59 +09:00]] 版) <http://msdn.microsoft.com/library/cc197015.aspx>
- [53] [CITE@ja-jp[Internet Explorer 8 のクロス ドキュメント メッセージングの概要]] ([TIME[2011-04-24 11:40:25 +09:00]] 版) <http://msdn.microsoft.com/ja-jp/library/cc511311(v=vs.85).aspx>
- [55] [CITE@ja[window.postMessage - MDC Doc Center]] ([TIME[2011-04-24 11:42:47 +09:00]] 版) <https://developer.mozilla.org/ja/DOM/window.postMessage>
- [58] [CITE[Google Chrome 4で注目したいセキュリティ強化の新機能 - ITmedia エンタープライズ]] ([TIME[2011-04-24 11:47:11 +09:00]] 版) <http://www.itmedia.co.jp/enterprise/articles/1001/29/news021.html>
- [59] [CITE[サーバーサイド技術を使わないクロスドメイン通信補足 - 0xFF]] ([TIME[2011-04-24 11:48:45 +09:00]] 版) <http://d.hatena.ne.jp/os0x/20080409/1207732715>
- [64] [CITE@en[Browser Variation of the Hub Reference Implementation (Illustrative) - MemberWiki]] ([TIME[2009-12-19 12:40:31 +09:00]] 版) <http://www.openajax.org/member/wiki/Browser_Variation_of_the_Hub_Reference_Implementation_(Illustrative)#HTML_5_postMessage>
]REFS]
**
[1]
[CITE[Cross-document messaging in Opera - Arve Bersvendsen]] <http://virtuelvis.com/archives/2005/12/cross-document-messaging>
[50]
[[Opera 8]] β にはありませんでしたが、 [[Opera 8.5]]
では実装されていました。
[3]
[CITE[The cross-document messaging APIs]] ([[Ian Hickson <ian@...>]] 著, [CODE[2007-08-09 00:51:36 +09:00]] 版) <http://permalink.gmane.org/gmane.org.w3c.whatwg.discuss/11634>
[4]
[CITE[Index of /specs/dom/messages]] ([CODE[2008-02-13 01:58:34 +09:00]] 版) <http://www.hixie.ch/specs/dom/messages/>
[23]
[CITE[Fixed a security problem with postMessage()]] ([[Ian Hickson <ian@...>]] 著, [CODE[2008-02-12 20:03:46 +09:00]] 版) <http://permalink.gmane.org/gmane.org.w3c.whatwg.discuss/13237>
([[名無しさん]])
[24]
[CITE[IE Team Feedback on HTML 5.0 Cross Document Messaging]] ([[Sunava Dutta <sunavad@...>]] 著, [CODE[2008-02-22 03:18:40 +09:00]] 版) <http://permalink.gmane.org/gmane.org.w3c.whatwg.discuss/13320>
[32]
[CITE[postMessage() issues]] ([[Ian Hickson <ian@...>]] 著, [CODE[2008-04-16 00:10:07 +09:00]] 版) <http://permalink.gmane.org/gmane.org.w3c.whatwg.discuss/13716>
[38]
[CITE[postMessage feedback]] ([[Ian Hickson <ian@...>]] 著, [CODE[2008-04-24 23:49:56 +09:00]] 版) <http://permalink.gmane.org/gmane.org.w3c.whatwg.discuss/13867>
[39] [CITE@en[(X)HTML5 Tracking]]
([TIME[2010-01-09 14:12:17 +09:00]] 版)
<http://html5.org/tools/web-apps-tracker?from=4547&to=4548>
[40] [CITE@en-US-x-Hixie[HTML5 Communications]]
([TIME[2010-01-09 10:10:53 +09:00]] 版)
<http://dev.w3.org/html5/postmsg/Overview.html>
[41] [CITE[IRC logs: freenode / #whatwg / 20100212]]
([TIME[2010-02-14 11:17:32 +09:00]] 版)
<http://krijnhoetmer.nl/irc-logs/whatwg/20100212#l-271>
[42] [CITE@en-US[David Baron's weblog: setTimeout with a shorter delay]]
([TIME[2010-03-16 08:44:54 +09:00]] 版)
<http://dbaron.org/log/20100309-faster-timeouts>
[43] [CITE['''['''whatwg''']''' postMessage's target origin argument can be a full URL in some implementations]]
([TIME[2010-08-11 10:18:42 +09:00]] 版)
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-August/027848.html>
[44] [CITE@en[HTML5 Revision Tracker]]
([TIME[2010-08-11 23:17:32 +09:00]] 版)
<http://html5.org/tools/web-apps-tracker?from=5276&to=5277>
[45] [CITE[''''''[''''''whatwg'''''']'''''' postMessage's target origin argument can be a full URL in some implementations]]
( ([TIME[2010-11-16 08:52:44 +09:00]] 版))
<http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-November/029037.html>
[46] [CITE@en[Web Applications 1.0 r5682 Revert r5277's removal of '/' as a magic value to postMessage(), since it has useful use cases. Paths in absolute URLs are still ignored without raising an exception.]]
( ([TIME[2010-11-16 08:25:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=5681&to=5682>
[47] [CITE@en-US-x-Hixie[HTML5 Web Messaging]]
( ([TIME[2010-11-19 05:40:25 +09:00]] 版))
<http://www.w3.org/TR/2010/WD-webmessaging-20101118/>
[48] [CITE[IE で postMessage 的実装をちゃんとやる - 冬通りに消え行く制服ガールは、夢物語にリアルを求めない。 - subtech]]
( ([TIME[2010-12-07 22:02:13 +09:00]] 版))
<http://subtech.g.hatena.ne.jp/cho45/20101207/1291719344>
[49] [CITE@en-US-x-Hixie[HTML5 Web Messaging]]
( ([TIME[2011-03-17 23:58:26 +09:00]] 版))
<http://www.w3.org/TR/2011/WD-webmessaging-20110317/>
[65] [CITE@en[Web Applications 1.0 r6690 Make postMessage() accept the second and third arguments in either order. Compat with WebKit and hopefully solves the difficulty people have about remembering which goes first.]]
( ([TIME[2011-10-18 06:47:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=6689&to=6690>
[66] [CITE@en[Web Applications 1.0 r6691 Revert last checkin. My testing was bogus.]]
( ([TIME[2011-10-18 07:09:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=6690&to=6691>
[67] [CITE@en-US-x-Hixie[HTML5 Web Messaging]]
( ([TIME[2011-10-19 02:36:24 +09:00]] 版))
<http://www.w3.org/TR/2011/WD-webmessaging-20111020/>
[68] [CITE@ja[IE 6/7 で文書間通信を実現するための一案: Days on the Moon]]
( ([TIME[2011-12-10 00:17:35 +09:00]] 版))
<http://nanto.asablo.jp/blog/2011/12/08/6237308>
[69] [CITE@en-US-x-Hixie[HTML5 Web Messaging]]
( ([TIME[2012-03-12 22:06:22 +09:00]] 版))
<http://www.w3.org/TR/2012/WD-webmessaging-20120313/>
[70] [CITE@en-US-x-Hixie[HTML5 Web Messaging]]
( ([TIME[2012-05-01 21:47:11 +09:00]] 版))
<http://www.w3.org/TR/2012/CR-webmessaging-20120501/>
[71] [CITE[Securing Frame Communication in Browsers]]
( ([TIME[2008-05-15 01:03:44 +09:00]] 版))
<http://seclab.stanford.edu/websec/frames/post-message.pdf>
[72] [CITE@en[Compound Document by Reference Framework 1.0]]
( ([TIME[2010-08-17 16:50:04 +09:00]] 版))
<http://www.w3.org/TR/CDR/#event-propagation>
[73] [CITE@en[Interview with Ian Hickson, HTML editor | HTML5 Doctor]]
( ([TIME[2013-01-13 18:27:28 +09:00]] 版))
<http://html5doctor.com/interview-with-ian-hickson-html-editor/>
[74] [CITE@en[RemoteDocumentMessaging - WHATWG Wiki]]
( ([TIME[2013-06-24 05:31:29 +09:00]] 版))
<http://wiki.whatwg.org/wiki/RemoteDocumentMessaging>
[75] [CITE[IRC logs: freenode / #whatwg / 20130621]]
( ([TIME[2013-06-24 19:18:13 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20130621#l-585>
[76] [CITE[''''''[''''''whatwg'''''']'''''' web messaging - postMessage]]
( ([TIME[2013-09-13 00:52:56 +09:00]] 版))
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-September/040800.html>
[77] [CITE@en[Web Applications 1.0 r8247 The bulk of this is editorial: refactoring how scripts are defined so that all the common stuff is in a shared 'settings object' rather than being duplicated per script. But this also cleans up how postMessage() interacts with the event loop and a few other things I've since forgotten.]]
( ([TIME[2013-10-31 08:18:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=8246&to=8247>
[78] [CITE@en[Web Applications 1.0 r8741 Try to explain why postMessage()'s privacy implications aren't actually anything new]]
( ([TIME[2014-09-04 08:43:00 +09:00]] 版))
<http://html5.org/r/8741>
[79] [CITE[JavaScript - WebWorkersで巨大データ転送の不思議 - Qiita]]
( ([TIME[2014-09-05 02:14:11 +09:00]] 版))
<http://qiita.com/Quramy/items/8c12e6c3ad208c97c99a>
[5] [CITE@en[CfC: publish Proposed Recommendation of Web Messaging; deadline March 28]]
([[Arthur Barstow]] 著, [TIME[2015-03-21 21:52:25 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2015JanMar/0848.html>
[6] [CITE[Part2 - browsersec - Browser Security Handbook, part 2 - Browser Security Handbook - Google Project Hosting]]
([TIME[2015-03-31 16:38:48 +09:00]] 版)
<https://code.google.com/p/browsersec/wiki/Part2#Gaps_in_DOM_access_control>
[FIG(quote)[
[FIGCAPTION[
[7] [CITE@en[YuzuJS/setImmediate]]
([TIME[2015-04-01 12:18:25 +09:00]] 版)
<https://github.com/YuzuJS/setImmediate>
]FIGCAPTION]
> Note that Internet Explorer 8 includes a synchronous version of postMessage. We detect this, or any other such synchronous implementation, and fall back to another trick.
]FIG]
[8] [CITE@en-US[HTML5 Web Messaging]]
( ([TIME[2015-04-07 00:52:40 +09:00]] 版))
<http://www.w3.org/TR/2015/PR-webmessaging-20150407/>
[9] [CITE@en-US[HTML5 Web Messaging]]
( ([TIME[2015-05-18 22:30:14 +09:00]] 版))
<http://www.w3.org/TR/2015/REC-webmessaging-20150519/>
[10] [CITE@en[Errata/WebMessaging - WEBAPPS]]
([TIME[2015-05-11 23:07:22 +09:00]] 版)
<https://www.w3.org/2008/webapps/wiki/Errata/WebMessaging>
[11] [CITE@en[All Results]]
([TIME[2015-05-19 23:43:52 +09:00]] 版)
<https://w3c.github.io/test-results/webmessaging/all>
[FIG(quote)[
[FIGCAPTION[
[12] [CITE@en-US[HTML5 Web Messaging]]
([TIME[2015-05-18 22:30:14 +09:00]] 版)
<http://www.w3.org/TR/2015/REC-webmessaging-20150519/>
]FIGCAPTION]
> Open Bugs 27128
]FIG]
[FIG(quote)[
[FIGCAPTION[
[13] [CITE@en-US[HTML5 Web Messaging]]
([TIME[2015-05-18 22:30:14 +09:00]] 版)
<http://www.w3.org/TR/2015/REC-webmessaging-20150519/>
]FIGCAPTION]
> Open Bugs 18242
]FIG]
[34] [CITE@en[PSA: Change the Latest Editor's Drafts of WebStorage, WebWorkers, WebMessaging, Server-Sent Events and WebSockets]]
([[Xiaoqian Wu]] 著, [TIME[2015-10-20 02:52:22 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2015OctDec/0099.html>
[FIG(quote)[
[FIGCAPTION[
[35] [CITE@en[Safari 4.0]]
([TIME[2015-11-04 22:53:48 +09:00]] 版)
<https://developer.apple.com/library/safari/releasenotes/General/WhatsNewInSafari/Articles/Safari_4_0.html#//apple_ref/doc/uid/TP40014305-CH4-SW13>
]FIGCAPTION]
> WebKit now supports the HTML5 cross-document messaging standard, allowing documents served from different domains to communicate with each other directly without the need for server relaying.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[36] [CITE@en[High-performance Web Worker messages | Read the Tea Leaves]]
([TIME[2016-03-02 09:24:25 +09:00]] 版)
<http://nolanlawson.com/2016/02/29/high-performance-web-worker-messages/>
]FIGCAPTION]
> My tests confirmed that stringifying is indeed faster than sending raw objects, and that the message size has a dramatic impact on the speed of worker communication.
> Furthermore, the only real benefit comes if you stringify the entire message. Even a small object that wraps the stringified message (e.g. {msg: JSON.stringify(message)}) performs worse than the fully-stringified case. (These results differ between Chrome, Firefox, and Safari, but keep reading for the full analysis.)
]FIG]
[37] [CITE@en[Write structured clone algorithm in terms of ECMAScript · whatwg/html@bfb960c]]
([TIME[2016-03-02 16:38:38 +09:00]] 版)
<https://github.com/whatwg/html/commit/bfb960c938580c95e77365e614218b952f96375b>
[80] [CITE@en[Make window.postMessage grab settings objects before going async · whatwg/html@26f5645]]
([TIME[2016-03-24 21:26:11 +09:00]] 版)
<https://github.com/whatwg/html/commit/26f5645b0c161c60903e945adace86165d56c03c>
[84] [CITE@en[Use FrozenArray for Navigator#languages and MessageEvent#ports · whatwg/html@e4df68a]]
([TIME[2016-03-25 13:52:53 +09:00]] 版)
<https://github.com/whatwg/html/commit/e4df68a41b86753c7fcdd0d8ea4615f63ffc87e9>
[86] [CITE@en[Clarify settings object, realm, and global relationships · whatwg/html@0866f1b]]
([TIME[2016-03-28 00:37:35 +09:00]] 版)
<https://github.com/whatwg/html/commit/0866f1b3f4b4ea5a99a30909e9bbe557dea0b460>
[87] [CITE@en[Editorial: else -> false in postMessage() algorithm · whatwg/html@60e5fc3]]
([TIME[2016-04-05 14:05:10 +09:00]] 版)
<https://github.com/whatwg/html/commit/60e5fc361572c8d0ef576dc78542ec4b845aef5b>
[88] [CITE@en[postMessage should always be flexible; HT @NAndreasson · w3c/webappsec-cowl@7ec257b]]
([TIME[2016-04-07 11:06:22 +09:00]] 版)
<https://github.com/w3c/webappsec-cowl/commit/7ec257b9951bff0fb8f81253b94124eb1afe64e4>
[89] [CITE@en[Use USVString for all URLs]]
( ([[domenic]]著, [TIME[2016-05-20 22:02:29 +09:00]]))
<https://github.com/whatwg/html/commit/018b983b77b2cd908f6d00100e7e0abe893dd2c3>
[90] [CITE@en[Use only the incumbent global in postMessage]]
([[domenic]]著, [TIME[2016-07-20 22:41:29 +09:00]])
<https://github.com/whatwg/html/commit/8259a69aab7538b772beebad1ff69dca44b159ab>
[95] [CITE@en[Parse postMessage()'s targetOrigin argument]]
([[annevk]]著, [TIME[2016-07-22 01:32:19 +09:00]])
<https://github.com/whatwg/html/commit/8282fc8dd47891160859375d0eacfcd08f9bdec4>
[107] [CITE@en[Tidy up the various postMessage algorithms]]
([[domenic]]著, [TIME[2016-07-28 02:42:32 +09:00]])
<https://github.com/whatwg/html/commit/ee103bbdba81bdbb8eb8e1bf77e9565f6158c5be>
[19] [CITE[javascript - postMessage still broken on IE11? - Stack Overflow]]
( ([TIME[2016-10-03 16:49:38 +09:00]]))
<http://stackoverflow.com/questions/21070553/postmessage-still-broken-on-ie11>
[94] [CITE@en[Set some MessageEvent's isTrusted attributes to true]]
([[domenic]]著, [TIME[2016-10-26 02:33:24 +09:00]])
<https://github.com/whatwg/html/commit/eecea4bf565a442e98c2ec98bf298d082d196282>
[162] [CITE@en[Breaking: refactor structured clone into serialize/deserialize]]
([[domenic]]著, [TIME[2017-03-21 06:09:33 +09:00]])
<https://github.com/whatwg/html/commit/97d644c97335956610a31e8ad98d1a388c063e84>
[129] [CITE@en[Define messageerror]]
([[annevk]]著, [TIME[2017-04-13 20:36:23 +09:00]])
<https://github.com/whatwg/html/commit/25a94f606e983534a863a0559d65bd29bb940a02>
[137] [CITE[The WHATWG Blog — HTML and shared memory]]
([TIME[2017-05-02 09:02:01 +09:00]])
<https://blog.whatwg.org/html-and-shared-memory>
[148] [CITE@en[Remove Unicode serialization of an origin]]
([[annevk]]著, [TIME[2017-05-18 13:24:49 +09:00]])
<https://github.com/whatwg/html/commit/59ebd9c094d9d532458a9ee61f307bf41bc70811>
[164] [CITE@en[No longer remove tasks for document.open() by annevk · Pull Request #3665 · whatwg/html]]
([TIME[2018-08-23 20:18:16 +09:00]])
<https://github.com/whatwg/html/pull/3665>
[22] [CITE@en[Add postMessage overrides that take options]] ([[dtapuska]]著, [TIME[2018-10-26 23:34:40 +09:00]]) <https://github.com/whatwg/html/commit/c501dd8ca54a10083c110e695e68f5347b3c1ba9>
[167] [CITE@en[Add Window.postMessage override that takes a dictionary · Issue #3799 · whatwg/html]] ([TIME[2019-04-25 12:42:46 +09:00]]) <https://github.com/whatwg/html/issues/3799>
[169] [CITE@en[Add postMessage override that provides WindowPostMessageOptions. by dtapuska · Pull Request #3800 · whatwg/html]] ([TIME[2019-04-25 12:43:08 +09:00]]) <https://github.com/whatwg/html/pull/3800>
[166] [CITE@en[Mark postMessage()'s dictionary argument optional]]
([[dtapuska]]著, [TIME[2018-10-30 22:53:37 +09:00]])
<https://github.com/whatwg/html/commit/e3f1cc890a3d6bedc46379f65853529e9de91dc1>
[170] [CITE@en[" void postMessage(any message, optional sequenc..." · Issue #4137 · whatwg/html]]
([TIME[2019-04-25 12:43:32 +09:00]])
<https://github.com/whatwg/html/issues/4137>
[171] [CITE@en[Move optional param to be on PostMessageOptions dictionary instead of transfer. by dtapuska · Pull Request #4138 · whatwg/html]]
([TIME[2019-04-25 12:43:47 +09:00]])
<https://github.com/whatwg/html/pull/4138>
[172] [CITE@en[Fix postMessage domintro link to go to the correct overload]]
([[saschanaz]]著, [TIME[2018-11-03 07:28:03 +09:00]])
<https://github.com/whatwg/html/commit/1b6288baa27dd9dd894f05c092a86101f305daeb>
[173] [CITE@en[Fix postMessage link by saschanaz · Pull Request #4135 · whatwg/html]]
([TIME[2019-04-25 12:44:26 +09:00]])
<https://github.com/whatwg/html/pull/4135>
[174] [CITE@en[Mark PostMessageOptions argument as optional on MessagePort]]
([[dtapuska]]著, [TIME[2018-11-02 23:02:57 +09:00]])
<https://github.com/whatwg/html/commit/88493eca9066b740c2d2fd579b7250eb1307a6a2>
[175] [CITE@en[Move optional field to be on dictionary instead of transfer. by dtapuska · Pull Request #4156 · whatwg/html]]
([TIME[2019-04-25 12:44:53 +09:00]])
<https://github.com/whatwg/html/pull/4156>
[186] [CITE@en[Memorandum of Understanding Between W3C and WHATWG]]
([TIME[2019-05-28 17:23:37 +09:00]])
<https://www.w3.org/2019/04/WHATWG-W3C-MOU.html>
[187] [CITE@en[Add API for postMessage with PostMessageOptions]]
([[dtapuska]]著, [TIME[2018-08-11 04:48:19 +09:00]])
<https://github.com/w3c/ServiceWorker/commit/3b3197431df710b2d60a69cdb94be6a63cc64f6d>
[188] [CITE@en[Make Client.postMessage to unloaded client not throw (#1293)]]
([[jungkees]]著, [TIME[2019-05-29 00:36:43 +09:00]])
<https://github.com/w3c/ServiceWorker/commit/86d941499aee42c701b1d6dfc8dab1eeda5ef526>
[189] [CITE@en[Make Client.postMessage to unloaded client not throw by jungkees · Pull Request #1293 · w3c/ServiceWorker]]
([TIME[2020-01-12 14:35:50 +09:00]])
<https://github.com/w3c/ServiceWorker/pull/1293>
[190] [CITE@en[Client.postMessage() throwing for unloaded client is problematic · Issue #1291 · w3c/ServiceWorker]]
([TIME[2020-01-12 14:36:06 +09:00]])
<https://github.com/w3c/ServiceWorker/issues/1291>
[191] [CITE@en[Use ASCII serialization for origins (#1151)]]
([[jungkees]]著, [TIME[2019-06-14 03:09:32 +09:00]])
<https://github.com/w3c/ServiceWorker/commit/a47c6d86c1436a4fff573d2a5da92b0e14891fa2>
[192] [CITE@en[Specify which event loop to use for posting messages by domenic · Pull Request #4917 · whatwg/html]]
([TIME[2020-05-14 14:22:15 +09:00]])
<https://github.com/whatwg/html/pull/4917>
[193] [CITE@en['Window post message steps' doesn't define which event loop is used for queuing a task · Issue #4653 · whatwg/html]]
([TIME[2020-05-14 14:22:39 +09:00]])
<https://github.com/whatwg/html/issues/4653>