Commit ef7b6b88 authored by Iulian Moraru's avatar Iulian Moraru
Browse files

Backed out 3 changesets (bug 1503072) for causing bc failures on...

Backed out 3 changesets (bug 1503072) for causing bc failures on browser_navigation_fetch_fault_handling.js. CLOSED TREE

Backed out changeset f8c6503512f5 (bug 1503072)
Backed out changeset c04927c15fd8 (bug 1503072)
Backed out changeset b7550232d4f1 (bug 1503072)
parent bd86df06
Loading
Loading
Loading
Loading
+1 −21
Original line number Diff line number Diff line
@@ -98,28 +98,8 @@ class ClientChannelHelper : public nsIInterfaceRequestor,
                              initialClientInfo.isNothing());

        if (reservedClientInfo.isSome()) {
          // Create a new client for the case the controller is cleared for the
          // new loadInfo. ServiceWorkerManager::DispatchFetchEvent() called
          // ServiceWorkerManager::StartControllingClient() making the old
          // client to be controlled eventually. However, the controller setting
          // propagation to the child process could happen later than
          // nsGlobalWindowInner::EnsureClientSource(), such that
          // nsGlobalWindowInner will be controlled as unexpected.
          if (oldLoadInfo->GetController().isSome() &&
              newLoadInfo->GetController().isNothing()) {
            nsIScriptSecurityManager* ssm =
                nsContentUtils::GetSecurityManager();
            MOZ_DIAGNOSTIC_ASSERT(ssm);
            nsCOMPtr<nsIPrincipal> principal;
            rv = ssm->GetChannelResultPrincipal(aNewChannel,
                                                getter_AddRefs(principal));
            NS_ENSURE_SUCCESS(rv, rv);
            reservedClient.reset();
            CreateClient(newLoadInfo, principal);
          } else {
          newLoadInfo->SetReservedClientInfo(reservedClientInfo.ref());
        }
        }

        if (initialClientInfo.isSome()) {
          newLoadInfo->SetInitialClientInfo(initialClientInfo.ref());
+0 −29
Original line number Diff line number Diff line
@@ -67,18 +67,6 @@ interface nsIServiceWorkerInfo : nsISupports
  readonly attribute PRTime activatedTime;
  readonly attribute PRTime redundantTime;


  // Total number of navigation faults experienced by this ServiceWorker since
  // it was loaded from disk at startup or was installed.
  readonly attribute unsigned long navigationFaultCount;

  // Testing mechanism to induce synthetic failure of fetch events.  If set to
  // something other than NS_OK, all fetch events dispatched will be propagated
  // to the content process, but when it comes time to dispatch the fetch event,
  // the cancellation control flow path will be triggered.
  attribute nsresult testingInjectCancellation;


  void attachDebugger();

  void detachDebugger();
@@ -99,7 +87,6 @@ interface nsIServiceWorkerRegistrationInfo : nsISupports
  const unsigned short UPDATE_VIA_CACHE_NONE = 2;

  readonly attribute nsIPrincipal principal;
  readonly attribute boolean unregistered;

  readonly attribute AString scope;
  readonly attribute AString scriptSpec;
@@ -112,22 +99,6 @@ interface nsIServiceWorkerRegistrationInfo : nsISupports
  readonly attribute nsIServiceWorkerInfo waitingWorker;
  readonly attribute nsIServiceWorkerInfo activeWorker;

  // Exposes the number of times we have ever checked the usage of this origin
  // for the purposes of mitigating ServiceWorker navigation faults that we
  // suspect to be due to quota limit problems.  This should start out 0 and
  // max out at 1 for the time being.
  //
  // Note that the underlying value is tracked on our per-Principal data, but
  // we don't currently expose that data directly via XPCOM so we're exposing
  // this here as the next best thing and because most non-test consumers would
  // work in terms of the registration anyways.
  //
  // This will return -1 if there is no longer any per-origin data because the
  // last registration for the origin (principal) has been unregistered.
  // (Retaining a reference to this interface does not impact anything the
  // underlying scope-to-registration map that is implemented per spec.)
  readonly attribute long quotaUsageCheckCount;

  // Allows to get the related nsIServiceWorkerInfo for a given
  // nsIWorkerDebugger. Over time we shouldn't need this anymore,
  // and instead always control then nsIWorkerDebugger from
+3 −16
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/Telemetry.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
@@ -241,7 +240,7 @@ mozilla::ipc::IPCResult FetchEventOpChild::RecvRespondWith(
      SynthesizeResponse(std::move(aResult.get_IPCSynthesizeResponseArgs()));
      break;
    case IPCFetchEventRespondWithResult::TResetInterceptionArgs:
      ResetInterception(false);
      ResetInterception();
      break;
    case IPCFetchEventRespondWithResult::TCancelInterceptionArgs:
      CancelInterception(aResult.get_CancelInterceptionArgs().status());
@@ -441,12 +440,12 @@ void FetchEventOpChild::SynthesizeResponse(IPCSynthesizeResponseArgs&& aArgs) {
  MaybeScheduleRegistrationUpdate();
}

void FetchEventOpChild::ResetInterception(bool aBypass) {
void FetchEventOpChild::ResetInterception() {
  AssertIsOnMainThread();
  MOZ_ASSERT(mInterceptedChannel);
  MOZ_ASSERT(!mInterceptedChannelHandled);

  nsresult rv = mInterceptedChannel->ResetInterception(aBypass);
  nsresult rv = mInterceptedChannel->ResetInterception();

  if (NS_WARN_IF(NS_FAILED(rv))) {
    NS_WARNING("Failed to resume intercepted network request!");
@@ -465,18 +464,6 @@ void FetchEventOpChild::CancelInterception(nsresult aStatus) {
  MOZ_ASSERT(!mInterceptedChannelHandled);
  MOZ_ASSERT(NS_FAILED(aStatus));

  // Report a navigation fault if this is a navigation (and we have an active
  // worker, which should be the case in non-shutdown/content-process-crash
  // situations).
  RefPtr<ServiceWorkerInfo> mActive = mRegistration->GetActive();
  if (mActive && mArgs.isNonSubresourceRequest()) {
    mActive->ReportNavigationFault();
    if (StaticPrefs::dom_serviceWorkers_mitigations_bypass_on_fault()) {
      ResetInterception(true);
      return;
    }
  }

  mInterceptedChannel->CancelInterception(aStatus);
  mInterceptedChannelHandled = true;

+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ class FetchEventOpChild final : public PFetchEventOpChild {

  void SynthesizeResponse(IPCSynthesizeResponseArgs&& aArgs);

  void ResetInterception(bool aBypass);
  void ResetInterception();

  void CancelInterception(nsresult aStatus);

+1 −28
Original line number Diff line number Diff line
@@ -125,31 +125,6 @@ ServiceWorkerInfo::GetRedundantTime(PRTime* _retval) {
  return NS_OK;
}

NS_IMETHODIMP
ServiceWorkerInfo::GetNavigationFaultCount(uint32_t* aNavigationFaultCount) {
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(aNavigationFaultCount);
  *aNavigationFaultCount = mNavigationFaultCount;
  return NS_OK;
}

NS_IMETHODIMP
ServiceWorkerInfo::GetTestingInjectCancellation(
    nsresult* aTestingInjectCancellation) {
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(aTestingInjectCancellation);
  *aTestingInjectCancellation = mTestingInjectCancellation;
  return NS_OK;
}

NS_IMETHODIMP
ServiceWorkerInfo::SetTestingInjectCancellation(
    nsresult aTestingInjectCancellation) {
  MOZ_ASSERT(NS_IsMainThread());
  mTestingInjectCancellation = aTestingInjectCancellation;
  return NS_OK;
}

NS_IMETHODIMP
ServiceWorkerInfo::AttachDebugger() {
  return mServiceWorkerPrivate->AttachDebugger();
@@ -213,9 +188,7 @@ ServiceWorkerInfo::ServiceWorkerInfo(nsIPrincipal* aPrincipal,
      mRedundantTime(0),
      mServiceWorkerPrivate(new ServiceWorkerPrivate(this)),
      mSkipWaitingFlag(false),
      mHandlesFetch(Unknown),
      mNavigationFaultCount(0),
      mTestingInjectCancellation(NS_OK) {
      mHandlesFetch(Unknown) {
  MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
  MOZ_ASSERT(mPrincipal);
  // cache origin attributes so we can use them off main thread
Loading