Bug 1673414 - [Fission] Enable history.https.sub.html and navigation-in-onload.tentative.html, r=ckerschb

history.https.sub.html seems to have a racy part. Since that is most of the patch, perhaps ckerschb you could
review this.

navigation-in-onload.tentative.html part is just enabling a test which passes on Fission now.

Differential Revision: https://phabricator.services.mozilla.com/D98364
This commit is contained in:
Olli Pettay 2020-12-01 18:42:49 +00:00
Родитель eb36b1aaab
Коммит b88e9dc845
4 изменённых файлов: 40 добавлений и 20 удалений

Просмотреть файл

@ -1,3 +0,0 @@
[history.https.sub.html]
disabled:
if fission: https://bugzilla.mozilla.org/show_bug.cgi?id=1656208

Просмотреть файл

@ -1,6 +0,0 @@
[navigation-in-onload.tentative.html]
[Navigation in onload handler]
expected:
if fission and debug: ["PASS", "FAIL"]
if fission and not debug: ["PASS", "FAIL"]

Просмотреть файл

@ -9,8 +9,8 @@
/// headers) are used in navigations triggered by |history.back()|.
function add_test(description, report_host, go_back_host, expectations) {
async_test(t => {
// STEP1: Navigate a new window to report_host/post-to-owner.py
const url_suffix = '/fetch/metadata/resources/post-to-owner.py';
// STEP1: Navigate a new window to report_host/post-to-owner-onload.py
const url_suffix = '/fetch/metadata/resources/post-to-owner-onload.py';
const url = `https://${report_host}${url_suffix}`;
const w = window.open(url, '_blank');
@ -24,15 +24,10 @@ function add_test(description, report_host, go_back_host, expectations) {
// headers are used here and in STEP5).
assert_header_equals(e.data, expectations, description + " 1");
// STEP3: Go to go_back_host/go-back.html (postponing this via
// step_timeout ensures that go-back.html will get a separate
// history entry - otherwise it might be treated as a client-side
// redirect and we might end up with nowhere to go back to).
t.step_timeout(() => {
const url_suffix = '/fetch/metadata/resources/go-back.html';
const url = `https://${go_back_host}${url_suffix}`;
w.location = url;
});
// STEP3: Go to go_back_host/go-back.html
const url_suffix = '/fetch/metadata/resources/go-back.html';
const url = `https://${go_back_host}${url_suffix}`;
w.location = url;
// STEP4 (elsewhere - inside go-back.html): Call history.back().
} else if (msg_counter == 2) {

Просмотреть файл

@ -0,0 +1,34 @@
import json
from wptserve.utils import isomorphic_decode
def main(request, response):
headers = [
(b"Content-Type", b"text/html"),
(b"Cache-Control", b"no-cache, no-store, must-revalidate")
]
key = request.GET.first(b"key", None)
body = u"""
<!DOCTYPE html>
<script src="/portals/resources/stash-utils.sub.js"></script>
<script>
window.onload = function() {
var data = %s;
if (window.opener)
window.opener.postMessage(data, "*");
if (window.top != window)
window.top.postMessage(data, "*");
const key = %s;
if (key)
StashUtils.putValue(key, data);
}
</script>
""" % (json.dumps({
u"dest": isomorphic_decode(request.headers.get(b"sec-fetch-dest", b"")),
u"mode": isomorphic_decode(request.headers.get(b"sec-fetch-mode", b"")),
u"site": isomorphic_decode(request.headers.get(b"sec-fetch-site", b"")),
u"user": isomorphic_decode(request.headers.get(b"sec-fetch-user", b"")),
}), json.dumps(key))
return headers, body