зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
14add183dc
Коммит
2a280abe08
|
@ -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) {
|
add_task(async function test_displayURI() {
|
||||||
await BrowserTestUtils.withNewTab("https://test1.example.com/", async function(browser) {
|
await BrowserTestUtils.withNewTab({
|
||||||
|
gBrowser,
|
||||||
|
url: "https://test1.example.com/",
|
||||||
|
}, async function(browser) {
|
||||||
let popupShownPromise = waitForNotificationPanel();
|
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 panel = await popupShownPromise;
|
||||||
let notification = panel.children[0];
|
let notification = panel.children[0];
|
||||||
let body = document.getAnonymousElementByAttribute(notification,
|
let body = document.getAnonymousElementByAttribute(notification,
|
||||||
|
@ -13,57 +21,4 @@ async function check(contentTask) {
|
||||||
"popup-notification-body");
|
"popup-notification-body");
|
||||||
ok(body.innerHTML.includes("example.com"), "Check that at least the eTLD+1 is present in the markup");
|
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 = {
|
let request = {
|
||||||
callID: aCallID,
|
callID: aCallID,
|
||||||
windowID: aWindowID,
|
windowID: aWindowID,
|
||||||
origin: aContentWindow.origin,
|
|
||||||
documentURI: aContentWindow.document.documentURI,
|
documentURI: aContentWindow.document.documentURI,
|
||||||
secure: aSecure,
|
secure: aSecure,
|
||||||
requestTypes,
|
requestTypes,
|
||||||
|
|
|
@ -368,13 +368,7 @@ function prompt(aBrowser, aRequest) {
|
||||||
aBrowser.dispatchEvent(new aBrowser.ownerGlobal
|
aBrowser.dispatchEvent(new aBrowser.ownerGlobal
|
||||||
.CustomEvent("PermissionStateChange"));
|
.CustomEvent("PermissionStateChange"));
|
||||||
|
|
||||||
let uri;
|
let uri = Services.io.newURI(aRequest.documentURI);
|
||||||
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 host = getHost(uri);
|
let host = getHost(uri);
|
||||||
let chromeDoc = aBrowser.ownerDocument;
|
let chromeDoc = aBrowser.ownerDocument;
|
||||||
let stringBundle = chromeDoc.defaultView.gNavigatorBundle;
|
let stringBundle = chromeDoc.defaultView.gNavigatorBundle;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче