Commit 81f305e0 authored by Calixte's avatar Calixte
Browse files

Bug 1763330 - Ship OffscreenCanvas for pdf.js r=aosmond,gfx-reviewers

- It'll helpful to generate some ImageBitmap in the worker instead passing some
  Uint8Clamped array from the worker to the main thread.
- Hence it will reduce memory footprint and improve performance in pdf.js.

Differential Revision: https://phabricator.services.mozilla.com/D143019
parent 7baded92
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -303,7 +303,8 @@ bool IsOffscreenCanvasEnabled(JSContext* aCx, JSObject* /* unused */) {

  if (!NS_IsMainThread()) {
    dom::WorkerPrivate* workerPrivate = dom::GetWorkerPrivateFromContext(aCx);
    if (workerPrivate->UsesSystemPrincipal()) {
    if (workerPrivate->UsesSystemPrincipal() ||
        workerPrivate->OriginNoSuffix() == u"resource://pdf.js"_ns) {
      return true;
    }

@@ -311,7 +312,7 @@ bool IsOffscreenCanvasEnabled(JSContext* aCx, JSObject* /* unused */) {
  }

  nsIPrincipal* principal = nsContentUtils::SubjectPrincipal(aCx);
  if (principal->IsSystemPrincipal()) {
  if (principal->IsSystemPrincipal() || nsContentUtils::IsPDFJS(principal)) {
    return true;
  }