Index: content/test/data/browser_plugin_embedder.html |
diff --git a/content/test/data/browser_plugin_embedder.html b/content/test/data/browser_plugin_embedder.html |
index fb70190a767173c43b5f411923db241b084328da..251f2ff4c357b576980a2894ea8162b5b0e5700d 100644 |
--- a/content/test/data/browser_plugin_embedder.html |
+++ b/content/test/data/browser_plugin_embedder.html |
@@ -8,6 +8,16 @@ function SetSize(w, h) { |
plugin.width = w; |
plugin.height = h; |
} |
+function PostMessage(data, targetiframe) { |
+ plugin = document.getElementById('plugin'); |
+ // TODO(fsamuel): contentWindow can be accessed directly once |
+ // http://wkbug.com/85679 lands. |
+ if (targetiframe) { |
+ plugin.contentWindow.frames[0].postMessage('testing123', '*'); |
+ } else { |
+ plugin.contentWindow.frames.postMessage('testing123', '*'); |
+ } |
+} |
function Back() { |
var plugin = document.getElementById('plugin'); |
plugin.back(); |
@@ -28,3 +38,24 @@ function Go(relativeIndex) { |
width="640" |
height="480" |
border="0px"></object> |
+<script type="text/javascript"> |
+var msg; |
+function receiveMessage(event) { |
+ msg = event.data; |
+ if (msg == 'ready') { |
+ document.title = 'ready'; |
+ return; |
+ } |
+ if (msg.indexOf('stop_ack') == -1) { |
+ event.source.postMessage('stop', '*'); |
+ } else { |
+ var name = msg.replace("stop_ack", "").trim(); |
+ if (name !== '') { |
+ window.document.title = name; |
+ } else { |
+ window.document.title = 'main guest'; |
+ } |
+ } |
+} |
+document.getElementById('plugin').addEventListener('message', receiveMessage, false); |
+</script> |