bug 382113 set LOAD_DOCUMENT_URI for <object> loads that load a document

so that things like onload events work correctly
r+sr=bz
This commit is contained in:
cbiesinger@web.de 2007-06-23 01:44:27 -07:00
parent 56193ee0c9
commit 41a142ff4f
4 changed files with 54 additions and 0 deletions

View File

@ -373,6 +373,13 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, nsISupports *aConte
notifier.Notify();
}
// We're loading a document, so we have to set LOAD_DOCUMENT_URI
// (especially important for firing onload)
nsLoadFlags flags = 0;
chan->GetLoadFlags(&flags);
flags |= nsIChannel::LOAD_DOCUMENT_URI;
chan->SetLoadFlags(flags);
nsCOMPtr<nsIDocShell> docShell;
rv = mFrameLoader->GetDocShell(getter_AddRefs(docShell));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -83,6 +83,8 @@ _TEST_FILES = test_bug5141.html \
test_bug372086.html \
test_bug373181.xhtml \
test_bug375314.html \
test_bug382113.html \
bug382113_object.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<title></title>
<body onload="parent.childGotOnload = true;">
<p>A Document in an &lt;object&gt;</p>
</body>

View File

@ -0,0 +1,39 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=382113
-->
<head>
<title>Test for Bug 382113</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="checkEvents()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=382113">Mozilla Bug 382113</a>
<p id="display"></p>
<div id="content">
<object type="text/html" data="bug382113_object.html"
onload="objectGotOnload = true;"></object>
</div>
<pre id="test">
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
var childGotOnload = false;
var objectGotOnload = false;
/** Test for Bug 100533 **/
function checkEvents() {
is(childGotOnload, true, "Child got load event");
is(objectGotOnload, true, "Object got load event");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>