Skip to content

Commit

Permalink
WorkerLocation: ensure IDNA origin is in ASCII
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk authored and zcorpan committed Jun 21, 2017
1 parent 9702212 commit d6c43f5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions workers/WorkerLocation-origin.sub.window.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
async_test(t => {
const frame = document.createElement("iframe"),
asciiOrigin = location.protocol + "//{{domains[天気の良い日]}}:" + location.port,
path = new URL("support/WorkerLocation-origin.html", location).pathname;
frame.src = asciiOrigin + path;
self.onmessage = t.step_func_done(e => {
assert_equals(e.data.origin, asciiOrigin);
});
document.body.appendChild(frame);
t.add_cleanup(() => frame.remove());
}, "workerLocation.origin must use ASCII code points");
6 changes: 6 additions & 0 deletions workers/support/WorkerLocation-origin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
const w = new Worker("./WorkerLocation.js");
w.onmessage = e => {
parent.postMessage(e.data, "*");
}
</script>
1 change: 1 addition & 0 deletions workers/support/WorkerLocation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var obj = new Object();
obj.location = location.toString();
obj.href = location.href;
obj.origin = location.origin;
obj.protocol = location.protocol;
obj.host = location.host;
obj.hostname = location.hostname;
Expand Down

0 comments on commit d6c43f5

Please sign in to comment.