mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 13:25:00 +00:00
Bug 839867 - Align gecko with the spec on cross-origin access to Location.hash. r=bz
We update the tests to cover this case. There was also a bug in the tests where we were accidentally testing non-writable Location properties against window rather than window.location. :-(
This commit is contained in:
parent
c212ead930
commit
047d41c0d3
@ -36,7 +36,7 @@ function runTest2() {
|
|||||||
if (xhr.readyState == 4) {
|
if (xhr.readyState == 4) {
|
||||||
check(xhr.responseXML.documentElement.getAttribute("root"));
|
check(xhr.responseXML.documentElement.getAttribute("root"));
|
||||||
if (secondDoc) {
|
if (secondDoc) {
|
||||||
parent.location.hash = "#done";
|
SpecialPowers.wrap(parent).location.hash = "#done";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
secondDoc = true;
|
secondDoc = true;
|
||||||
@ -48,7 +48,7 @@ function runTest2() {
|
|||||||
|
|
||||||
function check(attr) {
|
function check(attr) {
|
||||||
if (attr != "yes") {
|
if (attr != "yes") {
|
||||||
parent.location.hash = "#fail";
|
SpeciaPowers.wrap(parent).location.hash = "#fail";
|
||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ function isCrossOriginWritable(obj, prop) {
|
|||||||
if (obj == "Window")
|
if (obj == "Window")
|
||||||
return prop == 'location';
|
return prop == 'location';
|
||||||
if (obj == "Location")
|
if (obj == "Location")
|
||||||
return prop == 'hash' || prop == 'href';
|
return prop == 'href';
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: we don't want to succeed with writes, so we only check them when it should be denied.
|
// NB: we don't want to succeed with writes, so we only check them when it should be denied.
|
||||||
@ -72,7 +72,7 @@ function testAll(sameOrigin) {
|
|||||||
for (var prop in window.location) {
|
for (var prop in window.location) {
|
||||||
check(win.location, prop, sameOrigin || isCrossOriginReadable('Location', prop));
|
check(win.location, prop, sameOrigin || isCrossOriginReadable('Location', prop));
|
||||||
if (!sameOrigin && !isCrossOriginWritable('Location', prop))
|
if (!sameOrigin && !isCrossOriginWritable('Location', prop))
|
||||||
check(win, prop, false, /* write = */ true);
|
check(win.location, prop, false, /* write = */ true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ IsPermitted(const char *name, JSFlatString *prop, bool set)
|
|||||||
return false;
|
return false;
|
||||||
switch (name[0]) {
|
switch (name[0]) {
|
||||||
NAME('L', "Location",
|
NAME('L', "Location",
|
||||||
PROP('h', W("hash") W("href"))
|
PROP('h', W("href"))
|
||||||
PROP('r', R("replace")))
|
PROP('r', R("replace")))
|
||||||
NAME('W', "Window",
|
NAME('W', "Window",
|
||||||
PROP('b', R("blur"))
|
PROP('b', R("blur"))
|
||||||
|
Loading…
Reference in New Issue
Block a user