Skip to content

Commit

Permalink
[WPT] <iframe srcdoc>'s base URL when parent's base URL is dynamicall…
Browse files Browse the repository at this point in the history
…y updated

Change-Id: I88141f5cd47437337a3513d27b9ac66ffb44cc72
  • Loading branch information
hiroshige-g authored and chromium-wpt-export-bot committed Apr 7, 2021
1 parent 293e321 commit aecf5db
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<meta charset=utf-8>
<title>base element added in the parent Document should be reflect insrcdoc document's base URL</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fallback-base-url">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe srcdoc=""></iframe>
<script>
var t = async_test();
addEventListener("load", t.step_func_done(function() {
var doc = frames[0].document;
var b = doc.createElement("base");
b.setAttribute("href", "test");
var newBaseValue = location.href.replace(/\/[^/]*$/, "/") + "test";
assert_equals(b.href, newBaseValue);
assert_equals(doc.baseURI, location.href);
// This <base> is added to the parent Document.
document.head.appendChild(b);
// And is reflected in <iframe srcdoc>'s base URI.
assert_equals(doc.baseURI, newBaseValue);
}));
</script>

0 comments on commit aecf5db

Please sign in to comment.