Backed out changeset c6d592ebf8cd (bug 1366357) for browser-chrome failure in browser_displayURI.js on Windows 7 debug non-e10s a=backout r=backout on a CLOSED TREE

This commit is contained in:
Brindusan Cristian 2017-12-05 23:50:31 +02:00
Родитель 14add183dc
Коммит 2a280abe08
3 изменённых файлов: 14 добавлений и 66 удалений

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

@ -1,11 +1,19 @@
/*
* Make sure that the correct origin is shown for permission prompts.
*/
* Make sure that the origin is shown for ContentPermissionPrompt
* consumers e.g. geolocation.
*/
async function check(contentTask) {
await BrowserTestUtils.withNewTab("https://test1.example.com/", async function(browser) {
add_task(async function test_displayURI() {
await BrowserTestUtils.withNewTab({
gBrowser,
url: "https://test1.example.com/",
}, async function(browser) {
let popupShownPromise = waitForNotificationPanel();
await ContentTask.spawn(browser, null, contentTask);
await ContentTask.spawn(browser, null, async function() {
content.navigator.geolocation.getCurrentPosition(function(pos) {
// Do nothing
});
});
let panel = await popupShownPromise;
let notification = panel.children[0];
let body = document.getAnonymousElementByAttribute(notification,
@ -13,57 +21,4 @@ async function check(contentTask) {
"popup-notification-body");
ok(body.innerHTML.includes("example.com"), "Check that at least the eTLD+1 is present in the markup");
});
return BrowserTestUtils.withNewTab("file:///", async function(browser) {
let popupShownPromise = waitForNotificationPanel();
await ContentTask.spawn(browser, null, contentTask);
let panel = await popupShownPromise;
let notification = panel.children[0];
let body = document.getAnonymousElementByAttribute(notification,
"class",
"popup-notification-body");
if (notification.id == "geolocation-notification") {
ok(body.innerHTML.includes("local file"), `file:// URIs should be displayed as local file.`);
} else {
ok(body.innerHTML.includes("Unknown origin"), "file:// URIs should be displayed as unknown origin.");
}
});
}
add_task(async function setup() {
await SpecialPowers.pushPrefEnv({set: [
["media.navigator.permission.fake", true],
["media.navigator.permission.force", true],
]});
});
add_task(async function test_displayURI_geo() {
await check(async function() {
content.navigator.geolocation.getCurrentPosition(() => {});
});
});
add_task(async function test_displayURI_camera() {
await check(async function() {
content.navigator.mediaDevices.getUserMedia({video: true, fake: true});
});
});
add_task(async function test_displayURI_geo_blob() {
await check(async function() {
let text = "<script>navigator.geolocation.getCurrentPosition(() => {})</script>";
let blob = new Blob([text], {type: "text/html"});
let url = content.URL.createObjectURL(blob);
content.location.href = url;
});
});
add_task(async function test_displayURI_camera_blob() {
await check(async function() {
let text = "<script>navigator.mediaDevices.getUserMedia({video: true, fake: true})</script>";
let blob = new Blob([text], {type: "text/html"});
let url = content.URL.createObjectURL(blob);
content.location.href = url;
});
});

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

@ -216,7 +216,6 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec
let request = {
callID: aCallID,
windowID: aWindowID,
origin: aContentWindow.origin,
documentURI: aContentWindow.document.documentURI,
secure: aSecure,
requestTypes,

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

@ -368,13 +368,7 @@ function prompt(aBrowser, aRequest) {
aBrowser.dispatchEvent(new aBrowser.ownerGlobal
.CustomEvent("PermissionStateChange"));
let uri;
try {
// This fails for principals that serialize to "null", e.g. file URIs.
uri = Services.io.newURI(aRequest.origin);
} catch (e) {
uri = Services.io.newURI(aRequest.documentURI);
}
let uri = Services.io.newURI(aRequest.documentURI);
let host = getHost(uri);
let chromeDoc = aBrowser.ownerDocument;
let stringBundle = chromeDoc.defaultView.gNavigatorBundle;