This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding test for bug 796917 using postMessage to an iframe from a cont…
…ent script does not serialize data
- Loading branch information
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<script> | ||
window.addEventListener("message", function(msg) { | ||
parent.postMessage(msg.data, "*"); | ||
}); | ||
|
||
parent.postMessage({ | ||
first: "a string", | ||
second: ["an", "array"], | ||
third: {an: 'object'} | ||
}, '*'); | ||
</script> | ||
</head> | ||
<body> | ||
<h1>Inner iframe</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
</head> | ||
<body> | ||
<iframe id="inner" src="about:blank"></iframe> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
var count = 0 | ||
|
||
setTimeout(function() { | ||
window.addEventListener("message", function(msg) { | ||
if (++count > 1) self.postMessage(msg.data); | ||
else msg.source.postMessage(msg.data, '*'); | ||
}); | ||
|
||
document.getElementById('inner').src = iframePath; | ||
}, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters