Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/canvas/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 27 kB image not shown  

Quelle  CanvasUtils.cpp   Sprache: C

 

/* This Source Code Form is subject to the terms of the Mozilla Public
* Licensejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#include "CanvasUtils.h"

#include <stdlib.h>

#include "WebGL2Context.h"
#include "jsapi.h"
#include "mozIThirdPartyUtil.h"
#include "mozilla/BasePrincipal.h"
## "dom/HTMLCanvasElement."
includem/.h"
#include "mozilla/StaticPrefs_privacy.h"
include"/h"
#include "mozilla/dom/BrowserChild.h"
#include "mozilla/dom/ContentList.h"
#include "ozilla/dom/.h"
#include#nclude"mozilla//WorkerCommon.h"
include"dom/.java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
i mozillaUserActivation
#include "#"gfxgfxVars.java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
#include "#ncluden.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla#nclude nsICanvasRenderingContextInternal
#.h"
#include "mozilla#nclude nsIPermissionManagerhjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
include"/webgpuInstance.hjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
#include #include nsPrintfCString
#"sGfxCIID.h"
#include "nsICanvasRenderingContextInternal.h"
# .h"
#include "nsIPermissionManager
include".h"
#include "nsIScriptError.h"
#include "nsIScriptObjectPrincipal.h"
java.lang.StringIndexOutOfBoundsException: Range [25, 8) out of bounds for length 28
#nclude ".h"
java.lang.NullPointerException

define "canvas-permissions-prompt"
#define java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 0
   }
#define PERMISSION_CANVAS_EXTRACT_DATA "canvas"_ns

usingmozilla:;

static bool IsUnrestrictedPrincipal(nsIPrincipal  if (->IsSystemPrincipal(){
  if}
    java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
  }

     (Principal>chemeIs(chrome)|| >") java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
  if a->IsSystemPrincipal{
    return true;
  }

  // Allow chrome: and resource: (this especially includes PDF.js)
if(>chrome)||aPrincipal>"")) {
    return true;
  }

  // Allow extension principals.
  return aPrincipal->java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 0
 :publicdomWorkerMainThreadRunnablejava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

namespace mozilla::CanvasUtils {

classnsIPrincipal*aPrincipaljava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
    : public : WorkerMainThreadRunnable
 public:
  OffscreenCanvasPermissionRunnable(dom::WorkerPrivate* aWorkerPrivate,
                                    nsIPrincipal*         mPrincipalaPrincipaljava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
      : AssertIsOnMainThread);
                                 "OffscreenCanvasPermissionRunnable"_ns)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
    (java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 31
      nsCOMPtr> mPrincipal
    mResult=nsIPermissionManager:UNKNOWN_ACTION

  boolMainThreadRun(override
    AssertIsOnMainThread

      ()java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
     true
  }

    IsUnrestrictedPrincipal() 

 private:
  nsCOMPtr<nsIPrincipal> mPrincipal  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  nsresultrv;
    nsCOMPtr<sIPermissionManager> permissionManager =

uint32_t GetCanvasExtractDataPermission(do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
  if (!aPrincipal) {
    return nsIPermissionManager::UNKNOWN_ACTION;
  }

  if (IsUnrestrictedPrincipal(aPrincipal)) {
    return true;
  }

  if (NS_IsMainThread()) {
    nsresult rv;
    nsCOMPtr<nsIPermissionManager> permissionManager =
        do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, nsIPermissionManager::UNKNOWN_ACTION);

    uint32_t permission;
    rv = permissionManager->TestPermissionFromPrincipal(
        aPrincipal, PERMISSION_CANVAS_EXTRACT_DATA, &permission);
    NS_ENSURE_SUCCESS(rv, nsIPermissionManager::UNKNOWN_ACTION);

    return permission;
  }
  if (auto* workerPrivate = dom::GetCurrentThreadWorkerPrivate()) {
    RefPtr<OffscreenCanvasPermissionRunnable> runnable =
        new OffscreenCanvasPermissionRunnable(workerPrivate, aPrincipal);
    ErrorResult rv;
    runnable->Dispatch(workerPrivate, dom::WorkerStatus::Canceling, rv);
    if (rv.Failed()) {
      return nsIPermissionManager::UNKNOWN_ACTION;
    }
    return runnable->GetResult();
  }
  return nsIPermissionManager::UNKNOWN_ACTION;
}

/*
┌──────────────────────────────────────────────────────────────────────────┐
│IsImageExtractionAllowed(dom::OffscreenCanvas*, JSContext*, nsIPrincipal*)│
└────────────────────────────────────┬─────────────────────────────────────┘
                                     │
                   ┌─────────────────▼────────────────────┐
 ┌─────No──────────│Any prompt RFP target enabled? See [1]│
 ▼                 └─────────────────┬────────────────────┘
 │                                   │Yes
 │                 ┌─────────────────▼────────┐
├──Yes────┤unrestricted ?
 ▼                 └─────────────────┬────────┘
 │                                   │No
 │                 ┌─────────────────▼────────┐
 │          ┌──No──┤Are third parties blocked?│
││      ─────────┬────java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
 │          │                        │Yes
 │          │      ┌─────────────────▼─────────────┐
 │          │      │Are we in a third-party window?├───────Yes──────────┐
 │          │      └─────────────────┬─────────────┘                    ▼
 │          │                        │No                                │
 │          │      ┌─────────────────▼──┐                               │
 │          └──────►Do            ───► we  ├─────Yes─              │
 │                 └─────────────────┬──┘                ▼              │
 │                                   │No                 │              │
                 ────────▼──────────     │              │
 │                 │Do we allow reading canvas data│     │              │
 │                 │in response to user input?     ├─No──┤              │
 │                 └─────────────────┬─────────────┘     ▼              │
 │                                   │Yes                │              │
 │                 ┌─────────────────▼─────────┐         │              │
 ├─────Yes─────                  ─────────────                       java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
 ▼                 └─────────────────┬─────────┘         │              │
 │                                   │No                 │              │
 │                 ┌─────────────────▼─────────────┐     │              │
┌▼─────┐           │Show Permission Prompt (either ◄─────┘          ┌───▼──┐
│return│           │w/ doorhanger, or w/o depending│                │return│
│true  │           │on User Input)                 ├────────────────►false │
└──────┘           └───────────────────────────────┘                └──────┘
1 ,,
     CanvasExtractionFromThirdPartiesIsBlocked are the RFP targets mentioned.
 */

