Bug 1466349 part 3 - Ignore ignorePath for privileged about: MatchPatterns r=aswan
authorTomislav Jovanovic <tomica@gmail.com>
Sun, 03 Jun 2018 19:38:29 +0200
changeset 421375 0bb149ce1d1a4167e7135bb8a093ebdcf1ac0595
parent 421374 e04c7ccfd50e5877126c28aad60336b267189dc5
child 421460 da28b92efe6f6acaf79545697415b82038143338
child 421463 29081ef4774ce911f1ef8a51715cc6f463fdfeab
push id34092
push useraiakab@mozilla.com
push dateTue, 05 Jun 2018 21:57:17 +0000
treeherdermozilla-central@0bb149ce1d1a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1466349
milestone62.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 1466349 part 3 - Ignore ignorePath for privileged about: MatchPatterns r=aswan Paths are all about: URIs have, so ignoring them doesn't make sense. MozReview-Commit-ID: ATwAeI7m61z
toolkit/components/extensions/MatchPattern.cpp
toolkit/components/extensions/test/xpcshell/test_MatchPattern.js
--- a/toolkit/components/extensions/MatchPattern.cpp
+++ b/toolkit/components/extensions/MatchPattern.cpp
@@ -326,16 +326,18 @@ MatchPattern::Init(JSContext* aCx, const
    ***************************************************************************/
   offset = index + 1;
   tail.Rebind(aPattern, offset);
 
   if (scheme == nsGkAtoms::about) {
     // about: URIs don't have hosts, so just treat the host as a wildcard and
     // match on the path.
     mMatchSubdomain = true;
+    // And so, ignorePath doesn't make sense for about: matchers.
+    aIgnorePath = false;
   } else {
     if (!StringHead(tail, 2).EqualsLiteral("//")) {
       aRv.Throw(NS_ERROR_INVALID_ARG);
       return;
     }
 
     offset += 2;
     tail.Rebind(aPattern, offset);
--- a/toolkit/components/extensions/test/xpcshell/test_MatchPattern.js
+++ b/toolkit/components/extensions/test/xpcshell/test_MatchPattern.js
@@ -114,19 +114,23 @@ add_task(async function test_MatchPatter
 
   // Privileged matchers:
   invalid({pattern: "about:foo"});
   invalid({pattern: "resource://foo/*"});
 
   pass({url: "about:foo", pattern: ["about:foo", "about:foo*"], options: {restrictSchemes: false}});
   pass({url: "about:foo", pattern: ["about:foo*"], options: {restrictSchemes: false}});
   pass({url: "about:foobar", pattern: ["about:foo*"], options: {restrictSchemes: false}});
+
   pass({url: "resource://foo/bar", pattern: ["resource://foo/bar"], options: {restrictSchemes: false}});
   fail({url: "resource://fog/bar", pattern: ["resource://foo/bar"], options: {restrictSchemes: false}});
   fail({url: "about:foo", pattern: ["about:meh"], options: {restrictSchemes: false}});
+
+  // about: matchers should ignore ignorePath.
+  pass({url: "about:reader?http://e.com/", pattern: ["about:reader*"], options: {ignorePath: true, restrictSchemes: false}});
 });
 
 add_task(async function test_MatchPattern_overlaps() {
   function test(filter, hosts, optional) {
     filter = Array.concat(filter);
     hosts = Array.concat(hosts);
     optional = Array.concat(optional);