Bug 533635 - Don't automatically wrap iframe elements in XOWs. Rely on XPConnect wrapping for the right security wrappers. r=peterv

This commit is contained in:
Blake Kaplan 2010-01-04 23:00:29 -08:00
Родитель 5105e8eb41
Коммит 538ce97810
4 изменённых файлов: 66 добавлений и 7 удалений

Просмотреть файл

@ -59,6 +59,8 @@ _TEST_FILES = \
test_clipboard_events.html \
test_focusrings.xul \
test_nodesFromRect.html \
test_frameElementWrapping.html \
file_frameElementWrapping.html \
$(NULL)
libs:: $(_TEST_FILES)

Просмотреть файл

@ -0,0 +1,26 @@
<html>
<script>
function check(elt, expectXOW, message) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
var result = ((utils.getClassName(elt) === 'XPCCrossOriginWrapper') === expectXOW)
? "PASS"
: "FAIL";
parent.postMessage(result + ',' + message, '*');
}
try {
// true if same origin, throws otherwise
var sameOrigin = parent.location.href !== '';
} catch (e) {
sameOrigin = false;
}
check(frameElement, !sameOrigin,
sameOrigin
? 'no wrapper needed if same origin'
: 'wrapper needed if not same origin');
</script>
</html>

Просмотреть файл

@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for location object behaviors</title>
<script type="text/javascript" src="/MochiKit/packed.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>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<iframe id="ifr" src="file_frameElementWrapping.html"></iframe>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var count = 0;
function runTest(result, message) {
ok(result === 'PASS', message);
if (++count === 2)
SimpleTest.finish();
else
$('ifr').contentWindow.location = 'http://example.org/tests/dom/tests/mochitest/general/file_frameElementWrapping.html';
}
window.addEventListener("message",
function(event) { runTest.apply(null, event.data.split(',')) },
false);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -109,13 +109,6 @@ ClassNeedsXOW(const char *name)
return strcmp(++name, "indow") == 0;
case 'L':
return strcmp(++name, "ocation") == 0;
case 'H':
if (strncmp(++name, "TML", 3))
break;
name += 3;
if (*name == 'I')
++name;
return strcmp(name, "FrameElement") == 0;
default:
break;
}