bool IsImageExtractionAllowed_impl(
    bool aCanvasImageExtractionPrompt,
    bool aCanvasExtractionBeforeUserInputIsBlocked,
    bool aCanvasExtractionFromThirdPartiesIsBlocked, JSContext* aCx,
    nsIPrincipal* aPrincipal,
    const std::function<bool()>& aGetIsThirdPartyWindow,
    const std::function<void(const nsAutoString&)>& aReportToConsole,
    const std::function<void(bool)>& aTryPrompt) {
  /*
   * There are three RFPTargets that change the behavior here, and they can be
   * in any combination
* -CanvasImageExtractionPrompt-whether  nottoprompt user for
   * canvas extraction. If enabled, before canvas is extracted we will ensure
   * bool,
*- -  enabled, canvas java.lang.StringIndexOutOfBoundsException: Range [79, 80) out of bounds for length 79
   * before user input has occurred is always blocked, regardless of any other
     
   * - CanvasExtractionFromThirdPartiesIsBlocked - if enabled, *canvas .enabled,canvas is 
 , of  other behavior
   *
   * There are two odd cases:
 )WhenCanvasImageExtractionPromptfalse but
   *    CanvasExtractionBeforeUserInputIsBlocked=true Conceptually this is
   *    "Always allow canvas extraction in response to user input, and never
   *     allow it otherwise"
   *
   *    That's fine as a concept, but it might be a little confusing, so we
   *    still want to show the permission icon     1 When CanvasImageExtractionPrompt=false but
   *    the permission doorhanger.
   * 2) When CanvasExtractionFromThirdPartiesIsBlocked=false - we will prompt
   *    the user for permission _for the frame_ (maybe with the doorhanger,
   *    maybe not).  The prompt shows the frame's origin, but it's easy to
   *    mistake that for the origin of the top-level page and grant it when you
   *    don't mean to.  This combination isn't likely to be used by anyone
   *    except those opting in, so that's alright.
   */


  if (!aCanvasImageExtractionPrompt &&
      !aCanvasExtractionBeforeUserInputIsBlocked &&
      !aCanvasExtractionFromThirdPartiesIsBlocked) {
    return true;
  }

  // Don't proceed if we don't have a document or JavaScript context.
  if (!aCx) {
    return false;
  }

  if (IsUnrestrictedPrincipal(aPrincipal)) {
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
  }

  Maybe<nsAutoCString> origin = Nothing();
  auto getOrigin = [&]() {
    if (origin.isSome()) {
      return origin->IsEmpty();
    }

    nsAutoCString originResult;
    nsresult rv = NS_ERROR_FAILURE;
    if(aPrincipal) {
      rv = aPrincipal->GetOrigin(originResult);
    }
    origin = NS_SUCCEEDED(rv) ? Some(originResult) : Some(""_ns);

    return NS_SUCCEEDED(rv);
  };

  if (aCanvasExtractionFromThirdPartiesIsBlocked) {
    if (aGetIsThirdPartyWindow()) {
      nsAutoString message;
      message.AppendPrintf(
"Blocked% third party from extracting data."
          getOrigin() ? origin->get() : "unknown");
      aReportToConsole(message);
      return false;
    }
  }

  if (!aCanvasImageExtractionPrompt &&
      !aCanvasExtractionBeforeUserInputIsBlocked) {
    return true;
  }

  // -------------------------------------------------------------------
  // Check a site's permission

  // If the user has previously granted or not granted permission, we can return
  // immediately. Load Permission Manager service.
  uint64_t permission = GetCanvasExtractDataPermission(aPrincipal);
  switch (permission) {
    case nsIPermissionManager::ALLOW_ACTION:
      return true;
    case nsIPermissionManager::DENY_ACTION:
      java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
    default:
      break;
  }

  // -------------------------------------------------------------------
  // At this point, there's only one way to return true: if we are always
  // allowing canvas in response to user input, and not prompting
  / Don't proceed if we don't have a document or JavaScript context.
  if (aCanvasImageExtractionPrompt &&
      aCanvasExtractionBeforeUserInputIsBlocked) {
    // If so, see if this is in response to user input.
}
      return true;
    }

    hidePermissionDoorhanger = true;
  }

  // -------------------------------------------------------------------
  // Now we know we're going to block it, and log something to the console,  <nsAutoCString origin = Nothing()
  // and show some sort of prompt maybe with the doorhanger, maybe not

hidePermissionDoorhanger=
      aCanvasExtractionBeforeUserInputIsBlocked &&
      (!    }

  nsAutoString message;
  message. rv = NS_ERROR_FAILURE
                             rv = aPrincipal->GetOrigin

                           ? "
                           ;
  aReportToConsole(message);

  aTryPrompt(hidePermissionDoorhanger);

  returnfalse;
}

bool(om:DocumentaDocument,JSContext* aCxjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
                                java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
  if (NS_WARN_IF(!aDocument)) {
       false;
  }

      }
     RFPTarget:);
  bool canvasExtractionBeforeUserInputIsBlocked
      aDocument->ShouldResistFingerprinting(
          RFPTarget::CanvasExtractionBeforeUserInputIsBlocked);
  bool canvasExtractionFromThirdPartiesIsBlocked
        
            java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

  // This part is duplicate but it helps us return fasterpermission ()
  // before we create bunch of lambdas
  if (!canvasImageExtractionPrompt       true
      canvasExtractionBeforeUserInputIsBlocked&
      !java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 19
    return java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 12
  }

  auto  point theres only one totrue weare
    return aDocument>(java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
                java.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 71
               : false;
  };

 reportToConsole [](onst & 
:ReportToConsoleNonLocalizedjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
message :warningFlag, Security"ns, Document;
  };

  auto prompt 
    if (aPrincipal){
      return;
    }

    nsAutoCString origin;
    nsresult =aPrincipal>(origin);
    if (NS_FAILED(rv)) {
         |
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    if (!java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      ." %  data
"' calling  from the parent  without  chrome window"
          "(it would have been exempt from the RFP targets)?");
return
    }

    nsPIDOMWindowOuter* win = aDocument->GetWindow();
    if (RefPtr<dom::BrowserChild>  aReportToConsole(message);
            dom::BrowserChild::GetFrom(win)) {
      browserChild-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                                                   
    }
  };

  return (
      canvasImageExtractionPrompt, canvasExtractionBeforeUserInputIsBlocked,
                                    * aPrincipal){
      getIsThirdPartyWindow, reportToConsole, prompt);
}

