Skip to content

Instantly share code, notes, and snippets.

@sideshowbarker
Last active December 30, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sideshowbarker/7855058 to your computer and use it in GitHub Desktop.
Save sideshowbarker/7855058 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<meta charset="utf-8">
<title>Pathological case for resolution of base URIs with javascript: in iframes (javascript:location.assign)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<base href="/html/browsers/browsing-the-web/navigating-across-documents/javascript-protocol">
<body onload="frames[0].location = 'javascript:location.assign(&quot;test.txt&quot)'">
<iframe onload="frameLoaded()"
src="/html/browsers/browsing-the-web/navigating-across-documents/javascript-protocol/inner-address/inner.html"></iframe>
<script>
var t = async_test("base URIs with javascript: in iframes (javascript:location.assign)")
, expectedPathname = "/html/browsers/browsing-the-web/navigating-across-documents/javascript-protocol/inner-address/test.txt"
, pathname
, count = 0;
function frameLoaded() {
count++;
if (count > 1) {
t.step(function () {
pathname = document.querySelector("iframe").contentWindow.location.pathname;
assert_equals(pathname, expectedPathname);
}
);
t.done();
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment