Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug where using a port number in the url would cause the test to fail. #162

Merged
merged 2 commits into from
Jun 8, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions webmessaging/event.origin.htm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var TARGET1 = document.querySelectorAll("iframe")[0];
var TARGET2 = document.querySelectorAll("iframe")[1];
var XORIGIN = "http://www1.w3c-test.org";
var SORIGIN = "http://" + location.hostname;
var SORIGIN = "http://" + location.host;
var ExpectedResult = ["#1", XORIGIN, "#2", SORIGIN];
var ActualResult = [];
var loaded = 0;
Expand All @@ -41,12 +41,13 @@

window.onmessage = t.step_func(function(e)
{
ActualResult.push(e.data, e.origin);

if (ActualResult.length >= ExpectedResult.length)
{
assert_array_equals(ActualResult, ExpectedResult, "ActualResult");
t.done();
// testharness.js uses postMessage so we must check what data we want to receive
if (e.data.toString() === "#1" || e.data.toString() === "#2") {
ActualResult.push(e.data, e.origin);
if (ActualResult.length === ExpectedResult.length) {
assert_array_equals(ActualResult, ExpectedResult, "ActualResult");
t.done();
}
}
});
</script>
Expand Down