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, Opaque,
} }
/* this is duplicate code. there's some in C in jsglue.cpp.
* TODO decide what to do about this
*/
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
enum CrossOriginObjectType { enum CrossOriginObjectType {
CrossOriginWindow, CrossOriginWindow,

View file

@ -60,27 +60,27 @@ addTest(function() {
//assert_equals(C.parent, window, "window.parent works cross-origin"); //assert_equals(C.parent, window, "window.parent works cross-origin");
assert_equals(B.location.pathname, path, "location.href works same-origin"); assert_equals(B.location.pathname, path, "location.href works same-origin");
//TODO do document.write and console.log have same behavior? //TODO do document.write and console.log have same behavior?
/*try { try {
console.log("C.location.pathname should throw"); console.log("C.location.pathname should throw");
console.log(C.location.pathname); //permission denied to unwrap object console.log(C.location.pathname); //permission denied to unwrap object
} catch(err) { } catch(err) {
console.log(err.message); 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); //console.log(C.location.pathname);
assert_throws("SecurityError", function() { C.location.pathname; }, "location.pathname throws cross-origin"); //assert_throws("SecurityError", function() { C.location.pathname; }, "location.pathname throws cross-origin");
/*try { try {
console.log("B.frames: override"); console.log("B.frames: override");
console.log(B.frames); console.log(B.frames);
} catch(err) { } 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 { try {
console.log("C.frames should throw"); console.log("C.frames should throw");
console.log(C.frames); console.log(C.frames);
} catch(err) { } catch(err) {
console.log(err.message); console.log(err);
}*/ }
//assert_equals(C.frames, C, "Overrides invisible in the cross-origin case"); //assert_equals(C.frames, C, "Overrides invisible in the cross-origin case");
}, "Basic sanity-checking"); }, "Basic sanity-checking");