mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1256652 - [webext] Add more tests on sub-frames WebNavigation transitions properties. r=krizsa
MozReview-Commit-ID: 8hjFmyfpXkR --HG-- extra : transplant_source : zn%89S%9C%F9%A3%EA%3EZ%D3%AD%25%CCG%29%60%99%1F1
This commit is contained in:
parent
32c8c2f2b7
commit
fcdfd59cc8
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE HTML>
|
||||
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<iframe src="file_webNavigation_clientRedirect.html" width="200" height="200"></iframe>
|
||||
|
||||
<form>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE HTML>
|
||||
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<iframe src="redirection.sjs" width="200" height="200"></iframe>
|
||||
|
||||
<form>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -8,6 +8,8 @@ support-files =
|
||||
file_webNavigation_clientRedirect.html
|
||||
file_webNavigation_clientRedirect_httpHeaders.html
|
||||
file_webNavigation_clientRedirect_httpHeaders.html^headers^
|
||||
file_webNavigation_frameClientRedirect.html
|
||||
file_webNavigation_frameRedirect.html
|
||||
file_WebNavigation_page1.html
|
||||
file_WebNavigation_page2.html
|
||||
file_WebNavigation_page3.html
|
||||
|
@ -74,6 +74,8 @@ const REDIRECT = BASE + "/redirection.sjs";
|
||||
const REDIRECTED = BASE + "/dummy_page.html";
|
||||
const CLIENT_REDIRECT = BASE + "/file_webNavigation_clientRedirect.html";
|
||||
const CLIENT_REDIRECT_HTTPHEADER = BASE + "/file_webNavigation_clientRedirect_httpHeaders.html";
|
||||
const FRAME_CLIENT_REDIRECT = BASE + "/file_webNavigation_frameClientRedirect.html";
|
||||
const FRAME_REDIRECT = BASE + "/file_webNavigation_frameRedirect.html";
|
||||
|
||||
const REQUIRED = [
|
||||
"onBeforeNavigate",
|
||||
@ -103,7 +105,7 @@ add_task(function* webnav_transitions_props() {
|
||||
];
|
||||
|
||||
function gotEvent(event, details) {
|
||||
browser.test.log(`Got ${event} ${details.url} ${details.transitionType}`);
|
||||
browser.test.log(`Got ${event} ${details.url} ${details.transitionType} ${details.transitionQualifiers && JSON.stringify(details.transitionQualifiers)}`);
|
||||
|
||||
browser.test.sendMessage("received", {url: details.url, details, event});
|
||||
}
|
||||
@ -239,7 +241,7 @@ add_task(function* webnav_transitions_props() {
|
||||
}
|
||||
|
||||
// transitionQualifier: client_redirect
|
||||
// (from meta http-equiv tag)
|
||||
// (from http headers)
|
||||
received = [];
|
||||
yield loadAndWait(win, "onCompleted", REDIRECTED, () => {
|
||||
win.location = CLIENT_REDIRECT_HTTPHEADER;
|
||||
@ -258,6 +260,44 @@ add_task(function* webnav_transitions_props() {
|
||||
"Got the expected 'client_redirect' transitionQualifiers in the OnCommitted events");
|
||||
}
|
||||
|
||||
// transitionQualifier: client_redirect (sub-frame)
|
||||
// (from meta http-equiv tag)
|
||||
received = [];
|
||||
yield loadAndWait(win, "onCompleted", REDIRECTED, () => {
|
||||
win.location = FRAME_CLIENT_REDIRECT;
|
||||
});
|
||||
|
||||
found = received.find((data) => (data.event == "onCommitted" && data.url == REDIRECTED));
|
||||
|
||||
ok(found, "Got the onCommitted event");
|
||||
|
||||
if (found) {
|
||||
is(found.details.transitionType, "auto_subframe",
|
||||
"Got the expected 'auto_subframe' transitionType in the OnCommitted event");
|
||||
ok(Array.isArray(found.details.transitionQualifiers) &&
|
||||
found.details.transitionQualifiers.find((q) => q == "client_redirect"),
|
||||
"Got the expected 'client_redirect' transitionQualifiers in the OnCommitted events");
|
||||
}
|
||||
|
||||
// transitionQualifier: server_redirect (sub-frame)
|
||||
received = [];
|
||||
yield loadAndWait(win, "onCompleted", REDIRECTED, () => { win.location = FRAME_REDIRECT; });
|
||||
|
||||
found = received.find((data) => (data.event == "onCommitted" && data.url == REDIRECT));
|
||||
|
||||
ok(found, "Got the onCommitted event");
|
||||
|
||||
if (found) {
|
||||
is(found.details.transitionType, "auto_subframe",
|
||||
"Got the expected 'auto_subframe' transitionType in the OnCommitted event");
|
||||
// BUG 1264936: currently the server_redirect is not detected in sub-frames
|
||||
// once we fix it we can test it here:
|
||||
//
|
||||
// ok(Array.isArray(found.details.transitionQualifiers) &&
|
||||
// found.details.transitionQualifiers.find((q) => q == "server_redirect"),
|
||||
// "Got the expected 'server_redirect' transitionQualifiers in the OnCommitted events");
|
||||
}
|
||||
|
||||
// cleanup phase
|
||||
win.close();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user