зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1629441 - Defer to DocumentChannel in shouldLoadURLInThisProcess r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D71331
This commit is contained in:
Родитель
6fe6b37c32
Коммит
6262bc6b58
|
@ -5,7 +5,7 @@ const TEST_HTTP_POST =
|
||||||
"http://example.org/browser/dom/html/test/form_submit_server.sjs";
|
"http://example.org/browser/dom/html/test/form_submit_server.sjs";
|
||||||
|
|
||||||
// Test for bug 1351358.
|
// Test for bug 1351358.
|
||||||
async function runTest() {
|
async function runTest(doNewTab) {
|
||||||
// Create file URI and test data file paths.
|
// Create file URI and test data file paths.
|
||||||
let testFile = getChromeDir(getResolvedURI(gTestPath));
|
let testFile = getChromeDir(getResolvedURI(gTestPath));
|
||||||
testFile.append("dummy_page.html");
|
testFile.append("dummy_page.html");
|
||||||
|
@ -19,16 +19,28 @@ async function runTest() {
|
||||||
// Open file:// page tab in which to run the test.
|
// Open file:// page tab in which to run the test.
|
||||||
await BrowserTestUtils.withNewTab(fileUriString, async function(fileBrowser) {
|
await BrowserTestUtils.withNewTab(fileUriString, async function(fileBrowser) {
|
||||||
// Create a form to post to server that writes posted data into body as JSON.
|
// Create a form to post to server that writes posted data into body as JSON.
|
||||||
let promiseLoad = BrowserTestUtils.browserLoaded(
|
|
||||||
fileBrowser,
|
var promiseLoad;
|
||||||
false,
|
if (doNewTab) {
|
||||||
TEST_HTTP_POST
|
promiseLoad = BrowserTestUtils.waitForNewTab(
|
||||||
);
|
gBrowser,
|
||||||
|
TEST_HTTP_POST,
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
promiseLoad = BrowserTestUtils.browserLoaded(
|
||||||
|
fileBrowser,
|
||||||
|
false,
|
||||||
|
TEST_HTTP_POST
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/* eslint-disable no-shadow */
|
/* eslint-disable no-shadow */
|
||||||
await SpecialPowers.spawn(
|
await SpecialPowers.spawn(
|
||||||
fileBrowser,
|
fileBrowser,
|
||||||
[[TEST_HTTP_POST, filePaths]],
|
[TEST_HTTP_POST, filePaths, doNewTab],
|
||||||
([actionUri, filePaths]) => {
|
(actionUri, filePaths, doNewTab) => {
|
||||||
Cu.importGlobalProperties(["File"]);
|
Cu.importGlobalProperties(["File"]);
|
||||||
|
|
||||||
let doc = content.document;
|
let doc = content.document;
|
||||||
|
@ -36,6 +48,9 @@ async function runTest() {
|
||||||
form.action = actionUri;
|
form.action = actionUri;
|
||||||
form.method = "POST";
|
form.method = "POST";
|
||||||
form.enctype = "multipart/form-data";
|
form.enctype = "multipart/form-data";
|
||||||
|
if (doNewTab) {
|
||||||
|
form.target = "_blank";
|
||||||
|
}
|
||||||
|
|
||||||
let inputText = form.appendChild(doc.createElement("input"));
|
let inputText = form.appendChild(doc.createElement("input"));
|
||||||
inputText.type = "text";
|
inputText.type = "text";
|
||||||
|
@ -73,7 +88,17 @@ async function runTest() {
|
||||||
);
|
);
|
||||||
/* eslint-enable no-shadow */
|
/* eslint-enable no-shadow */
|
||||||
|
|
||||||
let href = await promiseLoad;
|
var href;
|
||||||
|
var testBrowser;
|
||||||
|
var newTab;
|
||||||
|
if (doNewTab) {
|
||||||
|
newTab = await promiseLoad;
|
||||||
|
testBrowser = newTab.linkedBrowser;
|
||||||
|
href = testBrowser.currentURI.spec;
|
||||||
|
} else {
|
||||||
|
testBrowser = fileBrowser;
|
||||||
|
href = await promiseLoad;
|
||||||
|
}
|
||||||
is(
|
is(
|
||||||
href,
|
href,
|
||||||
TEST_HTTP_POST,
|
TEST_HTTP_POST,
|
||||||
|
@ -86,7 +111,7 @@ async function runTest() {
|
||||||
} else {
|
} else {
|
||||||
binContentType = "application/octet-stream";
|
binContentType = "application/octet-stream";
|
||||||
}
|
}
|
||||||
await SpecialPowers.spawn(fileBrowser, [{ binContentType }], args => {
|
await SpecialPowers.spawn(testBrowser, [binContentType], binContentType => {
|
||||||
let data = JSON.parse(content.document.body.textContent);
|
let data = JSON.parse(content.document.body.textContent);
|
||||||
is(
|
is(
|
||||||
data[0].headers["Content-Disposition"],
|
data[0].headers["Content-Disposition"],
|
||||||
|
@ -123,7 +148,7 @@ async function runTest() {
|
||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
data[3].headers["Content-Type"],
|
data[3].headers["Content-Type"],
|
||||||
args.binContentType,
|
binContentType,
|
||||||
"Check binary file input Content-Type"
|
"Check binary file input Content-Type"
|
||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
|
@ -132,6 +157,10 @@ async function runTest() {
|
||||||
"Check binary file input body"
|
"Check binary file input body"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (newTab) {
|
||||||
|
BrowserTestUtils.removeTab(newTab);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +176,8 @@ if (!SpecialPowers.useRemoteSubframes) {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
await runTest();
|
await runTest(false);
|
||||||
|
await runTest(true);
|
||||||
|
|
||||||
await SpecialPowers.popPrefEnv();
|
await SpecialPowers.popPrefEnv();
|
||||||
});
|
});
|
||||||
|
@ -162,7 +192,8 @@ add_task(async function runWithDocumentChannel() {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
await runTest();
|
await runTest(false);
|
||||||
|
await runTest(true);
|
||||||
|
|
||||||
await SpecialPowers.popPrefEnv();
|
await SpecialPowers.popPrefEnv();
|
||||||
});
|
});
|
||||||
|
|
|
@ -850,6 +850,17 @@ var E10SUtils = {
|
||||||
this.log().info(
|
this.log().info(
|
||||||
`shouldLoadURIInThisProcess: have ${remoteType} want ${wantRemoteType}`
|
`shouldLoadURIInThisProcess: have ${remoteType} want ${wantRemoteType}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
(aRemoteSubframes || documentChannel) &&
|
||||||
|
remoteType != NOT_REMOTE &&
|
||||||
|
wantRemoteType != NOT_REMOTE &&
|
||||||
|
documentChannelPermittedForURI(aURI)
|
||||||
|
) {
|
||||||
|
// We can switch later with documentchannel.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return remoteType == wantRemoteType;
|
return remoteType == wantRemoteType;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче