mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-23 21:03:08 +09:00
Issue #2653 - Part 1: Initial cleanup of AppId and isolated mozbrowser.
This removes a lot of the plumbing for having the platform embed itself through IPC which was required for B2G running the browser as both shell and browser application.
This commit is contained in:
parent
a6c54d0736
commit
7b6e3a2d4a
77 changed files with 295 additions and 1799 deletions
|
|
@ -2569,7 +2569,7 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
|
|||
NS_IMETHODIMP
|
||||
nsDocShell::SetFullscreenAllowed(bool aFullscreenAllowed)
|
||||
{
|
||||
if (!nsIDocShell::GetIsMozBrowserOrApp()) {
|
||||
if (!nsIDocShell::GetIsMozBrowser()) {
|
||||
// Only allow setting of fullscreenAllowed on content/process boundaries.
|
||||
// At non-boundaries the fullscreenAllowed attribute is calculated based on
|
||||
// whether all enclosing frames have the "mozFullscreenAllowed" attribute
|
||||
|
|
@ -3401,7 +3401,7 @@ nsDocShell::GetSameTypeParent(nsIDocShellTreeItem** aParent)
|
|||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nullptr;
|
||||
|
||||
if (nsIDocShell::GetIsMozBrowserOrApp()) {
|
||||
if (nsIDocShell::GetIsMozBrowser()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -3418,7 +3418,7 @@ nsDocShell::GetSameTypeParent(nsIDocShellTreeItem** aParent)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetSameTypeParentIgnoreBrowserAndAppBoundaries(nsIDocShell** aParent)
|
||||
nsDocShell::GetSameTypeParentIgnoreBrowserBoundaries(nsIDocShell** aParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nullptr;
|
||||
|
|
@ -3472,18 +3472,18 @@ nsDocShell::GetSameTypeRootTreeItem(nsIDocShellTreeItem** aRootTreeItem)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetSameTypeRootTreeItemIgnoreBrowserAndAppBoundaries(nsIDocShell ** aRootTreeItem)
|
||||
nsDocShell::GetSameTypeRootTreeItemIgnoreBrowserBoundaries(nsIDocShell ** aRootTreeItem)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootTreeItem);
|
||||
*aRootTreeItem = static_cast<nsIDocShell *>(this);
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent;
|
||||
NS_ENSURE_SUCCESS(GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent)),
|
||||
NS_ENSURE_SUCCESS(GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent)),
|
||||
NS_ERROR_FAILURE);
|
||||
while (parent) {
|
||||
*aRootTreeItem = parent;
|
||||
NS_ENSURE_SUCCESS((*aRootTreeItem)->
|
||||
GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent)),
|
||||
GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent)),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
NS_ADDREF(*aRootTreeItem);
|
||||
|
|
@ -3537,12 +3537,6 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (targetDS->GetIsInIsolatedMozBrowserElement() !=
|
||||
accessingDS->GetIsInIsolatedMozBrowserElement() ||
|
||||
targetDS->GetAppId() != accessingDS->GetAppId()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> accessingRoot;
|
||||
aAccessingItem->GetSameTypeRootTreeItem(getter_AddRefs(accessingRoot));
|
||||
nsCOMPtr<nsIDocShell> accessingRootDS = do_QueryInterface(accessingRoot);
|
||||
|
|
@ -3563,7 +3557,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
|||
if (OriginAttributes::IsFirstPartyEnabled()) {
|
||||
if (accessingDS == accessingRootDS &&
|
||||
aAccessingItem->ItemType() == nsIDocShellTreeItem::typeContent &&
|
||||
!accessingDS->GetIsMozBrowserOrApp()) {
|
||||
!accessingDS->GetIsMozBrowser()) {
|
||||
|
||||
nsCOMPtr<nsIDocument> accessingDoc = aAccessingItem->GetDocument();
|
||||
|
||||
|
|
@ -3577,7 +3571,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
|||
|
||||
if (targetDS == targetRootDS &&
|
||||
aTargetItem->ItemType() == nsIDocShellTreeItem::typeContent &&
|
||||
!targetDS->GetIsMozBrowserOrApp()) {
|
||||
!targetDS->GetIsMozBrowser()) {
|
||||
|
||||
nsCOMPtr<nsIDocument> targetDoc = aAccessingItem->GetDocument();
|
||||
|
||||
|
|
@ -3774,7 +3768,7 @@ nsDocShell::DoFindItemWithName(const nsAString& aName,
|
|||
|
||||
// If we have a same-type parent, respecting browser and app boundaries.
|
||||
// NOTE: Could use GetSameTypeParent if the issues described in bug 1310344 are fixed.
|
||||
if (!GetIsMozBrowserOrApp() && parentAsTreeItem->ItemType() == mItemType) {
|
||||
if (!GetIsMozBrowser() && parentAsTreeItem->ItemType() == mItemType) {
|
||||
return parentAsTreeItem->FindItemWithName(
|
||||
aName,
|
||||
static_cast<nsIDocShellTreeItem*>(this),
|
||||
|
|
@ -5312,16 +5306,6 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
|
|||
errorPageUrl.AppendLiteral("&f=");
|
||||
errorPageUrl.AppendASCII(frameType.get());
|
||||
|
||||
// Append the manifest URL if the error comes from an app.
|
||||
nsString manifestURL;
|
||||
nsresult rv = GetAppManifestURL(manifestURL);
|
||||
if (manifestURL.Length() > 0) {
|
||||
nsCString manifestParam;
|
||||
SAFE_ESCAPE(manifestParam, NS_ConvertUTF16toUTF8(manifestURL), url_Path);
|
||||
errorPageUrl.AppendLiteral("&m=");
|
||||
errorPageUrl.AppendASCII(manifestParam.get());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICaptivePortalService> cps = do_GetService(NS_CAPTIVEPORTAL_CID);
|
||||
int32_t cpsState;
|
||||
if (cps && NS_SUCCEEDED(cps->GetState(&cpsState)) &&
|
||||
|
|
@ -5335,7 +5319,7 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
|
|||
errorPageUrl.AppendASCII(escapedDescription.get());
|
||||
|
||||
nsCOMPtr<nsIURI> errorPageURI;
|
||||
rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return InternalLoad(errorPageURI, nullptr, false, false,
|
||||
|
|
@ -6222,9 +6206,7 @@ nsDocShell::SetIsActive(bool aIsActive)
|
|||
mScriptGlobal->SetIsBackground(!aIsActive);
|
||||
if (nsCOMPtr<nsIDocument> doc = mScriptGlobal->GetExtantDoc()) {
|
||||
// Update orientation when the top-level browsing context becomes active.
|
||||
// We make an exception for apps because they currently rely on
|
||||
// orientation locks persisting across browsing contexts.
|
||||
if (aIsActive && !GetIsApp()) {
|
||||
if (aIsActive) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
GetSameTypeParent(getter_AddRefs(parent));
|
||||
if (!parent) {
|
||||
|
|
@ -6261,7 +6243,7 @@ nsDocShell::SetIsActive(bool aIsActive)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!docshell->GetIsMozBrowserOrApp()) {
|
||||
if (!docshell->GetIsMozBrowser()) {
|
||||
docshell->SetIsActive(aIsActive);
|
||||
}
|
||||
}
|
||||
|
|
@ -10636,9 +10618,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
// lock the orientation of the document to the document's default
|
||||
// orientation. We don't explicitly check for a top-level browsing context
|
||||
// here because orientation is only set on top-level browsing contexts.
|
||||
// We make an exception for apps because they currently rely on
|
||||
// orientation locks persisting across browsing contexts.
|
||||
if (OrientationLock() != eScreenOrientation_None && !GetIsApp()) {
|
||||
if (OrientationLock() != eScreenOrientation_None) {
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
GetSameTypeParent(getter_AddRefs(parent));
|
||||
|
|
@ -11023,7 +11003,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
|||
NeckoOriginAttributes neckoAttrs;
|
||||
bool isTopLevelDoc = aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT &&
|
||||
mItemType == typeContent &&
|
||||
!GetIsMozBrowserOrApp();
|
||||
!GetIsMozBrowser();
|
||||
neckoAttrs.InheritFromDocShellToNecko(GetOriginAttributes(), isTopLevelDoc, aURI);
|
||||
rv = loadInfo->SetOriginAttributes(neckoAttrs);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
|
@ -14480,16 +14460,9 @@ nsDocShell::GetFrameType(uint32_t* aFrameType)
|
|||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsApp(bool* aIsApp)
|
||||
nsDocShell::GetIsMozBrowser(bool* aIsMozBrowser)
|
||||
{
|
||||
*aIsApp = (mFrameType == FRAME_TYPE_APP);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsMozBrowserOrApp(bool* aIsMozBrowserOrApp)
|
||||
{
|
||||
*aIsMozBrowserOrApp = (mFrameType != FRAME_TYPE_REGULAR);
|
||||
*aIsMozBrowser = (mFrameType == FRAME_TYPE_BROWSER);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -14512,30 +14485,9 @@ nsDocShell::GetInheritedFrameType()
|
|||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsIsolatedMozBrowserElement(bool* aIsIsolatedMozBrowserElement)
|
||||
nsDocShell::GetIsInMozBrowser(bool* aIsInMozBrowser)
|
||||
{
|
||||
bool result = mFrameType == FRAME_TYPE_BROWSER &&
|
||||
mOriginAttributes.mInIsolatedMozBrowser;
|
||||
*aIsIsolatedMozBrowserElement = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
|
||||
{
|
||||
MOZ_ASSERT(!mOriginAttributes.mInIsolatedMozBrowser ||
|
||||
(GetInheritedFrameType() == FRAME_TYPE_BROWSER),
|
||||
"Isolated mozbrowser should only be true inside browser frames");
|
||||
bool result = (GetInheritedFrameType() == FRAME_TYPE_BROWSER) &&
|
||||
mOriginAttributes.mInIsolatedMozBrowser;
|
||||
*aIsInIsolatedMozBrowserElement = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsInMozBrowserOrApp(bool* aIsInMozBrowserOrApp)
|
||||
{
|
||||
*aIsInMozBrowserOrApp = (GetInheritedFrameType() != FRAME_TYPE_REGULAR);
|
||||
*aIsInMozBrowser = (GetInheritedFrameType() == FRAME_TYPE_BROWSER);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -14553,25 +14505,6 @@ nsDocShell::GetIsTopLevelContentDocShell(bool* aIsTopLevelContentDocShell)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetAppId(uint32_t* aAppId)
|
||||
{
|
||||
if (mOriginAttributes.mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
*aAppId = mOriginAttributes.mAppId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent;
|
||||
GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent));
|
||||
|
||||
if (!parent) {
|
||||
*aAppId = nsIScriptSecurityManager::NO_APP_ID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return parent->GetAppId(aAppId);
|
||||
}
|
||||
|
||||
// Implements nsILoadContext.originAttributes
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetOriginAttributes(JS::MutableHandle<JS::Value> aVal)
|
||||
|
|
@ -14680,23 +14613,6 @@ nsDocShell::SetOriginAttributes(JS::Handle<JS::Value> aOriginAttributes,
|
|||
return SetOriginAttributes(attrs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAppManifestURL(nsAString& aAppManifestURL)
|
||||
{
|
||||
uint32_t appId = nsIDocShell::GetAppId();
|
||||
if (appId != nsIScriptSecurityManager::NO_APP_ID &&
|
||||
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
NS_ASSERTION(appsService, "No AppsService available");
|
||||
appsService->GetManifestURLByLocalId(appId, aAppManifestURL);
|
||||
} else {
|
||||
aAppManifestURL.SetLength(0);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue