Verified Commit e41384f1 authored by Luca Greco's avatar Luca Greco Committed by ma1
Browse files

Bug 1767455 r=asuth,necko-reviewers,valentin

parent 7176b451
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -5862,6 +5862,11 @@
  value: false
  mirror: always
- name: extensions.web_accessible_workers.deprecated_behavior
  type: bool
  value: false
  mirror: always
# Whether the InstallTrigger implementation should be enabled (or completely
# hidden), separate from InstallTriggerImpl because InstallTrigger is improperly
# used also for UA detection.
+17 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include "mozilla/LoadInfo.h"
#include "mozilla/Monitor.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_extensions.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StoragePrincipalHelper.h"
@@ -2216,7 +2217,22 @@ bool NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport) {
    res = loadingPrincipal->CheckMayLoad(uri, dataInherits);
  }

  return NS_FAILED(res);
  if (NS_FAILED(res)) {
    return true;
  }

  if (!StaticPrefs::extensions_web_accessible_workers_deprecated_behavior() &&
      uri->SchemeIs("moz-extension")) {
    nsContentPolicyType internalContentType =
        loadInfo->InternalContentPolicyType();

    if (internalContentType == nsIContentPolicy::TYPE_INTERNAL_WORKER ||
        internalContentType == nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER) {
      return !loadingPrincipal->IsSameOrigin(uri);
    }
  }

  return false;
}

bool NS_IsSafeMethodNav(nsIChannel* aChannel) {