Skip to content

Commit

Permalink
Update tests to draft-ietf-httpbis-header-structure-19 and current HT…
Browse files Browse the repository at this point in the history
…ML standard
  • Loading branch information
zcorpan committed Aug 18, 2020
1 parent 1de7e8d commit 2843a50
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
24 changes: 16 additions & 8 deletions html/cross-origin-opener-policy/header-parsing.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,32 @@

// None of the following should be recognized as "same-origin" (hence the
// "expected opener" value of `true`).
[SAME_ORIGIN, "same\u2014origin;", true], // non-ASCII character (em dash)
[SAME_ORIGIN, "same\u2014origin", true], // non-ASCII character (em dash)
[SAME_ORIGIN, "same-origin;", true],
[SAME_ORIGIN, "same-origin\0", true],
[SAME_ORIGIN, "\u000bsame-origin\u000b", true], // vertical tab
[SAME_ORIGIN, "\u000csame-origin\u000c", true], // form feed
[SAME_ORIGIN, "\u000dsame-origin\u000d", true], // carriage return
[SAME_ORIGIN, "Same-origin", true],
[SAME_ORIGIN, "same-origin; foo=bar", true],
[SAME_ORIGIN, "\"same-origin\"", true], // HTTP structured header "string" item
[SAME_ORIGIN, "*c2FtZS1vcmlnaW4=*", true], // HTTP structured header "byte sequence" item
[SAME_ORIGIN, "same-origin;\tfoo=bar", true],
[SAME_ORIGIN, "same-origin ;foo=bar", true],
[SAME_ORIGIN, "same-origin; foo=bar;", true],
[SAME_ORIGIN, "\"same-origin\"", true], // HTTP structured fields "string" item
[SAME_ORIGIN, ":c2FtZS1vcmlnaW4=:", true], // HTTP structured fields "byte sequence" item
[SAME_ORIGIN, "?1", true], // HTTP structured fields "boolean" item
[SAME_ORIGIN, "1", true], // HTTP structured fields "integer or decimal" item
[SAME_ORIGIN, "$same-origin", true], // the item type is unrecognized
[SAME_ORIGIN, "same-origin same-origin", true],
[SAME_ORIGIN, "same-origin,same-origin", true],
[SAME_ORIGIN, "same-origin;same-origin", true],
[SAME_ORIGIN, "\tsame-origin", true],
[SAME_ORIGIN, "same-origin\t", true],
[SAME_ORIGIN, "*same-origin ", true],

// All of the following should be recognized as "same-origin" (hence the
// "expected opener" value of `false`).
[SAME_ORIGIN, " \tsame-origin", false],
[SAME_ORIGIN, "same-origin\t ", false],
[SAME_ORIGIN, " same-origin", false],
[SAME_ORIGIN, "same-origin ", false],
[SAME_ORIGIN, "same-origin;same-origin", false],
[SAME_ORIGIN, "same-origin; foo=bar", false],
];

run_coop_tests("unspecified", tests);
Expand Down
6 changes: 3 additions & 3 deletions html/cross-origin-opener-policy/resources/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function run_coop_tests(documentCOOPValueTitle, testArray) {
coop_test(t, test[0], test[1],
`${documentCOOPValueTitle}_to_${test[0].name}_${test[1].replace(/ /g,"-")}`,
test[2], () => { t.done(); });
}, `${documentCOOPValueTitle} document opening popup to ${test[0].origin} with COOP: "${test[1]}"`);
}, `${documentCOOPValueTitle} document opening popup to ${test[0].origin} with COOP: ${format_value(test[1])}`);
}
}

Expand Down Expand Up @@ -91,5 +91,5 @@ function run_coop_test_iframe (documentTitle, iframe_origin, popup_origin, popup
assert_equals(payload.name, expects_name? name:"", 'name');
});
document.body.append(frame);
}, `${documentTitle} with ${iframe_origin.name} iframe opening popup a ${popup_origin.name} with COOP: ${popup_coop}`);
}
}, `${documentTitle} with ${iframe_origin.name} iframe opening popup a ${popup_origin.name} with COOP: ${format_value(popup_coop)}`);
}

0 comments on commit 2843a50

Please sign in to comment.