mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 05:14:24 +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) {
|
||||
check(xhr.responseXML.documentElement.getAttribute("root"));
|
||||
if (secondDoc) {
|
||||
parent.location.hash = "#done";
|
||||
SpecialPowers.wrap(parent).location.hash = "#done";
|
||||
}
|
||||
else {
|
||||
secondDoc = true;
|
||||
@ -48,7 +48,7 @@ function runTest2() {
|
||||
|
||||
function check(attr) {
|
||||
if (attr != "yes") {
|
||||
parent.location.hash = "#fail";
|
||||
SpeciaPowers.wrap(parent).location.hash = "#fail";
|
||||
throw 1;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ function isCrossOriginWritable(obj, prop) {
|
||||
if (obj == "Window")
|
||||
return prop == '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.
|
||||
@ -72,7 +72,7 @@ function testAll(sameOrigin) {
|
||||
for (var prop in window.location) {
|
||||
check(win.location, prop, sameOrigin || isCrossOriginReadable('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;
|
||||
switch (name[0]) {
|
||||
NAME('L', "Location",
|
||||
PROP('h', W("hash") W("href"))
|
||||
PROP('h', W("href"))
|
||||
PROP('r', R("replace")))
|
||||
NAME('W', "Window",
|
||||
PROP('b', R("blur"))
|
||||
|
Loading…
Reference in New Issue
Block a user