Bug 893537 - Crash after unloading an iframe with srcdoc attribute set. r=bz

This commit is contained in:
James Kitchener 2013-07-16 10:32:39 -04:00
parent 79fae3c7f5
commit 1c00ff219a
4 changed files with 56 additions and 0 deletions

View File

@ -390,6 +390,8 @@ MOCHITEST_FILES = \
file_srcdoc.html \
test_srcdoc-2.html \
file_srcdoc-2.html \
test_bug893537.html \
file_bug893537.html \
$(NULL)
MOCHITEST_CHROME_FILES = \

View File

@ -0,0 +1,9 @@
<!doctype html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=893537
-->
<body>
<iframe id="iframe" src="data:text/html;charset=US-ASCII,Goodbye World" srcdoc="Hello World"></iframe>
</body>
</html>

View File

@ -0,0 +1,42 @@
<!doctype html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=893537
-->
<head>
<title>Test for crash caused by unloading and reloading srcdoc iframes</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=893537">Mozilla Bug 893537</a>
<iframe id="pframe" src="file_bug893537.html"></iframe>
<pre id="test">
<script>
SimpleTest.waitForExplicitFinish();
var pframe = $("pframe");
var loadState = 1;
pframe.contentWindow.addEventListener("load", function () {
if (loadState == 1) {
var iframe = pframe.contentDocument.getElementById("iframe");
iframe.removeAttribute("srcdoc");
loadState = 2;
}
if (loadState == 2) {
SimpleTest.executeSoon(function () { pframe.contentWindow.location.reload() });
loadState = 3;
}
if (loadState == 3) {
ok(true, "This is a mochitest implementation of a crashtest. To finish is to pass");
SimpleTest.finish();
}
});
</script>
</pre>
</body>
</html>

View File

@ -374,6 +374,9 @@ nsSHEntry::Create(nsIURI * aURI, const nsAString &aTitle,
//By default the page is not expired
mShared->mExpired = false;
mIsSrcdocEntry = false;
mSrcdocData = NullString();
return NS_OK;
}