Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: content/test/data/browser_plugin_embedder.html

Issue 10829225: Browser Plugin: Add HTML5-like postMessage support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT. Added subframe targeting + test. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698