Skip to content

Commit

Permalink
wpt: Support http://host:80/ at EventListener / incumbent test
Browse files Browse the repository at this point in the history
MessageEvent's origin attribute will be
    http://hostname
instead of
    http://hostname:80
in case that the port number is HTTP standard port number, i.e. 80.

Usually this is not a problem because wptserve runs with port=8001
by default, but w3c-test.org runs with port=80.
http://w3c-test.org/dom/events/EventListener-incumbent-global-2.sub.html

This patch supports such a case.

Bug: 622974
Change-Id: I4567de3f5f12ae42c222229eafafecbbe72129e0
  • Loading branch information
yuki3 authored and chromium-wpt-export-bot committed May 13, 2019
1 parent aa4a4f6 commit 2ee6109
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
if (e.data == "sendclick") {
document.body.click();
} else {
let expectedOrigin = "{{location[scheme]}}://{{domains[www1]}}:{{ports[http][0]}}";
if ("{{location[scheme]}}" == "http" &&
"{{ports[http][0]}}" == "80") {
expectedOrigin = "{{location[scheme]}}://{{domains[www1]}}";
}
parent.postMessage(
{
actual: e.origin,
expected: "{{location[scheme]}}://{{domains[www1]}}:{{ports[http][0]}}",
expected: expectedOrigin,
reason: "Incumbent should have been the caller of addEventListener()"
},
"*")
Expand Down

0 comments on commit 2ee6109

Please sign in to comment.