nsDocShellLoadState::nsDocShellLoadState(DocShellLoadStateInit& aLoadState) { MOZ_ASSERT(aLoadState.URI(), "Cannot create a LoadState with a null URI!"); mResultPrincipalURIIsSome = aLoadState.ResultPrincipalURIIsSome(); mKeepResultPrincipalURIIfSet = aLoadState.KeepResultPrincipalURIIfSet(); mLoadReplace = aLoadState.LoadReplace(); mInheritPrincipal = aLoadState.InheritPrincipal(); mPrincipalIsExplicit = aLoadState.PrincipalIsExplicit(); mForceAllowDataURI = aLoadState.ForceAllowDataURI(); mOriginalFrameSrc = aLoadState.OriginalFrameSrc(); mLoadType = aLoadState.LoadType(); mTarget = aLoadState.Target(); mLoadFlags = aLoadState.LoadFlags(); mFirstParty = aLoadState.FirstParty(); mTypeHint = aLoadState.TypeHint(); mFileName = aLoadState.FileName(); mIsFromProcessingFrameAttributes = aLoadState.IsFromProcessingFrameAttributes(); mReferrerInfo = new ReferrerInfo(aLoadState.Referrer(), aLoadState.ReferrerPolicy(), aLoadState.SendReferrer()); mURI = aLoadState.URI(); mOriginalURI = aLoadState.OriginalURI(); mBaseURI = aLoadState.BaseURI(); mTriggeringPrincipal = aLoadState.TriggeringPrincipal(); mPrincipalToInherit = aLoadState.PrincipalToInherit(); mCsp = aLoadState.Csp(); }
DocShellLoadStateInit nsDocShellLoadState::Serialize() { DocShellLoadStateInit loadState; loadState.ResultPrincipalURIIsSome() = mResultPrincipalURIIsSome; loadState.KeepResultPrincipalURIIfSet() = mKeepResultPrincipalURIIfSet; loadState.LoadReplace() = mLoadReplace; loadState.InheritPrincipal() = mInheritPrincipal; loadState.PrincipalIsExplicit() = mPrincipalIsExplicit; loadState.ForceAllowDataURI() = mForceAllowDataURI; loadState.OriginalFrameSrc() = mOriginalFrameSrc; loadState.LoadType() = mLoadType; loadState.Target() = mTarget; loadState.LoadFlags() = mLoadFlags; loadState.FirstParty() = mFirstParty; loadState.TypeHint() = mTypeHint; loadState.FileName() = mFileName; loadState.IsFromProcessingFrameAttributes() = mIsFromProcessingFrameAttributes; loadState.URI() = mURI; loadState.OriginalURI() = mOriginalURI; loadState.BaseURI() = mBaseURI; loadState.TriggeringPrincipal() = mTriggeringPrincipal; loadState.PrincipalToInherit() = mPrincipalToInherit; loadState.Csp() = mCsp; loadState.Referrer() = mReferrerInfo->GetOriginalReferrer(); loadState.SendReferrer() = mReferrerInfo->GetSendReferrer(); loadState.ReferrerPolicy() = mReferrerInfo->GetReferrerPolicy(); return loadState; }
bool IPDLParamTraits<nsDocShellLoadState*>::Read( const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor, RefPtr<nsDocShellLoadState>* aResult) { DocShellLoadStateInit loadState; if (!ReadIPDLParam(aMsg, aIter, aActor, &loadState)) { return false; } // Assert if we somehow don't have a URI in our IPDL type, because we can't // construct anything out of it. This mimics the assertion in the constructor // for nsDocShellLoadState, but makes it clearer that the // DocShellLoadStateInit IPC object can't be clearly converted into a // nsDocShellLoadState. MOZ_ASSERT(loadState.URI()); *aResult = new nsDocShellLoadState(loadState); return true; }