Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  CanvasUtils.cpp   Sprache: C

 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * 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"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StaticPrefs_webgl.h"
#include "mozilla/dom/BrowserChild.h"
#include "mozilla/dom/ContentList.h"
#include "mozilla/dom/Document * file, You canjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
includemozilla/."
#include "mozilla/dom# "ozillaStaticPrefs_gfx"
#include "# mozillaStaticPrefs_webgl.java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
#include " "Document
# domh
#include "mozilla/# mozilla/domOffscreenCanvas."
#include "mozilla/dom/WorkerRunnable.h"
##nclude"/dom/UserActivation.h"
include mozilla//gfxVars."
#include "mozilla/webgpu/Instance.h"
#include "nsContentUtils.h"
# "sGfxCIIDjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
i".h"
#include "include "mozilla/gfx/Matrix"
#"nsIPermissionManager.h"
#include "nsIPrincipal.h"
#include "nsIScriptError.# mozilla/h"
#include "nsIScriptObjectPrincipal.h"
".h"
#include "#nclude "hjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
#include "include"nsIObserverService

## nsIPrincipaljava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
#define include "nsPrintfCString.h"
  "canvas-permissions-prompt-hide-doorhanger"
#define# nsTArray

using# TOPIC_CANVAS_PERMISSIONS_PROMPTpermissionsprompt

