Bug 1496844 - treatment of https view-source URIs is inconsistent. r=johannh
☠☠ backed out by 3245e485822f ☠ ☠
authorjawad <ijawadak@gmail.com>
Tue, 07 May 2019 23:34:31 +0000
changeset 534869 791dcf072a98c3524c79d9b765c812b82920869d
parent 534864 0e9e744accd3ed7b7b0ff2436904ed78a92bf9e2
child 534870 e06739cc67cd05d41d37d9f20ea66fe3e4351cb2
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1496844
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1496844 - treatment of https view-source URIs is inconsistent. r=johannh *** Differential Revision: https://phabricator.services.mozilla.com/D23214
browser/base/content/browser-siteIdentity.js
browser/base/content/test/siteIdentity/browser_check_identity_state.js
--- a/browser/base/content/browser-siteIdentity.js
+++ b/browser/base/content/browser-siteIdentity.js
@@ -790,16 +790,19 @@ var gIdentityHandler = {
 
     // Update per-site permissions section.
     this.updateSitePermissions();
 
     ContentBlocking.toggleReportBreakageButton();
   },
 
   setURI(uri) {
+    if (uri.schemeIs("view-source")) {
+      uri = Services.io.newURI(uri.spec.replace(/^view-source:/i, ""));
+    }
     this._uri = uri;
 
     try {
       // Account for file: urls and catch when "" is the value
       this._uriHasHost = !!this._uri.host;
     } catch (ex) {
       this._uriHasHost = false;
     }
--- a/browser/base/content/test/siteIdentity/browser_check_identity_state.js
+++ b/browser/base/content/test/siteIdentity/browser_check_identity_state.js
@@ -167,16 +167,29 @@ async function secureTest(secureCheck) {
   await SpecialPowers.popPrefEnv();
 }
 
 add_task(async function test_secure_enabled() {
   await secureTest(true);
   await secureTest(false);
 });
 
+async function viewSourceTest() {
+  let sourceTab = await loadNewTab("view-source:https://example.com/" + DUMMY);
+
+  gBrowser.selectedTab = sourceTab;
+  is(getIdentityMode(), "verifiedDomain", "Identity should be verified while viewing source");
+
+  gBrowser.removeTab(sourceTab);
+}
+
+add_task(async function test_viewSource() {
+  await viewSourceTest();
+});
+
 async function insecureTest(secureCheck) {
   let oldTab = gBrowser.selectedTab;
   await SpecialPowers.pushPrefEnv({set: [[INSECURE_ICON_PREF, secureCheck]]});
 
   let newTab = await loadNewTab("http://example.com/" + DUMMY);
   if (secureCheck) {
     is(getIdentityMode(), "notSecure", "Identity should be not secure");
   } else {