import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1137151: Enable test for non-public ref-counted destructors on gcc 4.8 and later, r=nfroyd (f286340cea)
- Bug 1028132 - Remove mozilla::HasDangerousPublicDestructor<T>. r=mccr8 (f4922e45d7)
- Bug 1057224 - Disable MOZ_ASSERT_CLASSNAME on gcc < 4.7. r=ehsan (faf4d10f51)
- Bug 1137175 - tighten up public interface of MiscContainer; r=khuey (510bf01921)
- bit of Bug 1152551, part 2 (0f734e8824)
- Bug 1208371 - Implement operator!= for nsMainThreadPtrHandle. r=bholley (df2f2505f9)
- Bug 1228451 - Set short-lived cert lifetime to the max OCSP response lifetime. r=keeler (877f012cce)
- Bug 1231378 - part 5 - Fix uninitialized members of classes in dom/{workers,events,media,canvas}, r=smaug (442135f0ae)
- Bug 1193854 - Restoring userContextIds with the browser session - part 1 - store the userContextId in sessionStore, r=smaug, r=ttaubert (1f6fbe0653)
- Bug 1193854 - Restoring userContextIds with the browser session - part 2 - restore the UI, r=ttaubert (c5ebd875df)
- Bug 1213650 - Regression tests. r=Mossop (c09eb0f7b6)
- Bug 1225921 - Regression tests. r=billm (c3ce773354)
- Bug 1193854 - Restoring userContextIds with the browser session - part 3 - tests, r=ttaubert (de3a5f0558)
- Bug 1237081 - Remove the getter of userContextId from nsIDocShell. r=smaug (0e3a43361e)
- Bug 1232150 - Add atomics for ppc/ppc64. r=lth (0790116e87)
- Backed out changeset 1b5c66916877 (bug 1237081) for mochitest browser-chrome bustage (278ba3c0a7)
- Bug 1237081 - remove the getter of userContextId from nsIDocShell, r=smaug (51d2b9aafa)
- Bug 567365 - allow bfcache for no-cache/https r=jduell r=bz (c94d3a1c00)
- Bug 1239420 - UserContextId should be propagate to nested docShells, r=smaug (148726b883)
- Bug 1212299 part 1 - Forbid documents inside elements other than iframe from requesting fullscreen. r=smaug (6e4662c4d5)
- Bug 1212299 part 2 - Rewrite fullscreen-denied test to have a clearer structure. r=smaug (c0200a46cc)
- Bug 1212299 part 3 - Add test for requesting fullscreen from doc inside frame/object. rs=smaug (3e0c7dae0d)
- Bug 1212299 followup - Fix minor grammar issue in locale text. DONTBUILD (905b69ff0f)
- Bug 1172224 - Ensure that docshells return an appropriate value for APZ-enabled even if they don't have a presShell. r=dvander (a906aeac93)
- Bug 1244076 - Fix a crash in nsDocShell::IssueWarning by null-checking mContentViewer; r=bzbarsky (beb09e9da8)
- Bug 1210439, r=smaug (5d42d61f5c)
- Bug 1100154 - Ensure that targeted links in a private browsing window can't target non-private-browsing windows and vice versa. r=bz (ff6f7ca3ef)
- Bug 1247872. Just get our private browsing state directly off the docshells we already have instead of trying to indirect through their documents. r=smaug (48a4c98815)
This commit is contained in:
2023-09-06 15:22:39 +08:00
parent 137091cd8f
commit e5bf86fbc7
32 changed files with 542 additions and 169 deletions
+54 -32
View File
@@ -2521,20 +2521,25 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
// Assume false until we determine otherwise...
*aFullscreenAllowed = false;
// For non-browsers/apps, check that the enclosing iframe element
// has the allowfullscreen attribute set to true. If any ancestor
// iframe does not have mozallowfullscreen=true, then fullscreen is
// prohibited.
nsCOMPtr<nsPIDOMWindow> win = GetWindow();
if (!win) {
return NS_OK;
}
nsCOMPtr<Element> frameElement = win->GetFrameElementInternal();
if (frameElement &&
frameElement->IsHTMLElement(nsGkAtoms::iframe) &&
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) &&
!frameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)) {
return NS_OK;
if (frameElement && !frameElement->IsXULElement()) {
// We do not allow document inside any containing element other
// than iframe to enter fullscreen.
if (!frameElement->IsHTMLElement(nsGkAtoms::iframe)) {
return NS_OK;
}
// If any ancestor iframe does not have allowfullscreen attribute
// set, then fullscreen is not allowed.
if (!frameElement->HasAttr(kNameSpaceID_None,
nsGkAtoms::allowfullscreen) &&
!frameElement->HasAttr(kNameSpaceID_None,
nsGkAtoms::mozallowfullscreen)) {
return NS_OK;
}
}
// If we have no parent then we're the root docshell; no ancestor of the
@@ -3292,23 +3297,23 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
nsString customUserAgent;
nsCOMPtr<nsIDocShell_ESR38> parentAsDocShell(do_QueryInterface(parent));
if (parentAsDocShell) {
if (NS_SUCCEEDED(parentAsDocShell->GetAllowPlugins(&value))) {
if (mAllowPlugins && NS_SUCCEEDED(parentAsDocShell->GetAllowPlugins(&value))) {
SetAllowPlugins(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetAllowJavascript(&value))) {
if (mAllowJavascript && NS_SUCCEEDED(parentAsDocShell->GetAllowJavascript(&value))) {
SetAllowJavascript(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetAllowMetaRedirects(&value))) {
if (mAllowMetaRedirects && NS_SUCCEEDED(parentAsDocShell->GetAllowMetaRedirects(&value))) {
SetAllowMetaRedirects(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetAllowSubframes(&value))) {
if (mAllowSubframes && NS_SUCCEEDED(parentAsDocShell->GetAllowSubframes(&value))) {
SetAllowSubframes(value);
}
if (NS_SUCCEEDED(parentAsDocShell->GetAllowImages(&value))) {
SetAllowImages(value);
}
SetAllowMedia(parentAsDocShell->GetAllowMedia());
if (NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) {
SetAllowMedia(parentAsDocShell->GetAllowMedia() && mAllowMedia);
if (mAllowWindowControl && NS_SUCCEEDED(parentAsDocShell->GetAllowWindowControl(&value))) {
SetAllowWindowControl(value);
}
SetAllowContentRetargeting(
@@ -3326,7 +3331,7 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
if (NS_FAILED(parentAsDocShell->GetAllowDNSPrefetch(&value))) {
value = false;
}
SetAllowDNSPrefetch(value);
SetAllowDNSPrefetch(mAllowDNSPrefetch && value);
value = parentAsDocShell->GetAffectPrivateSessionLifetime();
SetAffectPrivateSessionLifetime(value);
uint32_t flags;
@@ -3470,18 +3475,23 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
nsCOMPtr<nsIDocShell> targetDS = do_QueryInterface(aTargetItem);
nsCOMPtr<nsIDocShell> accessingDS = do_QueryInterface(aAccessingItem);
if (!!targetDS != !!accessingDS) {
// We must be able to convert both or neither to nsIDocShell.
if (!targetDS || !accessingDS) {
// We must be able to convert both to nsIDocShell.
return false;
}
if (targetDS && accessingDS &&
(targetDS->GetIsInBrowserElement() !=
accessingDS->GetIsInBrowserElement() ||
targetDS->GetAppId() != accessingDS->GetAppId())) {
if (targetDS->GetIsInBrowserElement() != accessingDS->GetIsInBrowserElement() ||
targetDS->GetAppId() != accessingDS->GetAppId()) {
return false;
}
// A private document can't access a non-private one, and vice versa.
if (static_cast<nsDocShell*>(targetDS.get())->UsePrivateBrowsing() !=
static_cast<nsDocShell*>(accessingDS.get())->UsePrivateBrowsing()) {
return false;
}
nsCOMPtr<nsIDocShellTreeItem> accessingRoot;
aAccessingItem->GetSameTypeRootTreeItem(getter_AddRefs(accessingRoot));
@@ -3984,6 +3994,7 @@ nsDocShell::AddChild(nsIDocShellTreeItem* aChild)
}
aChild->SetTreeOwner(mTreeOwner);
childDocShell->SetUserContextId(mUserContextId);
nsCOMPtr<nsIDocShell> childAsDocShell(do_QueryInterface(aChild));
if (!childAsDocShell) {
@@ -12580,13 +12591,9 @@ nsDocShell::ShouldDiscardLayoutState(nsIHttpChannel* aChannel)
}
// figure out if SH should be saving layout state
nsCOMPtr<nsISupports> securityInfo;
bool noStore = false, noCache = false;
aChannel->GetSecurityInfo(getter_AddRefs(securityInfo));
bool noStore = false;
aChannel->IsNoStoreResponse(&noStore);
aChannel->IsNoCacheResponse(&noCache);
return (noStore || (noCache && securityInfo));
return noStore;
}
NS_IMETHODIMP
@@ -13911,6 +13918,17 @@ NS_IMETHODIMP
nsDocShell::SetUserContextId(uint32_t aUserContextId)
{
mUserContextId = aUserContextId;
nsTObserverArray<nsDocLoader*>::ForwardIterator iter(mChildList);
while (iter.HasMore()) {
nsCOMPtr<nsIDocShell> docshell = do_QueryObject(iter.GetNext());
if (!docshell || docshell->ItemType() != ItemType()) {
continue;
}
docshell->SetUserContextId(aUserContextId);
}
return NS_OK;
}
@@ -14066,7 +14084,9 @@ nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
return NS_OK;
}
*aOut = false;
// If we don't have a presShell, fall back to the default platform value of
// whether or not APZ is enabled.
*aOut = gfxPlatform::AsyncPanZoomEnabled();
return NS_OK;
}
@@ -14396,9 +14416,11 @@ nsDocShell::InFrameSwap()
NS_IMETHODIMP
nsDocShell::IssueWarning(uint32_t aWarning, bool aAsError)
{
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
if (doc) {
doc->WarnOnceAbout(nsIDocument::DeprecatedOperations(aWarning), aAsError);
if (mContentViewer) {
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
if (doc) {
doc->WarnOnceAbout(nsIDocument::DeprecatedOperations(aWarning), aAsError);
}
}
return NS_OK;
}