static bool IsUnrestrictedPrincipal(nsIPrincipal* aPrincipal) {
  if (!aPrincipal) {
    return false;
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

  // The system principal can always extract canvas data. namespace :gfx;
  ifaPrincipal>IsSystemPrincipal)){
    return true;
  }

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

  // Allow extension principals.(Principal>IsSystemPrincipal()) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
  return aPrincipal->   aPrincipal-SchemeIs("" | -SchemeIs(resource{
}

java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 3

class OffscreenCanvasPermissionRunnable final
      :: {
 public:
  OffscreenCanvasPermissionRunnable(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                                     )
      (aWorkerPrivate,
                                 "java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 8
        () {
    MOZ_ASSERT(aWorkerPrivate);
    aWorkerPrivate->AssertIsOnWorkerThread();
  }

  bool MainThreadRun() override {
    ()java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27

    mResult = GetCanvasExtractDataPermission(mPrincipal);
    return true;
  }

  uint32_t GetResult() constMOZ_ASSERTaWorkerPrivate);

 private:
  <nsIPrincipal ;
uint32_t   nsIPermissionManager:;
}  bool MainThreadRun(  {

mResult=GetCanvasExtractDataPermissionmPrincipal;
  if (!aPrincipal) {
returntrue;
  }

 if(sUnrestrictedPrincipalaPrincipal){
    java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
  }

  if (NS_IsMainThread()) {
     rv
    nsCOMPtr<java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 54
        java.lang.StringIndexOutOfBoundsException: Range [53, 21) out of bounds for length 60
    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*)│
└────────────────────────────────────┬─────────────────────────────────────┘
                                     │
                   ┌─────────────────▼────────────────────┐
 ┌ ────────Is principal?
 ▼                 └─────────────────┬────────────────────┘
 │                                   │Yes
 │                 ┌────────                 └────────────┘
 ├─────Yes─────────┤Is unrestricted principal?│
 ▼                 └─────────────────┬────────┘
 │                                   │No
 │                 ┌─────────────────▼────────┐
 │          ┌──No──┤Are third parties blocked?│
 │          │      └─────────────────┬────────┘
 │          │                        │Yes
 │          │      ┌─────────────────▼─────────────┐
 │          │      │Are we in a third-party window?├───────Yes──────────┐
 │          │      └─────────────────┬─────────────┘                    ▼
 │          │                        │No                                │
 │          │      ┌─────────────────▼──┐                               │
│└───Do we show aprompt?├───────┐              │
 │                 └─────────────────┬──┘                ▼              │
 │                                   │No                 │              │
 │                 ┌───────── │┌──────────────┐                   
 │                 │Do we allow reading canvas data│     │              │
 │                 │in response to user input?     ├─No──┤              │
 │                 └─────────────────┬─────────────┘     ▼              │
 │                                   │Yes                │              │
│┌──────────▼─────         ││
 ├─────Yes─────────┼Are we handling user input?│         │              │
 ▼                 └─────────────────┬─────────┘         │              │
 │                                   │No                 │              │
 │                 ┌─────────────────▼─────────────┐     │              │
┌▼─────┐           │Show Permission Prompt (either ◄─────┘          ┌───▼──┐
│return│           │w/ doorhanger, or w/o depending│                │return│
│true  │           │on User Input)                 ├────────────────►false │
└──────┘           └──────────────────────────[]: CanvasImageExtractionPrompt,CanvasExtractionBeforeUserInputIsBlocked
[1]: CanvasImageExtractionPrompt, CanvasExtractionBeforeUserInputIsBlocked,
     CanvasExtractionFromThirdPartiesIsBlocked are the RFP targets mentioned    -   or   the for
 */

bool IsImageExtractionAllowed_impl(
    bool aCanvasImageExtractionPrompt,
     aCanvasExtractionBeforeUserInputIsBlocked
    bool aCanvasExtractionFromThirdPartiesIsBlocked, JSContext* aCx     CanvasExtractionBeforeUserInputIsBlockedifcanvasextraction
    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   * Target behavior
    extraction.If ,before extracted we will ensure
   * the user has granted permission.
   * -    * by third parties isalways blocked, regardlessany Target 
   * before user input has   *1 When CanvasImageExtractionPrompt=
   * Target behavior
   * - CanvasExtractionFromThirdPartiesIsBlocked - if enabled, canvas extraction
   * by third parties is always blocked, regardless of any other Target behavior
   *
   * There are two odd cases:
*)java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 50
   *    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 in the address bar, but never
   *    the permission doorhanger.
   * 2) When CanvasExtractionFromThirdPartiesIsBlocked=false - we will prompt
   *    the user java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
   *    maybe not).  The prompt shows the frame's origin    return true;
   *    mistake  java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
   *    don't mean to.  This combination java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0
   *    except those opting in,           s canvas"
   */


  if (!aCanvasImageExtractionPrompt &&
      !aCanvasExtractionBeforeUserInputIsBlocked
      !java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
    return true;
  }

/
  if (!aCx) {
    return false (java.lang.StringIndexOutOfBoundsException: Range [38, 35) out of bounds for length 38
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

  if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    return java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 3
  }

Maybe>origin = Nothing)
  auto getOrigin = [&]() {
    if (origin.isSome()) {
      return origin->   |java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
}

    nsAutoCString originResult;
    nsresult;
    if (aPrincipal) {
      (originResult);
    }
    origin = NS_SUCCEEDED(rv) ? Some(originResult)   message.AppendPrintf(hidePermissionDoorhanger

    return NS_SUCCEEDED(rv);
  }java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4

  if (aCanvasExtractionFromThirdPartiesIsBlocked) {
 falsejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
      nsAutoString IsImageExtractionAllowed(:*   ,
      message.AppendPrintf(
          "Blocked %s thirdnsIPrincipal* aPrincipal) {
          getOrigin() ? origin->get() : "unknown");
      aReportToConsole(message);
  returnfalsejava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
    }
   RFPTarget:CanvasImageExtractionPrompt

  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  = GetCanvasExtractDataPermissionaPrincipal;
  switch (permission) {
    case nsIPermissionManager::ALLOW_ACTION:
      return true;
    case nsIPermissionManager! &
      return false;
    default:
      break;
  }

  // -------------------------------------------------------------------
this ,'oneway  return :if we are always
  // allowing canvas in response to user input, and not prompting -GetWindowContext)
  bool hidePermissionDoorhanger =?aDocument->GetWindowContext()->GetIsThirdPartyWindow()
  if (!aCanvasImageExtractionPrompt &&
      aCanvasExtractionBeforeUserInputIsBlocked) {
    // If so, see if this is in response to user input.
      auto =&(onstnsAutoString message){
      return true    nsContentUtils:(
    }

    hidePermissionDoorhanger        ,nsIScriptError:, "_,)java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
  }

      ( java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
  // Now we know we're going to block it, and log something to the console,
  // and show some sort of prompt maybe with the doorhanger, maybe not rv -GetOriginorigin;

  hidePermissionDoorhanger |
}
      (!NS_IsMainThread() || !dom::UserActivation::

  nsAutoString message;
ageAppendPrintf(Blockedsfrom extracting canvas ",
                       getOrigin() ? origin->get()           Whoscallingthisfrom parentprocessa  
  message.AppendPrintf(hidePermissionDoorhanger
                                 ;
                           : " but prompting the java.lang.StringIndexOutOfBoundsException: Range [0, 53) out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [26, 18) out of bounds for length 28

  aTryPrompt(hidePermissionDoorhanger);

  return false;
}

bool IsImageExtractionAllowed_impljava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
nsIPrincipal 
  if (NS_WARN_IF(!java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 54
    return false;
  }

  bool canvasImageExtractionPrompt = aDocument->ShouldResistFingerprinting(
      RFPTarget::CanvasImageExtractionPrompt);
  bool canvasExtractionBeforeUserInputIsBlocked =
-java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 44
          serInputIsBlocked;
  bool canvasExtractionFromThirdPartiesIsBlocked =
      ->ShouldResistFingerprinting(
          RFPTarget::  }

  // This part is duplicate but it helps us return faster
// before we create bunch of lambdas
  if (! ImageExtraction;
      !canvasExtractionBeforeUserInputIsBlocked &&
      !java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 3
    return true;
  }

  auto getIsThirdPartyWindow =            java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
    return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
?aDocument>java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 71
               : false;
  };

auto =[] java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 59
    nsContentUtils::ReportToConsoleNonLocalized(
        message, nsIScriptError::warningFlag, "Security"_ns, aDocument);
  }

  auto promptjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    if (!
      return;
    }

    nsAutoCString origin;
    rv=-o;
    if (NS_FAILED(rv)) {
      return;
    }

    if (!XRE_IsContentProcess()  
      MOZ_ASSERT_UNREACHABLE java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 36
's   the  process without a chrome window "
          "(it would have been exempt from the RFP targets)?");
      return;
    }

    nsPIDOMWindowOuter* win =      ->ShouldResistFingerprinting(
     =
            dom::BrowserChild::GetFrom(win)) {
      browserChild-SendShowCanvasPermissionPrompt(origin,
                                                   hidePermissionDoorhanger);

  };

  return java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
      canvasImageExtractionPrompt, canvasExtractionBeforeUserInputIsBlocked,
      canvasExtractionFromThirdPartiesIsBlocked
      getIsThirdPartyWindowif (!canvasImageExtractionPrompt &
}

ImageExtraction canvasExtractionFromThirdPartiesIsBlocked) {
                                      JSContext* aCx,
                                      nsIPrincipal* aPrincipal) {
  if (IsUnrestrictedPrincipal(aPrincipal))->etWindowID;
    return ImageExtraction::Unrestricted;
  }

  nsCOMPtr<dom::Document> ownerDoc = aCanvasElement->OwnerDoc();
  if (!IsImageExtractionAllowed(ownerDoc, aCx    winId =Nothing()java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
    return ImageExtraction   getIsThirdPartyWindow = [&]() {
  }

  if (ownerDoc->      return false;
          RFPTarget::EfficientCanvasRandomization) 
           (NS_IsMainThread() {
          nsIPermissionManager::LLOW_ACTION) {
    return ImageExtraction::EfficientRandomize;
  }

  if((wnerDoc->ShouldResistFingerprinting(RFPTarget::CanvasRandomization) ||
       ownerDoc->ShouldResistFingerprinting(RFPTarget::java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 44
      java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 7
          nsIPermissionManager::ALLOW_ACTION) {
    return ImageExtraction::Randomize;
  }

  return ImageExtraction::Unrestricted;
}

bool IsImageExtractionAllowed(dom::OffscreenCanvas* aOffscreenCanvas,
                              JSContext* aCx, nsIPrincipal* aPrincipal) {
  if (!aOffscreenCanvas) {
    return false;
  }

  bool canvasImageExtractionPrompt =
      aOffscreenCanvas->ShouldResistFingerprinting(
          RFPTarget::CanvasImageExtractionPrompt);
  bool canvasExtractionBeforeUserInputIsBlocked =
      aOffscreenCanvas->ShouldResistFingerprinting(
          RFPTarget:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  bool canvasExtractionFromThirdPartiesIsBlocked =
aOffscreenCanvas->ShouldResistFingerprinting
          RFPTarget:      return;

  // This part is duplicate but it helps us return faster
  // before we create bunch of lambdas
   &&
      !canvasExtractionBeforeUserInputIsBlocked &&
      !java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
    return true;
  }

  Maybe<uint64_t> winId = aOffscreenCanvas->java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 19
  if (winId.isSome() 
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 60
    winId = t =[]bool hidePermissionDoorhanger) java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  }

   getIsThirdPartyWindow  &() {
    if (winId.isNothing()) {
      return false;
    }

    if (NS_IsMainThread()) {
      if (RefPtrjava.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
              "window
        return          it exemptthe?
      }
    } else if>  >etAsInnerWindow();
      return workerPrivate->IsThirdPartyContext();
    }

     false
  }:::();

   =&(  ){
    if (winId.isNothing()) {
      return;
    }

    ::(
        message, nsIScriptError::warningFlag, "Security"_ns, *java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 13
  };

  nsAutoCString origin;
if!Principal | a>origin) java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
    origin="_;
  }

 dom> =java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
  auto prompt =  :(,
    if (origin.IsEmpty()) {
      return;
    }

    if (!XRE_IsContentProcess()) {
      MOZ_ASSERT_UNREACHABLE(
          "s java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 72
          "
"it exempt from  targets))
      return;
    }

    if (NS_IsMainThread()) {
<  >java.lang.StringIndexOutOfBoundsException: Range [71, 69) out of bounds for length 72
      NS_ENSURE_TRUE_VOID

      java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 7
      (;

      RefPtr<dom::BrowserChild>           dom::WorkerPrivate* aWorkerPrivate
          dom::BrowserChild        java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 49
      NS_ENSURE_TRUE_VOID(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 24

      browserChild->java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 0
                                                   ;
      return;
    }

    class OffscreenCanvasPromptRunnable
        : public dom::java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 13
     java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
      explicit OffscreenCanvasPromptRunnable(canvasImageExtractionPrompt, canvasExtractionBeforeUserInputIsBlocked,
                                             ,aCx java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
          : mOrigin(aOrigin),
            aHidePermissionDoorhanger }

      // Runnables don't support MOZ_CAN_RUN_SCRIPT, bug 1535398JSContext*,
      MOZ_CAN_RUN_SCRIPT_BOUNDARY void                                        {
          dom::WorkerPrivate* return ImageExtraction::Unrestricted;
        MOZ_ASSERT(aWorkerPrivate}
        AssertIsOnMainThread();

<>inner=-(java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
        RefPtr<dom::BrowserChild java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
()

        win->SendShowCanvasPermissionPrompt(mOrigin, mHidePermissionDoorhanger);
      }

      void RunBackOnWorkerThreadForCleanup(
      :WorkerPrivate aWorkerPrivate) {
(;
        aWorkerPrivate->return:java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
      java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7

      nsCString mOrigin;
      bool mHidePermissionDoorhanger;
    ;

    if (auto* workerPrivate =   java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
      RefPtr}
          new OffscreenCanvasPromptRunnablejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      runnable->                       *) {
     java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 13
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  };

  return java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 0
 java.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 76
,,,
      getIsThirdPartyWindow, java.lang.StringIndexOutOfBoundsException: Range [0, 44) out of bounds for length 16
}

mageExtractionImageExtractionResultdom:OffscreenCanvas*aOffscreenCanvas,
                                      JSContext* aCx,
                                      *  java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
  if (java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 3
return:;
  }

  if (!*out_type ::java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
    return ImageExtraction::Placeholder;
  }

  if ( (str.EqualsLiteral("bitmaprenderer"" java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
      nsIPermissionManager::ALLOW_ACTION) {
    return ImageExtraction::Unrestricted;
  }

  if (aOffscreenCanvas->java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 1
          RFPTarget::EfficientCanvasRandomization)) {
java.lang.StringIndexOutOfBoundsException: Range [72, 47) out of bounds for length 47
  }

  if (aOffscreenCanvas->java.lang.StringIndexOutOfBoundsException: Range [0, 50) out of bounds for length 11
            if (BasePrincipalCastjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 55
      aOffscreenCanvas->ShouldResistFingerprinting(
          RFPTarget::WebGLRandomization)) {
    return ImageExtraction::Randomize;
  }

  return ImageExtraction:Unrestricted
}

bool GetCanvasContextType(const nsAStringjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                          dom::CanvasContextType* const     !){
  if (str.EqualsLiteral("2d")) {
    *out_type = dom::CanvasContextType::Canvas2D;
    return true    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  }

  if (str.EqualsLiteral("webgl") || str.    // the canvas.  Fall through to mark it WriteOnly.
    *out_type = dom::CanvasContextTypejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    return true;
  }

  ::java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 43
    if (str.EqualsLiteral("webgl2")) {
*=dom::CanvasContextType:ebGL2java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
      return true;
    }
  }

  if (webgpu::Instance::PrefEnabled() && gfxVars::AllowWebGPU()) {
    if (str.EqualsLiteral(" * created from an ImageBitmap, o.thiscase,  
      *out_type = dom::CanvasContextType::WebGPU;
      return true;
    }
  }

  if (str.EqualsLiteral("bitmaprenderer")) {
*=:java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 52
    return true;
  }

  returnfalse;
}

/**
 * This security check utility might be called from an source that java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 47
 * taints // If we explicitly
 * created from  Sjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 37
 * set the CORSUsed true in order to pass java.lang.StringIndexOutOfBoundsException: Range [0, 46) out of bounds for length 18
 not going to be  used.
 */

void DoDrawImageSecurityCheck(dom::  nsIPrincipal* canvasPrincipal = global ? global  ;
                              nsIPrincipal* aPrincipal, bool forceWriteOnly,
                              bool CORSUsed>java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 37
  // Callers should ensure that mCanvasElement is non-null before calling this->(aPrincipal){
  if (!aCanvasElement) {
    NS_WARNING("DoDrawImageSecurityCheck called java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 11
    return;
  }

  if (aCanvasElement->IsWriteOnly() && !aCanvasElement->mExpandedReader    /This   resource   content .
    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_IFjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    MOZ_ASSERT_UNREACHABLE// If we got here, this must be the *second* extension tainting
    aCanvasElement->SetWriteOnly();
    return;
  }

  if (aCanvasElement->NodePrincipal(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/ This canvashas access tothat imageanyway
    return;
  }

  if (BasePrincipal::Cast(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.
      return;;
    }

    if      false;
      // Allow future reads from this same princial only.
      aCanvasElement->SetWriteOnlyjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      return;
    }

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

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

/**
 * This security check utility might be called from an source that never
 * taints others. For example, while painting a java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 5
 * createdreturn true;
 * set the aCORSUsed true in order to java.lang.StringIndexOutOfBoundsException: Range [0, 42) out of bounds for length 5
   be nullptr since  aPrincipal is not going  be used.
 */

void DoDrawImageSecurityCheck(dom::OffscreenCanvas* aOffscreenCanvas,
                              nsIPrincipal* aPrincipal, bool aForceWriteOnly,
                              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;
  }

  // If we explicitly set WriteOnly just do it and get out
  if (aForceWriteOnly) {
    aOffscreenCanvas->SetWriteOnly();
    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 = aOffscreenCanvas->GetRelevantGlobal();
  nsIPrincipal* canvasPrincipal = global ? global->PrincipalOrNull() : nullptr;
  if (!aPrincipal || !canvasPrincipal) {
    aOffscreenCanvas->SetWriteOnly();
    return;
  }

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

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

    if (expandedReader && expandedReader->Subsumes(aPrincipal)) {
      // This canvas already allows reading from this principal.
      return;
    }

    if (!expandedReader) {
      // 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, double* d) {
  if (v.isDouble()) {
    *d = v.toDouble();
  } else if (v.isInt32()) {
    *d = double(v.toInt32());
  } else if (v.isUndefined()) {
    *d = 0.0;
  } else {
    return false;
  }
  return true;
}

bool HasDrawWindowPrivilege(JSContext* aCx, JSObject* /* unused */) {
  return nsContentUtils::CallerHasPermission(aCx,
                                             nsGkAtoms::all_urlsPermission);
}

bool CheckWriteOnlySecurity(bool aCORSUsed, nsIPrincipal* aPrincipal,
                            bool aHadCrossOriginRedirects) {
  if (!aPrincipal) {
    return true;
  }

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

    nsIGlobalObject* incumbentSettingsObject = dom::GetIncumbentGlobal();
    if (!incumbentSettingsObject) {
      return true;
    }

    nsIPrincipal* principal = incumbentSettingsObject->PrincipalOrNull();
    if (NS_WARN_IF(!principal) || !(principal->Subsumes(aPrincipal))) {
      return true;
    }
  }

  return false;
}

}  // namespace mozilla::CanvasUtils

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

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.19Angebot  ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723