Commit db2459bd authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by morgan
Browse files

Bug 1923260 - Exempt Android resources from svg.disabled. r=peterv

parent 155722f5
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -351,6 +351,21 @@ static bool IsSystemOrAddonOrAboutPrincipal(nsIPrincipal* aPrincipal) {
         aPrincipal->SchemeIs("about");
}

static bool IsAndroidResource(nsIURI* aURI) {
#ifdef ANDROID
  if (aURI->SchemeIs("resource")) {
    nsAutoCString host, path;
    aURI->GetHost(host);
    aURI->GetFilePath(path);
    if (host.EqualsLiteral("android") &&
        StringBeginsWith(path, "/assets/"_ns)) {
      return true;
    }
  }
#endif
  return false;
}

bool nsNodeInfoManager::InternalSVGEnabled() {
  MOZ_ASSERT(!mSVGEnabled, "Caller should use the cached mSVGEnabled!");

@@ -376,6 +391,7 @@ bool nsNodeInfoManager::InternalSVGEnabled() {
  // of system or add-on UI or about: page)
  bool conclusion =
      (SVGEnabled || IsSystemOrAddonOrAboutPrincipal(mPrincipal) ||
       IsAndroidResource(mDocument->GetDocumentURI()) ||
       (loadInfo &&
        (loadInfo->GetExternalContentPolicyType() ==
             ExtContentPolicy::TYPE_IMAGE ||