mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
2672787670
This was taken care of in other ways before, but we need to be more explicit about it now that we're doing more Xray stuff with Location wrappers.
43 lines
1.6 KiB
HTML
43 lines
1.6 KiB
HTML
<html>
|
|
<head>
|
|
<title>Test NPNVdocumentOrigin</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
</head>
|
|
<body onload="runTest()">
|
|
<embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
|
|
|
|
<script class="testbody" type="application/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
function runTest() {
|
|
var p1 = document.getElementById("plugin1");
|
|
var realOrigin = "http://mochi.test:8888";
|
|
|
|
// Test with no modifications
|
|
is(p1.getNPNVdocumentOrigin(), realOrigin, "Checking for expected origin.");
|
|
|
|
// This used to test that shadowing window.location.toString didn't confuse
|
|
// getNPNVdocumentOrigin. But now we explicitly throw when that happens. So
|
|
// just verify that we throw. There's no reason why getNPNVdocumentOrigin _would_
|
|
// be confused in this case anyway.
|
|
try {
|
|
window.location.toString = function() { return 'http://victim.rckc.at/'; }
|
|
ok(false, "Should throw when shadowing window.location.toString");
|
|
}
|
|
catch (e) {
|
|
ok(true, "Should throw when shadowing window.location.toString");
|
|
}
|
|
|
|
// Create a plugin in a new window with about:blank
|
|
var newWindow = window.open("about:blank");
|
|
newWindow.document.writeln('<embed id="plugin2" type="application/x-test" width="200" height="200"></embed>');
|
|
var p2 = newWindow.document.getElementById("plugin2");
|
|
is(p2.getNPNVdocumentOrigin(), realOrigin, "Checking for expected origin of plugin in new about:blank window.");
|
|
newWindow.close();
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|