@@ -182,6 +182,51 @@ public void postMessageWithoutTargetOrigin() throws Exception {
182182 loadPageVerifyTitle2 (html );
183183 }
184184
185+ /**
186+ * @throws Exception if the test fails
187+ */
188+ @ Test
189+ @ Alerts ({"type: message" , "bubbles: false" , "cancelable: false" , "data: hello" ,
190+ "origin: " , "source: false true" , "lastEventId: " })
191+ public void postMessageWithTransferableOnly () throws Exception {
192+ final String [] expectedAlerts = getExpectedAlerts ();
193+ expectedAlerts [4 ] += "http://localhost:" + PORT ;
194+ setExpectedAlerts (expectedAlerts );
195+
196+ final String html = DOCTYPE_HTML
197+ + "<html>\n "
198+ + "<head></head>\n "
199+ + "<body>\n "
200+ + " <iframe id='myFrame' src='" + URL_THIRD + "'></iframe>\n "
201+
202+ + "<script>\n "
203+ + LOG_TITLE_FUNCTION
204+ + " var win = document.getElementById('myFrame').contentWindow;\n "
205+
206+ + " function receiveMessage(event) {\n "
207+ + " log('type: ' + event.type);\n "
208+ + " log('bubbles: ' + event.bubbles);\n "
209+ + " log('cancelable: ' + event.cancelable);\n "
210+ + " log('data: ' + event.data);\n "
211+ + " log('origin: ' + event.origin);\n "
212+ + " log('source: ' + (event.source === win) + ' ' + (event.source === window));\n "
213+ + " log('lastEventId: ' + event.lastEventId);\n "
214+ + " }\n "
215+
216+ + " win.addEventListener('message', receiveMessage, false);\n "
217+
218+ + " uInt8Array = new Uint8Array(1);\n "
219+ + " win.postMessage('hello', [uInt8Array.buffer]);\n "
220+ + "</script>\n "
221+ + "</body></html>" ;
222+
223+ final String iframe = DOCTYPE_HTML
224+ + "<html><body><p>inside frame</p></body></html>" ;
225+
226+ getMockWebConnection ().setResponse (URL_THIRD , iframe );
227+ loadPageVerifyTitle2 (html );
228+ }
229+
185230 /**
186231 * Test for #1589 NullPointerException because of missing context.
187232 *
0 commit comments