Bug 1199805 - Fix displayURI typo on site permission prompts. r=bgrins, a=sylvestre
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Thu, 10 Sep 2015 16:36:23 -0700
changeset 289283 38ce3185609d4344607793379e20cbbe0cd979e2
parent 289282 1eba35bfff209358a74bdf5f459de8df2e317054
child 289284 2764f9334f34cf90b44aab78d51bd7880ed07188
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins, sylvestre
bugs1199805
milestone42.0a2
Bug 1199805 - Fix displayURI typo on site permission prompts. r=bgrins, a=sylvestre One instance of displayOrigin wasn't renamed to displayURI.
browser/base/content/test/popupNotifications/browser.ini
browser/base/content/test/popupNotifications/browser_displayURI.js
browser/components/nsBrowserGlue.js
--- a/browser/base/content/test/popupNotifications/browser.ini
+++ b/browser/base/content/test/popupNotifications/browser.ini
@@ -1,12 +1,14 @@
 [DEFAULT]
 support-files =
   head.js
 
+[browser_displayURI.js]
+skip-if = (os == "linux" && (debug || asan))
 [browser_popupNotification.js]
 skip-if = (os == "linux" && (debug || asan)) || e10s # e10s - Bug ?????? - popup notification test probably confused re content process notifications etc
 [browser_popupNotification_2.js]
 skip-if = (os == "linux" && (debug || asan)) || e10s # e10s - Bug ?????? - popup notification test probably confused re content process notifications etc
 [browser_popupNotification_3.js]
 skip-if = (os == "linux" && (debug || asan)) || e10s # e10s - Bug ?????? - popup notification test probably confused re content process notifications etc
 [browser_popupNotification_4.js]
 skip-if = (os == "linux" && (debug || asan)) || e10s # e10s - Bug ?????? - popup notification test probably confused re content process notifications etc
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/popupNotifications/browser_displayURI.js
@@ -0,0 +1,28 @@
+/*
+ * Make sure that the origin is shown for ContentPermissionPrompt
+ * consumers e.g. geolocation.
+*/
+
+add_task(function* test_displayURI() {
+  yield BrowserTestUtils.withNewTab({
+    gBrowser,
+    url: "https://test1.example.com/",
+  }, function*(browser) {
+    let popupShownPromise = new Promise((resolve, reject) => {
+      onPopupEvent("popupshown", function() {
+        resolve(this);
+      });
+    });
+    yield ContentTask.spawn(browser, null, function*() {
+      content.navigator.geolocation.getCurrentPosition(function (pos) {
+        // Do nothing
+      });
+    });
+    let panel = yield popupShownPromise;
+    let notification = panel.children[0];
+    let body = document.getAnonymousElementByAttribute(notification,
+                                                       "class",
+                                                       "popup-notification-body");
+    ok(body.innerHTML.includes("example.com"), "Check that at least the eTLD+1 is present in the markup");
+  });
+});
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -2497,17 +2497,17 @@ ContentPermissionPrompt.prototype = {
     let types = aRequest.types.QueryInterface(Ci.nsIArray);
     if (types.length != 1) {
       aRequest.cancel();
       return;
     }
 
     if (!aOptions)
       aOptions = {};
-    aOptions.displayOrigin = requestPrincipal.URI;
+    aOptions.displayURI = requestPrincipal.URI;
 
     return chromeWin.PopupNotifications.show(browser, aNotificationId, aMessage, aAnchorId,
                                              mainAction, secondaryActions, aOptions);
   },
 
   _promptPush : function(aRequest) {
     var message = gBrowserBundle.GetStringFromName("push.enablePush2");