From 2a280abe08dbe2dd2a4ec1edbb3ab33bc9ff9e51 Mon Sep 17 00:00:00 2001 From: Brindusan Cristian Date: Tue, 5 Dec 2017 23:50:31 +0200 Subject: [PATCH] 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 --- .../popupNotifications/browser_displayURI.js | 71 ++++--------------- browser/modules/ContentWebRTC.jsm | 1 - browser/modules/webrtcUI.jsm | 8 +-- 3 files changed, 14 insertions(+), 66 deletions(-) diff --git a/browser/base/content/test/popupNotifications/browser_displayURI.js b/browser/base/content/test/popupNotifications/browser_displayURI.js index a029909b7f76..10a8199dab54 100644 --- a/browser/base/content/test/popupNotifications/browser_displayURI.js +++ b/browser/base/content/test/popupNotifications/browser_displayURI.js @@ -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 = ""; - 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 = ""; - let blob = new Blob([text], {type: "text/html"}); - let url = content.URL.createObjectURL(blob); - content.location.href = url; - }); -}); - diff --git a/browser/modules/ContentWebRTC.jsm b/browser/modules/ContentWebRTC.jsm index 1cbe0832cba1..f717f6abbc0a 100644 --- a/browser/modules/ContentWebRTC.jsm +++ b/browser/modules/ContentWebRTC.jsm @@ -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, diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm index 3efdf946352b..6bc97eb7305c 100644 --- a/browser/modules/webrtcUI.jsm +++ b/browser/modules/webrtcUI.jsm @@ -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;