added in cross origin type checks. assert_throws isn't working yet

This commit is contained in:
ddh 2017-05-15 17:06:47 +01:00
parent af3940fbf0
commit 0316a0def6
2 changed files with 13 additions and 10 deletions

View file

@ -77,6 +77,9 @@ enum WrapperType {
Opaque,
}
/* this is duplicate code. there's some in C in jsglue.cpp.
* TODO decide what to do about this
*/
#[derive(Debug, PartialEq)]
enum CrossOriginObjectType {
CrossOriginWindow,

View file

@ -60,27 +60,27 @@ addTest(function() {
//assert_equals(C.parent, window, "window.parent works cross-origin");
assert_equals(B.location.pathname, path, "location.href works same-origin");
//TODO do document.write and console.log have same behavior?
/*try {
try {
console.log("C.location.pathname should throw");
console.log(C.location.pathname); //permission denied to unwrap object
} catch(err) {
console.log(err.message);
}*/
console.log(C.location.pathname);
assert_throws("SecurityError", function() { C.location.pathname; }, "location.pathname throws cross-origin");
/*try {
console.log(err); //ok it's getting that it's a security error, but not reading it right for the asssert
}
//console.log(C.location.pathname);
//assert_throws("SecurityError", function() { C.location.pathname; }, "location.pathname throws cross-origin");
try {
console.log("B.frames: override");
console.log(B.frames);
} catch(err) {
console.log(err.message);
console.log(err);
}
//assert_equals(B.frames, 'override', "Overrides visible in the same-origin case");
assert_equals(B.frames, 'override', "Overrides visible in the same-origin case");
try {
console.log("C.frames should throw");
console.log(C.frames);
} catch(err) {
console.log(err.message);
}*/
console.log(err);
}
//assert_equals(C.frames, C, "Overrides invisible in the cross-origin case");
}, "Basic sanity-checking");