Commit 11289ce3 authored by Mike Kaply's avatar Mike Kaply
Browse files

Bug 1750221 - Block mixed case about URLs in policy. r=Gijs, a=RyanVM

parent d3ca87da
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2528,9 +2528,10 @@ let ChromeURLBlockPolicy = {
    ) {
      return Ci.nsIContentPolicy.ACCEPT;
    }
    let contentLocationSpec = contentLocation.spec.toLowerCase();
    if (
      gBlockedAboutPages.some(function(aboutPage) {
        return contentLocation.spec.startsWith(aboutPage);
        return contentLocationSpec.startsWith(aboutPage.toLowerCase());
      })
    ) {
      return Ci.nsIContentPolicy.REJECT_POLICY;
+4 −2
Original line number Diff line number Diff line
@@ -108,8 +108,10 @@ let WebsiteFilter = {
    let url = contentLocation.spec;
    if (contentLocation.scheme == "view-source") {
      url = contentLocation.pathQueryRef;
    } else if (url.startsWith("about:reader")) {
      url = decodeURIComponent(url.substr("about:reader?url=".length));
    } else if (url.toLowerCase().startsWith("about:reader")) {
      url = decodeURIComponent(
        url.toLowerCase().substr("about:reader?url=".length)
      );
    }
    if (
      contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT ||
+5 −5
Original line number Diff line number Diff line
@@ -9,25 +9,25 @@ const policiesToTest = [
    policies: {
      BlockAboutAddons: true,
    },
    urls: ["about:addons"],
    urls: ["about:addons", "about:ADDONS"],
  },
  {
    policies: {
      BlockAboutConfig: true,
    },
    urls: ["about:config"],
    urls: ["about:config", "about:Config"],
  },
  {
    policies: {
      BlockAboutProfiles: true,
    },
    urls: ["about:profiles"],
    urls: ["about:profiles", "about:pRofiles"],
  },
  {
    policies: {
      BlockAboutSupport: true,
    },
    urls: ["about:support"],
    urls: ["about:support", "about:suPPort"],
  },
  {
    policies: {
@@ -66,7 +66,7 @@ add_task(async function testAboutTask() {
    policyJSON.policies = policyToTest.policies;
    for (let url of policyToTest.urls) {
      if (url.startsWith("about")) {
        let feature = url.split(":")[1];
        let feature = url.split(":")[1].toLowerCase();
        let aboutModule = Cc[ABOUT_CONTRACT + feature].getService(
          Ci.nsIAboutModule
        );
+4 −0
Original line number Diff line number Diff line
@@ -27,6 +27,10 @@ add_task(async function test_http() {
    "about:reader?url=" + SUPPORT_FILES_PATH + BLOCKED_PAGE,
    true
  );
  await checkBlockedPage(
    "about:READER?url=" + SUPPORT_FILES_PATH + BLOCKED_PAGE,
    true
  );
  await checkBlockedPage(SUPPORT_FILES_PATH + EXCEPTION_PAGE, false);
});