Landing fix for bug 440572 for 3.0. Fix permission problem with window.content (and probably other properties as well). r+sr=mrbkap@gmail.com, a=samuel.sidler@gmail.com

git-svn-id: svn://10.0.0.236/trunk@253660 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%mozilla.org 2008-08-17 00:52:26 +00:00
parent 8abb2bd757
commit 81641f9c64
4 changed files with 73 additions and 2 deletions

View File

@ -4495,10 +4495,14 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
const char *name = JS_GET_CLASS(cx, JSVAL_TO_OBJECT(*vp))->name;
// The list of Window class names here need to be kept in sync
// with the actual class names!
// with the actual class names! The class name
// XPCCrossOriginWrapper needs to be handled here too as XOWs
// define child frame names with a XOW as the value, and thus
// we'll need to get through here with XOWs class name too.
if ((*name == 'W' && strcmp(name, "Window") == 0) ||
(*name == 'C' && strcmp(name, "ChromeWindow") == 0) ||
(*name == 'M' && strcmp(name, "ModalContentWindow") == 0)) {
(*name == 'M' && strcmp(name, "ModalContentWindow") == 0) ||
(*name == 'X' && strcmp(name, "XPCCrossOriginWrapper") == 0)) {
nsCOMPtr<nsIXPConnectWrappedNative> vpwrapper;
sXPConnect->GetWrappedNativeOfJSObject(cx, JSVAL_TO_OBJECT(*vp),
getter_AddRefs(vpwrapper));

View File

@ -77,6 +77,8 @@ _TEST_FILES = \
test_bug430276.html \
iframe_bug430276.html \
iframe_bug430276-2.html \
test_bug440572.html \
iframe_bug440572.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,17 @@
<html>
<body>
<script>
var success = 0;
try {
parent[name].success = 1;
} catch (e) {
parent.postMessage(e, "http://localhost:8888");
}
parent.postMessage(success ? "success" : "failure", "http://localhost:8888");
</script>
<p>Move on, nothing to see here...</p>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=440572
-->
<head>
<title>Test for Bug 440572</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="runtests()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=440572">Mozilla Bug 440572</a>
<script class="testbody" type="text/javascript">
/** Test for Bug 440572 **/
var messages = [];
function receiveMessage(e)
{
is(e.origin, "http://example.org", "wrong sender!");
messages.push(e.data);
}
window.addEventListener("message", receiveMessage, false);
function runtests()
{
for (i in messages) {
is(messages[i], "success", "test in frame failed.");
}
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
<br>
<iframe name="test" src="http://example.org:80/tests/dom/tests/mochitest/bugs/iframe_bug440572.html"></iframe>
<br>
<iframe name="content" src="http://example.org:80/tests/dom/tests/mochitest/bugs/iframe_bug440572.html"></iframe>
<br>
<iframe name="dump" src="http://example.org:80/tests/dom/tests/mochitest/bugs/iframe_bug440572.html"></iframe>
</body>
</html>