mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 409349 - [p=honzab@allpeers.com (Honza Bambas [mayhemer]) r=Enn sr=dveditz a1.9=damons a=blocking1.9+]
This commit is contained in:
parent
e7430bcac9
commit
ce8dfb0807
@ -37,6 +37,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "prnetdb.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
@ -1093,6 +1094,15 @@ PRBool
|
||||
nsDOMStorageList::CanAccessDomain(const nsAString& aRequestedDomain,
|
||||
const nsAString& aCurrentDomain)
|
||||
{
|
||||
PRNetAddr address;
|
||||
PRStatus status = PR_StringToNetAddr(NS_ConvertUTF16toUTF8(aCurrentDomain).get(), &address);
|
||||
|
||||
if (status == PR_SUCCESS) {
|
||||
// An IP address must match exactly. IPv6: when location is e.g. "::1" and we require
|
||||
// "0:0:0:0:0:1" then access will be denied.
|
||||
return aRequestedDomain == aCurrentDomain;
|
||||
}
|
||||
|
||||
nsStringArray requestedDomainArray, currentDomainArray;
|
||||
PRBool ok = ConvertDomainToArray(aRequestedDomain, &requestedDomainArray);
|
||||
if (!ok)
|
||||
|
@ -64,6 +64,8 @@ _TEST_FILES = \
|
||||
test_bug397571.html \
|
||||
test_bug400204.html \
|
||||
test_bug404748.html \
|
||||
test_bug409349.html \
|
||||
iframe_bug409349.html \
|
||||
test_bug411103.html \
|
||||
$(NULL)
|
||||
|
||||
|
63
dom/tests/mochitest/bugs/iframe_bug409349.html
Normal file
63
dom/tests/mochitest/bugs/iframe_bug409349.html
Normal file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Child window at 127.0.0.1</title>
|
||||
<script type="application/javascript">
|
||||
|
||||
function run()
|
||||
{
|
||||
var storage;
|
||||
|
||||
var message = "child-response";
|
||||
|
||||
try {
|
||||
storage = globalStorage["127.0.0.1"];
|
||||
}
|
||||
catch (ex) {
|
||||
message += "\n failed globalStorage[\"127.0.0.1\"]";
|
||||
}
|
||||
|
||||
try {
|
||||
storage = globalStorage["126.0.0.1"];
|
||||
message += "\n passed globalStorage[\"126.0.0.1\"]";
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
|
||||
try {
|
||||
storage = globalStorage["0.0.1"];
|
||||
message += "\n passed globalStorage[\"0.0.1\"]";
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
|
||||
try {
|
||||
storage = globalStorage["126.0.0"];
|
||||
message += "\n passed globalStorage[\"126.0.0\"]";
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
|
||||
try {
|
||||
storage = globalStorage["X.126.0.0.1"];
|
||||
message += "\n passed globalStorage[\"X.126.0.0.1\"]";
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
|
||||
try {
|
||||
storage = globalStorage["X.0.0.1"];
|
||||
message += "\n passed globalStorage[\"X.0.0.1\"]";
|
||||
}
|
||||
catch (ex) {
|
||||
}
|
||||
|
||||
window.parent.postMessage(message);
|
||||
}
|
||||
|
||||
window.addEventListener("load", run, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
36
dom/tests/mochitest/bugs/test_bug409349.html
Normal file
36
dom/tests/mochitest/bugs/test_bug409349.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Cannot get globalStorage objects for partial IP addresses</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/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 name="child" src="http://127.0.0.1:8888/tests/dom/tests/mochitest/bugs/iframe_bug409349.html"></iframe>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function receiveMessage(evt)
|
||||
{
|
||||
is(evt.domain, "127.0.0.1", "wrong sender");
|
||||
ok(evt.source === window.frames.child, "wrong sender");
|
||||
|
||||
is(evt.data, "child-response", "got wrong response");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
document.addEventListener("message", receiveMessage, false);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user