mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
d8bc476488
commit
275b9f21ac
@ -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)
|
||||
|
26
dom/tests/mochitest/general/file_frameElementWrapping.html
Normal file
26
dom/tests/mochitest/general/file_frameElementWrapping.html
Normal file
@ -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>
|
38
dom/tests/mochitest/general/test_frameElementWrapping.html
Normal file
38
dom/tests/mochitest/general/test_frameElementWrapping.html
Normal file
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user