morgan pushed to branch base-browser-128.7.0esr-14.5-1 at The Tor Project / Applications / Tor Browser

Commits:

1 changed file:

Changes:

  • dom/base/nsNodeInfoManager.cpp
    ... ... @@ -344,16 +344,6 @@ void nsNodeInfoManager::RemoveNodeInfo(NodeInfo* aNodeInfo) {
    344 344
     }
    
    345 345
     
    
    346 346
     static bool IsSystemOrAddonOrAboutPrincipal(nsIPrincipal* aPrincipal) {
    
    347
    -#ifdef ANDROID
    
    348
    -  if (aPrincipal->SchemeIs("resource")) {
    
    349
    -    nsAutoCString spec;
    
    350
    -    aPrincipal->GetAsciiSpec(spec);
    
    351
    -    if (StringBeginsWith(spec, "resource://android/assets/"_ns)) {
    
    352
    -      return true;
    
    353
    -    }
    
    354
    -  }
    
    355
    -#endif
    
    356
    -
    
    357 347
       return aPrincipal->IsSystemPrincipal() ||
    
    358 348
              BasePrincipal::Cast(aPrincipal)->AddonPolicy() ||
    
    359 349
              // NOTE: about:blank and about:srcdoc inherit the principal of their
    
    ... ... @@ -361,6 +351,21 @@ static bool IsSystemOrAddonOrAboutPrincipal(nsIPrincipal* aPrincipal) {
    361 351
              aPrincipal->SchemeIs("about");
    
    362 352
     }
    
    363 353
     
    
    354
    +static bool IsAndroidResource(nsIURI* aURI) {
    
    355
    +#ifdef ANDROID
    
    356
    +  if (aURI->SchemeIs("resource")) {
    
    357
    +    nsAutoCString host, path;
    
    358
    +    aURI->GetHost(host);
    
    359
    +    aURI->GetFilePath(path);
    
    360
    +    if (host.EqualsLiteral("android") &&
    
    361
    +        StringBeginsWith(path, "/assets/"_ns)) {
    
    362
    +      return true;
    
    363
    +    }
    
    364
    +  }
    
    365
    +#endif
    
    366
    +  return false;
    
    367
    +}
    
    368
    +
    
    364 369
     bool nsNodeInfoManager::InternalSVGEnabled() {
    
    365 370
       MOZ_ASSERT(!mSVGEnabled, "Caller should use the cached mSVGEnabled!");
    
    366 371
     
    
    ... ... @@ -386,6 +391,7 @@ bool nsNodeInfoManager::InternalSVGEnabled() {
    386 391
       // of system or add-on UI or about: page)
    
    387 392
       bool conclusion =
    
    388 393
           (SVGEnabled || IsSystemOrAddonOrAboutPrincipal(mPrincipal) ||
    
    394
    +       IsAndroidResource(mDocument->GetDocumentURI()) ||
    
    389 395
            (loadInfo &&
    
    390 396
             (loadInfo->GetExternalContentPolicyType() ==
    
    391 397
                  ExtContentPolicy::TYPE_IMAGE ||