Bug 1374463 - Show extension identity when controlling newtab r?mixedpuppy draft
authorMark Striemer <mstriemer@mozilla.com>
Thu, 31 Aug 2017 12:23:48 -0500
changeset 657459 09d6606046b3b888bca068a57bdf3c00145457ad
parent 657116 6e0eb137038981bb7d8781d2842cdf982361c82c
child 729438 08f6e32fbae1c8f69c59f590cdd57b7ae3cf41ce
push id77532
push userbmo:mstriemer@mozilla.com
push dateFri, 01 Sep 2017 15:15:10 +0000
reviewersmixedpuppy
bugs1374463
milestone57.0a1
Bug 1374463 - Show extension identity when controlling newtab r?mixedpuppy MozReview-Commit-ID: 2phlLhlAvGd
browser/base/content/browser.js
browser/components/extensions/test/browser/browser_ext_identity_indication.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2760,17 +2760,17 @@ function URLBarSetURI(aURI) {
       // We should deal with losslessDecodeURI throwing for exotic URIs
       try {
         value = losslessDecodeURI(uri);
       } catch (ex) {
         value = "about:blank";
       }
     }
 
-    valid = !isBlankPageURL(uri.spec);
+    valid = !isBlankPageURL(uri.spec) || uri.schemeIs("moz-extension");
   }
 
   let isDifferentValidValue = valid && value != gURLBar.value;
   gURLBar.value = value;
   gURLBar.valueIsTyped = !valid;
   gURLBar.removeAttribute("usertyping");
   if (isDifferentValidValue) {
     gURLBar.selectionStart = gURLBar.selectionEnd = 0;
--- a/browser/components/extensions/test/browser/browser_ext_identity_indication.js
+++ b/browser/components/extensions/test/browser/browser_ext_identity_indication.js
@@ -54,8 +54,44 @@ add_task(async function testIdentityIndi
   await BrowserTestUtils.withNewTab({gBrowser, url}, async function() {
     confirmExtensionPage();
   });
 
   await extension.unload();
 
   confirmDefaults();
 });
+
+add_task(async function testIdentityIndicationNewTab() {
+  let extension = ExtensionTestUtils.loadExtension({
+    background() {
+      browser.test.sendMessage("url", browser.extension.getURL("newtab.html"));
+    },
+    manifest: {
+      name: "Test Extension",
+      applications: {
+        gecko: {
+          id: "@newtab",
+        },
+      },
+      chrome_url_overrides: {
+        newtab: "newtab.html",
+      },
+    },
+    files: {
+      "newtab.html": "<h1>New tab!</h1>",
+    },
+    useAddonManager: "temporary",
+  });
+
+  await extension.startup();
+
+  confirmDefaults();
+
+  let url = await extension.awaitMessage("url");
+  await BrowserTestUtils.withNewTab({gBrowser, url}, async function() {
+    confirmExtensionPage();
+  });
+
+  await extension.unload();
+
+  confirmDefaults();
+});