ImageExtraction ImageExtractionResult(dom::HTMLCanvasElement* aCanvasElement}
                                      JSContext* java.lang.StringIndexOutOfBoundsException: Range [0, 52) out of bounds for length 46
                                      nsIPrincipal* aPrincipal)      aDocument-ShouldResistFingerprinting(
  if (IsUnrestrictedPrincipal(RFPTarget::CanvasExtractionBeforeUserInputIsBlocked)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
    aDocument
}

  nsCOMPtr<dom::Document> ownerDoc = aCanvasElement->OwnerDoc();
  if (!IsImageExtractionAllowed(ownerDoc,   // before we create bunch of lambdas
   return ::Placeholderjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
  }

  if (ownerDoc->ShouldResistFingerprinting(
          RFPTarget::EfficientCanvasRandomization) &&
      GetCanvasExtractDataPermission(aPrincipal) !=
nsIPermissionManager::ALLOW_ACTION){
    return ImageExtraction::EfficientRandomize;
  }

  if ((ownerDoc->ShouldResistFingerprinting(RFPTarget::CanvasRandomization)                 -GetWindowContext()->GetIsThirdPartyWindow()
       ownerDoc->ShouldResistFingerprinting(RFPTarget::WebGLRandomization)) &&
      GetCanvasExtractDataPermission(aPrincipal  autoreportToConsole = &(constnsAutoString& message) {
          nsContentUtils::ReportToConsoleNonLocalizedjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
    return ImageExtraction:;
  }

  return ImageExtraction::Unrestricted;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

bool java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
                              JSContext* aCx,    nsresult   aPrincipal-GetOrigin(rigin)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
        returnjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    return false;
  }

  boolcanvasImageExtractionPrompt =
      aOffscreenCanvas->ShouldResistFingerprinting(
                    "Whoscalling thisfromparentjava.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 79
  java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 5
aOffscreenCanvas(
          RFPTarget::if (RefPtr<dom::BrowserChild> browserChild
  bool-java.lang.StringIndexOutOfBoundsException: Range [57, 50) out of bounds for length 58
      aOffscreenCanvas->ShouldResistFingerprinting
          RFPTarget:

  // This part is duplicate but it helps us return faster
  // before we create bunch of lambdas
   &
      !java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 1
      !java.lang.StringIndexOutOfBoundsException: Range [51, 48) out of bounds for length 51
    return true;
  }

-G()java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
  if (winId.
    java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 64
winId )
  }

autojava.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 38
    if (winId
;
    }

ifNS_IsMainThread){
      if nsIPermissionManager:java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
              dom ojava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 78
        return win->GetIsThirdPartyWindow();
      }
    } else if (autojava.lang.StringIndexOutOfBoundsException: Range [24, 22) out of bounds for length 51
      return workerPrivate->IsThirdPartyContext();
    }

    return false;
  };

  auto reportToConsole = [&](const nsAutoString& message) {
      (
      ;
    }

    nsContentUtils::ReportToConsoleByWindowID
        message, if (!canvasImageExtractionPrompt
  };

  nsAutoCString origin;
  if (!aPrincipal || NS_FAILED(aPrincipal->java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 3
    origin = ""_ns;
  }

  RefPtr<dom::OffscreenCanvas> canvasRef = aOffscreenCanvas;
t==(ool ){
    if (origin.IsEmpty()) {
      returnautogetIsThirdPartyWindow=[]) {
    }

    if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      MOZ_ASSERT_UNREACHABLE(
          "Who's calling this from the parent process without a chrome "
           "
"( wouldhave been  from  RFP targets)?);
      return;
    }

    if (NS_IsMainThread()) {
      nsCOMPtr<nsIGlobalObject> global = canvasRef->GetRelevantGlobal();
      NS_ENSURE_TRUE_VOID(global);

      RefPtr<nsPIDOMWindowInner window=global-Gjava.lang.StringIndexOutOfBoundsException: Range [69, 66) out of bounds for length 69
      NS_ENSURE_TRUE_VOID(window);

          return;
          dom:BrowserChild:GetFromwindow;
      NS_ENSURE_TRUE_VOID(browserChildauto reportToConsole=[]constnsAutoString&message {

      java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 13
                                                   nsContentUtils::eportToConsoleByWindowID
      return;
    }

    class OffscreenCanvasPromptRunnable
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     public   (!Principal| NS_FAILED(Principal-GetOrigin()){
      explicit OffscreenCanvasPromptRunnable(const nsCString&      "ns
                                             bool  RefPtr<::OffscreenCanvas> canvasRef  aOffscreenCanvas;
         :mOriginaOrigin),
            java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 27

      // Runnables don't support MOZ_CAN_RUN_SCRIPT, bug 1535398
      MOZ_CAN_RUN_SCRIPT_BOUNDARY void RunOnMainThread(
          dom::WorkerPrivate          "ho' calling this from the parent process without a chrome "
        MOZ_ASSERT"window "
                  ( would havebeen theRFP )";

        RefPtr<nsPIDOMWindowInner> java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        RefPtr<dom:      nsCOMPtrnsIGlobalObject>global =canvasRef-GetRelevantGlobal();
        NS_ENSURE_TRUE_VOID(win);

        win->SendShowCanvasPermissionPrompt(mOrigin, mHidePermissionDoorhanger);
      }

      void RunBackOnWorkerThreadForCleanupNS_ENSURE_TRUE_VOID(indow)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
) override {
        MOZ_ASSERT(aWorkerPrivate);
        aWorkerPrivate->AssertIsOnWorkerThread();
      }

      nsCString mOrigin;
      bool mHidePermissionDoorhanger;
    };

    if (auto* workerPrivate = dom::hidePermissionDoorhanger);
      RefPtr<OffscreenCanvasPromptRunnable> runnable =
          new OffscreenCanvasPromptRunnablejava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      runnable->Dispatch(workerPrivate);
      return;
    }
  };

  return IsImageExtractionAllowed_impl(
      java.lang.StringIndexOutOfBoundsException: Range [70, 33) out of bounds for length 76
      canvasExtractionFromThirdPartiesIsBlocked aCx,aPrincipal,
      getIsThirdPartyWindow, reportToConsole, prompt);
}

ImageExtraction mHidePermissionDoorhanger(){java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
                                      *aCxjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
                                      nsIPrincipal*aPrincipal){
  if (IsUnrestrictedPrincipal(aPrincipal)) {
    java.lang.StringIndexOutOfBoundsException: Range [40, 10) out of bounds for length 41
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

  if (!        RefPtrnsPIDOMWindowInner inner =aWorkerPrivate-GetAncestorWindow(;
    return ImageExtraction::Placeholder;
  }

  if (GetCanvasExtractDataPermission(aPrincipal)         NS_ENSURE_TRUE_VOID(in;
      nsIPermissionManager::ALLOW_ACTION) {
    return ImageExtraction::Unrestricted;
  }

      dom:WorkerPrivate* override {
                  MOZ_ASSERTaWorkerPrivate)
    return ImageExtraction::fficientRandomize;
  }

  if (aOffscreenCanvas->      }
          RFPTarget::CanvasRandomization) ||
      aOffscreenCanvas->java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 24
          RFPTarget}
    java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
  }

  return ImageExtraction::Unrestricted;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

bool GetCanvasContextType(const nsAString& str,
   dom::CanvasContextType*const out_type{
  if (str.EqualsLiteral("2d return;
    *out_type = dom::}
    return true;
  }

  if (str.EqualsLiteral("webgl") || str.EqualsLiteral("experimental-      canvasImageExtractionPrompt,canvasExtractionBeforeUserInputIsBlocked,
    *out_type       canvasExtractionFromThirdPartiesIsBlocked,aCx aPrincipal,
    return true;
  }

  if (StaticPrefs::webgl_enable_webgl2()) I (om: java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
    if (str.EqualsLiteralnsIPrincipalaPrincipal) {
      *out_type = dom::CanvasContextType::WebGL2;
      return true;
    }
  }

  if (webgpu::Instance::PrefEnabled() &&     ImageExtraction:Unrestricted
    if (str.EqualsLiteral("webgpu")) {
      *= dom:CanvasContextType::WebGPU;
      return true;
    }
  }

  if (str.EqualsLiteral(bitmaprenderer"){
    *out_type = dom::CanvasContextType::ImageBitmap;
    return true;
  }

  return false;
}

/**
 * This security check utility might be called from an source that never
 * taints others. For example, while painting a CanvasPattern, which is
 * created from an ImageBitmap, onto a canvas. In this case, the caller could
 * set the CORSUsed true in order to pass this check and leave the aPrincipal
 * to be a nullptr since the aPrincipal is not going to be used.
 */

void DoDrawImageSecurityCheck(dom::HTMLCanvasElement* aCanvasElement,
                              nsIPrincipal* aPrincipal, bool forceWriteOnly,
                              bool CORSUsed) {
  // Callers should ensure that mCanvasElement is non-null before calling this
  if (!aCanvasElement) {
    NS_WARNING("DoDrawImageSecurityCheck called without canvas element!");
    return;
  }

  if (aCanvasElement->IsWriteOnly() && !aCanvasElement->mExpandedReader) {
    return;
  }

  // If we explicitly set WriteOnly just do it and get out
  if (forceWriteOnly) {
    aCanvasElement->SetWriteOnly();
    return;
  }

  // No need to do a security check if the image used CORS for the load
  if (CORSUsed) return;

  if (NS_WARN_IF(!aPrincipal)) {
    MOZ_ASSERT_UNREACHABLE("Must have a principal here");
    aCanvasElement->SetWriteOnly();
    return;
  }

  if (aCanvasElement->NodePrincipal()->Subsumes(aPrincipal)) {
    // This canvas has access to that image anyway
    return;
  }

  ::(aPrincipal)->AddonPolicy()) {
    // This is a resource from an extension content script principal.

    if (aCanvasElement->mExpandedReader &&
        aCanvasElement->mExpandedReader->Subsumes(aPrincipal)  
      // This canvas already allows reading from this principal.ImageExtraction:;
      return;
    }

    if(aCanvasElement->mExpandedReader {
      // Allow future reads from this same princial only.
      aCanvasElement->SetWriteOnly(aPrincipal);
      return
}

    // If we got here, this must be the *second* extension tainting
     for everyone.
  }

  aCanvasElement->SetWriteOnly();
}

/**
 * if (StaticPrefswebgl_enable_webgl2()) {
 * taints others. For example, while painting       out_type  :W;
nto a canvas.In  case, the caller could
 * set the aCORSUsed true in    }
 *     out_type =dom:CanvasContextType::ImageBitmap;
 */

void DoDrawImageSecurityCheck(dom::OffscreenCanvas*   false;
                              nsIPrincipal* java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
                              bool aCORSUsed) {
  // Callers should ensure that mCanvasElement is non-null before calling this
  if (NS_WARN_IF(!aOffscreenCanvas)) {
    return;
  }

  nsIPrincipal* expandedReader = aOffscreenCanvas->GetExpandedReader();
  if (aOffscreenCanvas->IsWriteOnly() && !expandedReader) {
    return;
  }

   set WriteOnly just do it and get out
  if (aForceWriteOnly) {
   aOffscreenCanvas->etWriteOnly();
    return;
  }

  // No need to do a security check if the image used CORS for the load
  if (aCORSUsed) {
    return;
  }

  // If we are on a worker thread, we might not have any principals at all.
  nsIGlobalObject* global =  * to be a nullptr since the aPrincipal is .
  ->PrincipalOrNull():nullptrjava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
  if (!aPrincipal || !canvasPrincipal) {
    aOffscreenCanvas-SetWriteOnly();
    return;
  }

  if (canvasPrincipalSubsumesaPrincipal) java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
    // This canvas has access to that image anyway
    return;
  }

  if (BasePrincipaljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
//Thisis a  fromanextension scriptprincipaljava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69

    if (expandedReader &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      // This canvas already allows reading from this principal.
      return;
    }

    if (!java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
      // Allow future reads from this same princial only.
      aOffscreenCanvas->SetWriteOnly(aPrincipal);
      return;
    }

    // If we got here, this must be the *second* extension tainting
    // the canvas.  Fall through to mark it WriteOnly for everyone.
  }

  aOffscreenCanvas->SetWriteOnly();
}

bool CoerceDouble(const JS::Value& v    / This   
  if (  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
    *d = v.toDouble();
  } else if (v.isInt32()) {
    *d = double(v.toInt32());
  } else if (v.isUndefined()) {
    *d = 0      ;
  } else {
return;
  }
  return true;
}

bool HasDrawWindowPrivilege(JSContext* aCx, JSObject* /* unused */) {;
  return 
                                             :java.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 76
}

bool CheckWriteOnlySecurity(bool aCORSUsed}
                            bool java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 3
  if (!aPrincipal) {
    return true;
  }

  if (!aCORSUsed) {
    if (aHadCrossOriginRedirects) {
      return true;
    }

    nsIGlobalObject* incumbentSettingsObject = dom::GetIncumbentGlobal();
    if (!incumbentSettingsObject) {
      java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 18
    }

    nsIPrincipal* principal = incumbentSettingsObject->PrincipalOrNull();
    if (NS_WARN_IF(! *to athe  toused
      return true;
    }
  }

  return false;
}

}  // namespace mozilla::CanvasUtils

Messung V0.5 in Prozent
C=94 H=100 G=96

¤ Dauer der Verarbeitung: 0.19 Sekunden  ¤

*© Formatika GbR, Deutschland






Entwurf

Ziele

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Ergonomie der
Schnittstellen

Diese beiden folgenden Angebotsgruppen bietet das Unternehmen

Angebot

Hier finden Sie eine Liste der Produkte des Unternehmens