Bug 1456485: Part 2 - Allow extensions with the mozillaAddons permission to match restricted schemes. r=zombie

The schema handling for this is currently a bit ugly, for the sake of
simplifying uplift. In the figure, we should find a way to change the schema
pattern matching based on whether or not the extension is privileged.

MozReview-Commit-ID: CU9WR2Ika6k
This commit is contained in:
Kris Maglione
2018-05-09 18:55:59 -07:00
parent 2239a748b1
commit 93c85d42c4
9 changed files with 127 additions and 34 deletions

View File

@@ -449,6 +449,7 @@ WebExtensionContentScript::WebExtensionContentScript(WebExtensionPolicy& aExtens
ErrorResult& aRv)
: mExtension(&aExtension)
, mHasActiveTabPermission(aInit.mHasActiveTabPermission)
, mRestricted(!aExtension.HasPermission(nsGkAtoms::mozillaAddons))
, mMatches(aInit.mMatches)
, mExcludeMatches(aInit.mExcludeMatches)
, mCssPaths(aInit.mCssPaths)
@@ -493,7 +494,7 @@ WebExtensionContentScript::Matches(const DocInfo& aDoc) const
return true;
}
if (mExtension->IsRestrictedDoc(aDoc)) {
if (mRestricted && mExtension->IsRestrictedDoc(aDoc)) {
return false;
}
@@ -525,7 +526,7 @@ WebExtensionContentScript::MatchesURI(const URLInfo& aURL) const
return false;
}
if (mExtension->IsRestrictedURI(aURL)) {
if (mRestricted && mExtension->IsRestrictedURI(aURL)) {
return false;
}