Backed out changeset 9da3ff68132f (bug 1632160) for bc failures on browser_bug1045809.js . CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2020-05-06 12:12:59 +03:00
Родитель 9dc394e081
Коммит d262ef72aa
9 изменённых файлов: 67 добавлений и 42 удалений

Просмотреть файл

@ -108,16 +108,6 @@ void WindowContext::SendCommitTransaction(ContentChild* aChild,
aChild->SendCommitWindowContextTransaction(this, aTxn, aEpoch);
}
bool WindowContext::CanSet(FieldIndex<IDX_AllowMixedContent>,
const bool& aAllowMixedContent,
ContentParent* aSource) {
// reject all attempts to set allow mixed content from a content process
if (XRE_IsContentProcess() || aSource) {
return false;
}
return true;
}
bool WindowContext::CanSet(FieldIndex<IDX_IsThirdPartyWindow>,
const bool& IsThirdPartyWindow,
ContentParent* aSource) {

Просмотреть файл

@ -25,10 +25,7 @@ class WindowGlobalParent;
FIELD(IsThirdPartyWindow, bool) \
/* Whether this window's channel has been marked as a third-party \
* tracking resource */ \
FIELD(IsThirdPartyTrackingResourceWindow, bool) \
/* Whether the user has overriden the mixed content blocker to allow \
* mixed content loads to happen */ \
FIELD(AllowMixedContent, bool)
FIELD(IsThirdPartyTrackingResourceWindow, bool)
class WindowContext : public nsISupports, public nsWrapperCache {
MOZ_DECL_SYNCED_CONTEXT(WindowContext, MOZ_EACH_WC_FIELD)
@ -109,9 +106,6 @@ class WindowContext : public nsISupports, public nsWrapperCache {
return GetOuterWindowId() == 0 && aValue != 0;
}
bool CanSet(FieldIndex<IDX_AllowMixedContent>, const bool& aAllowMixedContent,
ContentParent* aSource);
bool CanSet(FieldIndex<IDX_CookieJarSettings>,
const Maybe<mozilla::net::CookieJarSettingsArgs>& aValue,
ContentParent* aSource) {

Просмотреть файл

@ -4791,6 +4791,46 @@ nsDocShell::GetMixedContentChannel(nsIChannel** aMixedContentChannel) {
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetAllowMixedContentAndConnectionData(bool* aAllowMixedContent) {
*aAllowMixedContent = false;
// If there is a rootDocShell and calling GetMixedContentChannel() on that
// rootShell returns a non null mixedContentChannel indicates that the
// document has Mixed Active Content that was initially blocked from loading,
// but the user has choosen to override the block and allow the content to
// load.
// mMixedContentChannel is set to the document's channel when the user allows
// mixed content. The MixedContentBlocker content policy checks if the
// document's root channel matches the mMixedContentChannel.
nsCOMPtr<nsIDocShell> rootShell = mBrowsingContext->Top()->GetDocShell();
// XXX Fission: Cross origin iframes can not access the top-level docshell.
// Bug 1632160: Remove GetAllowMixedContentAndConnectionData from
// nsIDocShell and expose similar functionality on BrowsingContext
if (!rootShell) {
return NS_OK;
}
nsCOMPtr<nsIChannel> mixedChannel;
rootShell->GetMixedContentChannel(getter_AddRefs(mixedChannel));
if (!mixedChannel) {
return NS_OK;
}
RefPtr<Document> rootDoc = rootShell->GetDocument();
if (!rootDoc) {
return NS_OK;
}
// Check the root doc's channel against the root docShell's
// mMixedContentChannel to see if they are the same. If they are the same,
// the user has overriden the block.
*aAllowMixedContent = (mixedChannel == rootDoc->GetChannel());
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetVisibility(bool aVisibility) {
// Show()/Hide() may change mContentViewer.

Просмотреть файл

@ -729,6 +729,13 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
attribute nsIChannel mixedContentChannel;
/**
* Checks whether the channel associated with the root docShell is equal to
* mMixedContentChannel. If they are the same, allowMixedContent is set to true.
*/
void GetAllowMixedContentAndConnectionData(out boolean allowMixedContent);
/**
* Are plugins allowed in the current document loaded in this docshell ?
* (if there is one). This depends on whether plugins are allowed by this

Просмотреть файл

@ -232,7 +232,6 @@ struct WindowGlobalInit
MaybeDiscardedBrowsingContext browsingContext;
uint64_t innerWindowId;
uint64_t outerWindowId;
bool allowMixedContent;
};
struct DocShellLoadStateInit

Просмотреть файл

@ -34,7 +34,7 @@ WindowGlobalInit WindowGlobalActor::AboutBlankInitializer(
return WindowGlobalInit(aPrincipal, contentBlockingAllowListPrincipal,
documentURI, aBrowsingContext, innerWindowId,
outerWindowId, false);
outerWindowId);
}
void WindowGlobalActor::ConstructActor(const nsACString& aName,

Просмотреть файл

@ -91,18 +91,10 @@ already_AddRefed<WindowGlobalChild> WindowGlobalChild::Create(
}
#endif
// A non null mixedContent channel on the docshell indicates,
// that the user has overriden mixed content to allow mixed
// content loads to happen.
nsCOMPtr<nsIDocShell> rootShell = aWindow->GetDocShell();
nsCOMPtr<nsIChannel> mixedChannel;
rootShell->GetMixedContentChannel(getter_AddRefs(mixedChannel));
bool allowMixedContent = mixedChannel ? true : false;
WindowGlobalInit init(
principal, aWindow->GetDocumentContentBlockingAllowListPrincipal(),
aWindow->GetDocumentURI(), bc, aWindow->WindowID(),
aWindow->GetOuterWindow()->WindowID(), allowMixedContent);
WindowGlobalInit init(principal,
aWindow->GetDocumentContentBlockingAllowListPrincipal(),
aWindow->GetDocumentURI(), bc, aWindow->WindowID(),
aWindow->GetOuterWindow()->WindowID());
auto wgc = MakeRefPtr<WindowGlobalChild>(init, aWindow);
@ -449,9 +441,9 @@ mozilla::ipc::IPCResult WindowGlobalChild::RecvDispatchSecurityPolicyViolation(
return IPC_OK();
}
IPCResult WindowGlobalChild::RecvRawMessage(const JSActorMessageMeta& aMeta,
const ClonedMessageData& aData,
const ClonedMessageData& aStack) {
IPCResult WindowGlobalChild::RecvRawMessage(
const JSActorMessageMeta& aMeta, const ClonedMessageData& aData,
const ClonedMessageData& aStack) {
StructuredCloneData data;
data.BorrowFromClonedMessageDataForChild(aData);
StructuredCloneData stack;

Просмотреть файл

@ -82,8 +82,6 @@ void WindowGlobalParent::Init(const WindowGlobalInit& aInit) {
// `gWindowContexts`.
WindowContext::Init();
WindowContext::SetAllowMixedContent(aInit.allowMixedContent());
// Determine which content process the window global is coming from.
dom::ContentParentId processId(0);
ContentParent* cp = nullptr;

Просмотреть файл

@ -832,11 +832,15 @@ nsresult nsMixedContentBlocker::ShouldLoad(
// Determine if the rootDoc is https and if the user decided to allow Mixed
// Content
RefPtr<BrowsingContext> bc = docShell->GetBrowsingContext();
RefPtr<BrowsingContext> rootBC = bc->Top();
bool rootHasSecureConnection = rootBC->GetIsSecure();
WindowContext* topWC = bc->GetTopWindowContext();
bool allowMixedContent = topWC->GetAllowMixedContent();
bool rootHasSecureConnection =
docShell->GetBrowsingContext()->Top()->GetIsSecure();
bool allowMixedContent = false;
nsresult rv =
docShell->GetAllowMixedContentAndConnectionData(&allowMixedContent);
if (NS_FAILED(rv)) {
*aDecision = REJECT_REQUEST;
return rv;
}
// When navigating an iframe, the iframe may be https
// but its parents may not be. Check the parents to see if any of them are
@ -858,7 +862,8 @@ nsresult nsMixedContentBlocker::ShouldLoad(
}
// Get the root document from the rootShell
nsCOMPtr<nsIDocShell> rootShell = rootBC->GetDocShell();
nsCOMPtr<nsIDocShell> rootShell =
docShell->GetBrowsingContext()->Top()->GetDocShell();
nsCOMPtr<Document> rootDoc = rootShell ? rootShell->GetDocument() : nullptr;
// TODO Fission: Bug 1631405: Make Mixed Content UI fission compatible