mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +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
|
|
@ -340,9 +340,9 @@ this.AccessFu = { // jshint ignore:line
|
||||||
case 'remote-browser-shown':
|
case 'remote-browser-shown':
|
||||||
case 'inprocess-browser-shown':
|
case 'inprocess-browser-shown':
|
||||||
{
|
{
|
||||||
// Ignore notifications that aren't from a BrowserOrApp
|
// Ignore notifications that aren't from a Browser
|
||||||
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
|
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
|
||||||
if (!frameLoader.ownerIsMozBrowserOrAppFrame) {
|
if (!frameLoader.ownerIsMozBrowserFrame) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._handleMessageManager(frameLoader.messageManager);
|
this._handleMessageManager(frameLoader.messageManager);
|
||||||
|
|
|
||||||
|
|
@ -303,15 +303,6 @@ interface nsIPrincipal : nsISerializable
|
||||||
*/
|
*/
|
||||||
[infallible] readonly attribute unsigned long privateBrowsingId;
|
[infallible] readonly attribute unsigned long privateBrowsingId;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true iff the principal is inside an isolated mozbrowser element.
|
|
||||||
* <iframe mozbrowser mozapp> and <xul:browser> are not considered to be
|
|
||||||
* mozbrowser elements. <iframe mozbrowser noisolation> does not count as
|
|
||||||
* isolated since isolation is disabled. Isolation can only be disabled if
|
|
||||||
* the containing document is chrome.
|
|
||||||
*/
|
|
||||||
[infallible] readonly attribute boolean isInIsolatedMozBrowserElement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this principal has an unknown appId. This shouldn't
|
* Returns true if this principal has an unknown appId. This shouldn't
|
||||||
* generally be used. We only expose it due to not providing the correct
|
* generally be used. We only expose it due to not providing the correct
|
||||||
|
|
|
||||||
|
|
@ -243,63 +243,7 @@ nsScriptSecurityManager::SecurityHashURI(nsIURI* aURI)
|
||||||
uint16_t
|
uint16_t
|
||||||
nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
|
nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
|
||||||
{
|
{
|
||||||
uint32_t appId = aPrin->GetAppId();
|
return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||||
|
|
||||||
// After bug 1238160, the principal no longer knows how to answer "is this a
|
|
||||||
// browser element", which is really what this code path wants. Currently,
|
|
||||||
// desktop is the only platform where we intend to disable isolation on a
|
|
||||||
// browser frame, so non-desktop should be able to assume that
|
|
||||||
// inIsolatedMozBrowser is true for all mozbrowser frames. Additionally,
|
|
||||||
// apps are no longer used on desktop, so appId is always NO_APP_ID. We use
|
|
||||||
// a release assertion in nsFrameLoader::OwnerIsIsolatedMozBrowserFrame so
|
|
||||||
// that platforms with apps can assume inIsolatedMozBrowser is true for all
|
|
||||||
// mozbrowser frames.
|
|
||||||
bool inIsolatedMozBrowser = aPrin->GetIsInIsolatedMozBrowserElement();
|
|
||||||
|
|
||||||
NS_WARNING_ASSERTION(
|
|
||||||
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
|
|
||||||
"Asking for app status on a principal with an unknown app id");
|
|
||||||
|
|
||||||
// Installed apps have a valid app id (not NO_APP_ID or UNKNOWN_APP_ID)
|
|
||||||
// and they are not inside a mozbrowser.
|
|
||||||
if (appId == nsIScriptSecurityManager::NO_APP_ID ||
|
|
||||||
appId == nsIScriptSecurityManager::UNKNOWN_APP_ID ||
|
|
||||||
inIsolatedMozBrowser)
|
|
||||||
{
|
|
||||||
return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
|
||||||
NS_ENSURE_TRUE(appsService, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> app;
|
|
||||||
appsService->GetAppByLocalId(appId, getter_AddRefs(app));
|
|
||||||
NS_ENSURE_TRUE(app, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
|
||||||
|
|
||||||
uint16_t status = nsIPrincipal::APP_STATUS_INSTALLED;
|
|
||||||
NS_ENSURE_SUCCESS(app->GetAppStatus(&status),
|
|
||||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
|
||||||
|
|
||||||
nsString appOrigin;
|
|
||||||
NS_ENSURE_SUCCESS(app->GetOrigin(appOrigin),
|
|
||||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
|
||||||
nsCOMPtr<nsIURI> appURI;
|
|
||||||
NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(appURI), appOrigin),
|
|
||||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
|
||||||
|
|
||||||
// The app could contain a cross-origin iframe - make sure that the content
|
|
||||||
// is actually same-origin with the app.
|
|
||||||
MOZ_ASSERT(inIsolatedMozBrowser == false, "Checked this above");
|
|
||||||
nsAutoCString suffix;
|
|
||||||
PrincipalOriginAttributes attrs;
|
|
||||||
NS_ENSURE_TRUE(attrs.PopulateFromOrigin(NS_ConvertUTF16toUTF8(appOrigin), suffix),
|
|
||||||
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
|
||||||
attrs.mAppId = appId;
|
|
||||||
attrs.mInIsolatedMozBrowser = false;
|
|
||||||
nsCOMPtr<nsIPrincipal> appPrin = BasePrincipal::CreateCodebasePrincipal(appURI, attrs);
|
|
||||||
NS_ENSURE_TRUE(appPrin, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
|
|
||||||
return aPrin->Equals(appPrin) ? status
|
|
||||||
: nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -569,11 +569,9 @@ WebConsoleActor.prototype =
|
||||||
|
|
||||||
let startedListeners = [];
|
let startedListeners = [];
|
||||||
let window = !this.parentActor.isRootActor ? this.window : null;
|
let window = !this.parentActor.isRootActor ? this.window : null;
|
||||||
let appId = null;
|
|
||||||
let messageManager = null;
|
let messageManager = null;
|
||||||
|
|
||||||
if (this._parentIsContentActor) {
|
if (this._parentIsContentActor) {
|
||||||
appId = this.parentActor.docShell.appId;
|
|
||||||
messageManager = this.parentActor.messageManager;
|
messageManager = this.parentActor.messageManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -604,16 +602,16 @@ WebConsoleActor.prototype =
|
||||||
// Create a StackTraceCollector that's going to be shared both by the
|
// Create a StackTraceCollector that's going to be shared both by the
|
||||||
// NetworkMonitorChild (getting messages about requests from parent) and
|
// NetworkMonitorChild (getting messages about requests from parent) and
|
||||||
// by the NetworkMonitor that directly watches service workers requests.
|
// by the NetworkMonitor that directly watches service workers requests.
|
||||||
this.stackTraceCollector = new StackTraceCollector({ window, appId });
|
this.stackTraceCollector = new StackTraceCollector({ window });
|
||||||
this.stackTraceCollector.init();
|
this.stackTraceCollector.init();
|
||||||
|
|
||||||
let processBoundary = Services.appinfo.processType !=
|
let processBoundary = Services.appinfo.processType !=
|
||||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||||
if ((appId || messageManager) && processBoundary) {
|
if (messageManager && processBoundary) {
|
||||||
// Start a network monitor in the parent process to listen to
|
// Start a network monitor in the parent process to listen to
|
||||||
// most requests than happen in parent
|
// most requests than happen in parent
|
||||||
this.networkMonitor =
|
this.networkMonitor =
|
||||||
new NetworkMonitorChild(appId, this.parentActor.outerWindowID,
|
new NetworkMonitorChild(this.parentActor.outerWindowID,
|
||||||
messageManager, this.conn, this);
|
messageManager, this.conn, this);
|
||||||
this.networkMonitor.init();
|
this.networkMonitor.init();
|
||||||
// Spawn also one in the child to listen to service workers
|
// Spawn also one in the child to listen to service workers
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,12 @@ function getTopWindow(win) {
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsIDocShell);
|
.QueryInterface(Ci.nsIDocShell);
|
||||||
|
|
||||||
if (!docShell.isMozBrowserOrApp) {
|
if (!docShell.isMozBrowser) {
|
||||||
return win.top;
|
return win.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
let topDocShell =
|
let topDocShell =
|
||||||
docShell.getSameTypeRootTreeItemIgnoreBrowserAndAppBoundaries();
|
docShell.getSameTypeRootTreeItemIgnoreBrowserBoundaries();
|
||||||
|
|
||||||
return topDocShell
|
return topDocShell
|
||||||
? topDocShell.contentViewer.DOMDocument.defaultView
|
? topDocShell.contentViewer.DOMDocument.defaultView
|
||||||
|
|
@ -98,12 +98,12 @@ function getParentWindow(win) {
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsIDocShell);
|
.QueryInterface(Ci.nsIDocShell);
|
||||||
|
|
||||||
if (!docShell.isMozBrowserOrApp) {
|
if (!docShell.isMozBrowser) {
|
||||||
return win.parent;
|
return win.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
let parentDocShell =
|
let parentDocShell =
|
||||||
docShell.getSameTypeParentIgnoreBrowserAndAppBoundaries();
|
docShell.getSameTypeParentIgnoreBrowserBoundaries();
|
||||||
|
|
||||||
return parentDocShell
|
return parentDocShell
|
||||||
? parentDocShell.contentViewer.DOMDocument.defaultView
|
? parentDocShell.contentViewer.DOMDocument.defaultView
|
||||||
|
|
|
||||||
|
|
@ -1551,8 +1551,6 @@ NetworkMonitor.prototype = {
|
||||||
* data to the WebConsoleActor or to a NetworkEventActor.
|
* data to the WebConsoleActor or to a NetworkEventActor.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param number appId
|
|
||||||
* The web appId of the child process.
|
|
||||||
* @param number outerWindowID
|
* @param number outerWindowID
|
||||||
* The outerWindowID of the TabActor's main window.
|
* The outerWindowID of the TabActor's main window.
|
||||||
* @param nsIMessageManager messageManager
|
* @param nsIMessageManager messageManager
|
||||||
|
|
@ -1562,8 +1560,7 @@ NetworkMonitor.prototype = {
|
||||||
* @param object owner
|
* @param object owner
|
||||||
* The WebConsoleActor that is listening for the network requests.
|
* The WebConsoleActor that is listening for the network requests.
|
||||||
*/
|
*/
|
||||||
function NetworkMonitorChild(appId, outerWindowID, messageManager, conn, owner) {
|
function NetworkMonitorChild(outerWindowID, messageManager, conn, owner) {
|
||||||
this.appId = appId;
|
|
||||||
this.outerWindowID = outerWindowID;
|
this.outerWindowID = outerWindowID;
|
||||||
this.conn = conn;
|
this.conn = conn;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
|
@ -1577,7 +1574,6 @@ function NetworkMonitorChild(appId, outerWindowID, messageManager, conn, owner)
|
||||||
exports.NetworkMonitorChild = NetworkMonitorChild;
|
exports.NetworkMonitorChild = NetworkMonitorChild;
|
||||||
|
|
||||||
NetworkMonitorChild.prototype = {
|
NetworkMonitorChild.prototype = {
|
||||||
appId: null,
|
|
||||||
owner: null,
|
owner: null,
|
||||||
_netEvents: null,
|
_netEvents: null,
|
||||||
_saveRequestAndResponseBodies: true,
|
_saveRequestAndResponseBodies: true,
|
||||||
|
|
@ -1623,7 +1619,6 @@ NetworkMonitorChild.prototype = {
|
||||||
mm.addMessageListener(`${this._msgName}:newEvent`, this._onNewEvent);
|
mm.addMessageListener(`${this._msgName}:newEvent`, this._onNewEvent);
|
||||||
mm.addMessageListener(`${this._msgName}:updateEvent`, this._onUpdateEvent);
|
mm.addMessageListener(`${this._msgName}:updateEvent`, this._onUpdateEvent);
|
||||||
mm.sendAsyncMessage(this._msgName, {
|
mm.sendAsyncMessage(this._msgName, {
|
||||||
appId: this.appId,
|
|
||||||
outerWindowID: this.outerWindowID,
|
outerWindowID: this.outerWindowID,
|
||||||
action: "start",
|
action: "start",
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -157,28 +157,6 @@ LoadContext::SetRemoteTabs(bool aUseRemoteTabs)
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
LoadContext::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mIsNotNull);
|
|
||||||
|
|
||||||
NS_ENSURE_ARG_POINTER(aIsInIsolatedMozBrowserElement);
|
|
||||||
|
|
||||||
*aIsInIsolatedMozBrowserElement = mOriginAttributes.mInIsolatedMozBrowser;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
LoadContext::GetAppId(uint32_t* aAppId)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mIsNotNull);
|
|
||||||
|
|
||||||
NS_ENSURE_ARG_POINTER(aAppId);
|
|
||||||
|
|
||||||
*aAppId = mOriginAttributes.mAppId;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
LoadContext::GetOriginAttributes(JS::MutableHandleValue aAttrs)
|
LoadContext::GetOriginAttributes(JS::MutableHandleValue aAttrs)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,6 @@ public:
|
||||||
NS_DECL_NSILOADCONTEXT
|
NS_DECL_NSILOADCONTEXT
|
||||||
NS_DECL_NSIINTERFACEREQUESTOR
|
NS_DECL_NSIINTERFACEREQUESTOR
|
||||||
|
|
||||||
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
|
|
||||||
// provided by child process.
|
|
||||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||||
dom::Element* aTopFrameElement,
|
dom::Element* aTopFrameElement,
|
||||||
DocShellOriginAttributes& aAttrs)
|
DocShellOriginAttributes& aAttrs)
|
||||||
|
|
@ -54,8 +52,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
|
|
||||||
// provided by child process.
|
|
||||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||||
uint64_t aNestedFrameId,
|
uint64_t aNestedFrameId,
|
||||||
DocShellOriginAttributes& aAttrs)
|
DocShellOriginAttributes& aAttrs)
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIHttpChannel* aHttpChannel,
|
||||||
curDocShellItem->GetParent(getter_AddRefs(parentDocShellItem))) &&
|
curDocShellItem->GetParent(getter_AddRefs(parentDocShellItem))) &&
|
||||||
parentDocShellItem) {
|
parentDocShellItem) {
|
||||||
nsCOMPtr<nsIDocShell> curDocShell = do_QueryInterface(curDocShellItem);
|
nsCOMPtr<nsIDocShell> curDocShell = do_QueryInterface(curDocShellItem);
|
||||||
if (curDocShell && curDocShell->GetIsMozBrowserOrApp()) {
|
if (curDocShell && curDocShell->GetIsMozBrowser()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2569,7 +2569,7 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::SetFullscreenAllowed(bool aFullscreenAllowed)
|
nsDocShell::SetFullscreenAllowed(bool aFullscreenAllowed)
|
||||||
{
|
{
|
||||||
if (!nsIDocShell::GetIsMozBrowserOrApp()) {
|
if (!nsIDocShell::GetIsMozBrowser()) {
|
||||||
// Only allow setting of fullscreenAllowed on content/process boundaries.
|
// Only allow setting of fullscreenAllowed on content/process boundaries.
|
||||||
// At non-boundaries the fullscreenAllowed attribute is calculated based on
|
// At non-boundaries the fullscreenAllowed attribute is calculated based on
|
||||||
// whether all enclosing frames have the "mozFullscreenAllowed" attribute
|
// whether all enclosing frames have the "mozFullscreenAllowed" attribute
|
||||||
|
|
@ -3401,7 +3401,7 @@ nsDocShell::GetSameTypeParent(nsIDocShellTreeItem** aParent)
|
||||||
NS_ENSURE_ARG_POINTER(aParent);
|
NS_ENSURE_ARG_POINTER(aParent);
|
||||||
*aParent = nullptr;
|
*aParent = nullptr;
|
||||||
|
|
||||||
if (nsIDocShell::GetIsMozBrowserOrApp()) {
|
if (nsIDocShell::GetIsMozBrowser()) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3418,7 +3418,7 @@ nsDocShell::GetSameTypeParent(nsIDocShellTreeItem** aParent)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetSameTypeParentIgnoreBrowserAndAppBoundaries(nsIDocShell** aParent)
|
nsDocShell::GetSameTypeParentIgnoreBrowserBoundaries(nsIDocShell** aParent)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aParent);
|
NS_ENSURE_ARG_POINTER(aParent);
|
||||||
*aParent = nullptr;
|
*aParent = nullptr;
|
||||||
|
|
@ -3472,18 +3472,18 @@ nsDocShell::GetSameTypeRootTreeItem(nsIDocShellTreeItem** aRootTreeItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetSameTypeRootTreeItemIgnoreBrowserAndAppBoundaries(nsIDocShell ** aRootTreeItem)
|
nsDocShell::GetSameTypeRootTreeItemIgnoreBrowserBoundaries(nsIDocShell ** aRootTreeItem)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aRootTreeItem);
|
NS_ENSURE_ARG_POINTER(aRootTreeItem);
|
||||||
*aRootTreeItem = static_cast<nsIDocShell *>(this);
|
*aRootTreeItem = static_cast<nsIDocShell *>(this);
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShell> parent;
|
nsCOMPtr<nsIDocShell> parent;
|
||||||
NS_ENSURE_SUCCESS(GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent)),
|
NS_ENSURE_SUCCESS(GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent)),
|
||||||
NS_ERROR_FAILURE);
|
NS_ERROR_FAILURE);
|
||||||
while (parent) {
|
while (parent) {
|
||||||
*aRootTreeItem = parent;
|
*aRootTreeItem = parent;
|
||||||
NS_ENSURE_SUCCESS((*aRootTreeItem)->
|
NS_ENSURE_SUCCESS((*aRootTreeItem)->
|
||||||
GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent)),
|
GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent)),
|
||||||
NS_ERROR_FAILURE);
|
NS_ERROR_FAILURE);
|
||||||
}
|
}
|
||||||
NS_ADDREF(*aRootTreeItem);
|
NS_ADDREF(*aRootTreeItem);
|
||||||
|
|
@ -3537,12 +3537,6 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetDS->GetIsInIsolatedMozBrowserElement() !=
|
|
||||||
accessingDS->GetIsInIsolatedMozBrowserElement() ||
|
|
||||||
targetDS->GetAppId() != accessingDS->GetAppId()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> accessingRoot;
|
nsCOMPtr<nsIDocShellTreeItem> accessingRoot;
|
||||||
aAccessingItem->GetSameTypeRootTreeItem(getter_AddRefs(accessingRoot));
|
aAccessingItem->GetSameTypeRootTreeItem(getter_AddRefs(accessingRoot));
|
||||||
nsCOMPtr<nsIDocShell> accessingRootDS = do_QueryInterface(accessingRoot);
|
nsCOMPtr<nsIDocShell> accessingRootDS = do_QueryInterface(accessingRoot);
|
||||||
|
|
@ -3563,7 +3557,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
||||||
if (OriginAttributes::IsFirstPartyEnabled()) {
|
if (OriginAttributes::IsFirstPartyEnabled()) {
|
||||||
if (accessingDS == accessingRootDS &&
|
if (accessingDS == accessingRootDS &&
|
||||||
aAccessingItem->ItemType() == nsIDocShellTreeItem::typeContent &&
|
aAccessingItem->ItemType() == nsIDocShellTreeItem::typeContent &&
|
||||||
!accessingDS->GetIsMozBrowserOrApp()) {
|
!accessingDS->GetIsMozBrowser()) {
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> accessingDoc = aAccessingItem->GetDocument();
|
nsCOMPtr<nsIDocument> accessingDoc = aAccessingItem->GetDocument();
|
||||||
|
|
||||||
|
|
@ -3577,7 +3571,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
||||||
|
|
||||||
if (targetDS == targetRootDS &&
|
if (targetDS == targetRootDS &&
|
||||||
aTargetItem->ItemType() == nsIDocShellTreeItem::typeContent &&
|
aTargetItem->ItemType() == nsIDocShellTreeItem::typeContent &&
|
||||||
!targetDS->GetIsMozBrowserOrApp()) {
|
!targetDS->GetIsMozBrowser()) {
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> targetDoc = aAccessingItem->GetDocument();
|
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.
|
// 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.
|
// 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(
|
return parentAsTreeItem->FindItemWithName(
|
||||||
aName,
|
aName,
|
||||||
static_cast<nsIDocShellTreeItem*>(this),
|
static_cast<nsIDocShellTreeItem*>(this),
|
||||||
|
|
@ -5312,16 +5306,6 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
|
||||||
errorPageUrl.AppendLiteral("&f=");
|
errorPageUrl.AppendLiteral("&f=");
|
||||||
errorPageUrl.AppendASCII(frameType.get());
|
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);
|
nsCOMPtr<nsICaptivePortalService> cps = do_GetService(NS_CAPTIVEPORTAL_CID);
|
||||||
int32_t cpsState;
|
int32_t cpsState;
|
||||||
if (cps && NS_SUCCEEDED(cps->GetState(&cpsState)) &&
|
if (cps && NS_SUCCEEDED(cps->GetState(&cpsState)) &&
|
||||||
|
|
@ -5335,7 +5319,7 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
|
||||||
errorPageUrl.AppendASCII(escapedDescription.get());
|
errorPageUrl.AppendASCII(escapedDescription.get());
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> errorPageURI;
|
nsCOMPtr<nsIURI> errorPageURI;
|
||||||
rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);
|
nsresult rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
return InternalLoad(errorPageURI, nullptr, false, false,
|
return InternalLoad(errorPageURI, nullptr, false, false,
|
||||||
|
|
@ -6222,9 +6206,7 @@ nsDocShell::SetIsActive(bool aIsActive)
|
||||||
mScriptGlobal->SetIsBackground(!aIsActive);
|
mScriptGlobal->SetIsBackground(!aIsActive);
|
||||||
if (nsCOMPtr<nsIDocument> doc = mScriptGlobal->GetExtantDoc()) {
|
if (nsCOMPtr<nsIDocument> doc = mScriptGlobal->GetExtantDoc()) {
|
||||||
// Update orientation when the top-level browsing context becomes active.
|
// Update orientation when the top-level browsing context becomes active.
|
||||||
// We make an exception for apps because they currently rely on
|
if (aIsActive) {
|
||||||
// orientation locks persisting across browsing contexts.
|
|
||||||
if (aIsActive && !GetIsApp()) {
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||||
GetSameTypeParent(getter_AddRefs(parent));
|
GetSameTypeParent(getter_AddRefs(parent));
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
|
|
@ -6261,7 +6243,7 @@ nsDocShell::SetIsActive(bool aIsActive)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!docshell->GetIsMozBrowserOrApp()) {
|
if (!docshell->GetIsMozBrowser()) {
|
||||||
docshell->SetIsActive(aIsActive);
|
docshell->SetIsActive(aIsActive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10636,9 +10618,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||||
// lock the orientation of the document to the document's default
|
// lock the orientation of the document to the document's default
|
||||||
// orientation. We don't explicitly check for a top-level browsing context
|
// orientation. We don't explicitly check for a top-level browsing context
|
||||||
// here because orientation is only set on top-level browsing contexts.
|
// here because orientation is only set on top-level browsing contexts.
|
||||||
// We make an exception for apps because they currently rely on
|
if (OrientationLock() != eScreenOrientation_None) {
|
||||||
// orientation locks persisting across browsing contexts.
|
|
||||||
if (OrientationLock() != eScreenOrientation_None && !GetIsApp()) {
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||||
GetSameTypeParent(getter_AddRefs(parent));
|
GetSameTypeParent(getter_AddRefs(parent));
|
||||||
|
|
@ -11023,7 +11003,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||||
NeckoOriginAttributes neckoAttrs;
|
NeckoOriginAttributes neckoAttrs;
|
||||||
bool isTopLevelDoc = aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT &&
|
bool isTopLevelDoc = aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT &&
|
||||||
mItemType == typeContent &&
|
mItemType == typeContent &&
|
||||||
!GetIsMozBrowserOrApp();
|
!GetIsMozBrowser();
|
||||||
neckoAttrs.InheritFromDocShellToNecko(GetOriginAttributes(), isTopLevelDoc, aURI);
|
neckoAttrs.InheritFromDocShellToNecko(GetOriginAttributes(), isTopLevelDoc, aURI);
|
||||||
rv = loadInfo->SetOriginAttributes(neckoAttrs);
|
rv = loadInfo->SetOriginAttributes(neckoAttrs);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
|
@ -14480,16 +14460,9 @@ nsDocShell::GetFrameType(uint32_t* aFrameType)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [infallible] */ NS_IMETHODIMP
|
/* [infallible] */ NS_IMETHODIMP
|
||||||
nsDocShell::GetIsApp(bool* aIsApp)
|
nsDocShell::GetIsMozBrowser(bool* aIsMozBrowser)
|
||||||
{
|
{
|
||||||
*aIsApp = (mFrameType == FRAME_TYPE_APP);
|
*aIsMozBrowser = (mFrameType == FRAME_TYPE_BROWSER);
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* [infallible] */ NS_IMETHODIMP
|
|
||||||
nsDocShell::GetIsMozBrowserOrApp(bool* aIsMozBrowserOrApp)
|
|
||||||
{
|
|
||||||
*aIsMozBrowserOrApp = (mFrameType != FRAME_TYPE_REGULAR);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14512,30 +14485,9 @@ nsDocShell::GetInheritedFrameType()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [infallible] */ NS_IMETHODIMP
|
/* [infallible] */ NS_IMETHODIMP
|
||||||
nsDocShell::GetIsIsolatedMozBrowserElement(bool* aIsIsolatedMozBrowserElement)
|
nsDocShell::GetIsInMozBrowser(bool* aIsInMozBrowser)
|
||||||
{
|
{
|
||||||
bool result = mFrameType == FRAME_TYPE_BROWSER &&
|
*aIsInMozBrowser = (GetInheritedFrameType() == 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);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14553,25 +14505,6 @@ nsDocShell::GetIsTopLevelContentDocShell(bool* aIsTopLevelContentDocShell)
|
||||||
return NS_OK;
|
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
|
// Implements nsILoadContext.originAttributes
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetOriginAttributes(JS::MutableHandle<JS::Value> aVal)
|
nsDocShell::GetOriginAttributes(JS::MutableHandle<JS::Value> aVal)
|
||||||
|
|
@ -14680,23 +14613,6 @@ nsDocShell::SetOriginAttributes(JS::Handle<JS::Value> aOriginAttributes,
|
||||||
return SetOriginAttributes(attrs);
|
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
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
|
nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -789,8 +789,6 @@ protected:
|
||||||
static const nsCString FrameTypeToString(uint32_t aFrameType)
|
static const nsCString FrameTypeToString(uint32_t aFrameType)
|
||||||
{
|
{
|
||||||
switch (aFrameType) {
|
switch (aFrameType) {
|
||||||
case FRAME_TYPE_APP:
|
|
||||||
return NS_LITERAL_CSTRING("app");
|
|
||||||
case FRAME_TYPE_BROWSER:
|
case FRAME_TYPE_BROWSER:
|
||||||
return NS_LITERAL_CSTRING("browser");
|
return NS_LITERAL_CSTRING("browser");
|
||||||
case FRAME_TYPE_REGULAR:
|
case FRAME_TYPE_REGULAR:
|
||||||
|
|
|
||||||
|
|
@ -826,109 +826,50 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||||
*/
|
*/
|
||||||
[noscript] void notifyScrollObservers();
|
[noscript] void notifyScrollObservers();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true iff the docshell corresponds to an <iframe mozapp>.
|
|
||||||
*/
|
|
||||||
[infallible] readonly attribute boolean isApp;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of iframe that this docshell lives.
|
* The type of iframe that this docshell lives.
|
||||||
*/
|
*/
|
||||||
const unsigned long FRAME_TYPE_REGULAR = 0;
|
const unsigned long FRAME_TYPE_REGULAR = 0;
|
||||||
const unsigned long FRAME_TYPE_BROWSER = 1;
|
const unsigned long FRAME_TYPE_BROWSER = 1;
|
||||||
const unsigned long FRAME_TYPE_APP = 2;
|
|
||||||
|
|
||||||
[infallible] attribute unsigned long frameType;
|
[infallible] attribute unsigned long frameType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this docshell corresponds to an <iframe mozbrowser> or
|
* Returns true if this docshell corresponds to an <iframe mozbrowser>.
|
||||||
* <iframe mozapp>. <xul:browser> returns false here.
|
* <xul:browser> returns false here.
|
||||||
*/
|
*/
|
||||||
[infallible] readonly attribute boolean isMozBrowserOrApp;
|
[infallible] readonly attribute boolean isMozBrowser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this docshell corresponds to an isolated <iframe
|
* Returns true if this docshell corresponds to an <iframe mozbrowser>, or
|
||||||
* mozbrowser>.
|
* if this docshell is contained in an <iframe mozbrowser>. <xul:browser>
|
||||||
*
|
* returns false here.
|
||||||
* <iframe mozbrowser mozapp> and <xul:browser> are not considered to be
|
|
||||||
* mozbrowser elements. <iframe mozbrowser noisolation> does not count as
|
|
||||||
* isolated since isolation is disabled. Isolation can only be disabled if
|
|
||||||
* the containing document is chrome.
|
|
||||||
*/
|
|
||||||
[infallible] readonly attribute boolean isIsolatedMozBrowserElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this docshell corresponds to an isolated <iframe
|
|
||||||
* mozbrowser> or if the docshell is contained in an isolated <iframe
|
|
||||||
* mozbrowser>.
|
|
||||||
*
|
|
||||||
* <iframe mozbrowser mozapp> and <xul:browser> are not considered to be
|
|
||||||
* mozbrowser elements. <iframe mozbrowser noisolation> does not count as
|
|
||||||
* isolated since isolation is disabled. Isolation can only be disabled if
|
|
||||||
* the containing document is chrome.
|
|
||||||
*
|
|
||||||
* Our notion here of "contained in" means: Walk up the docshell hierarchy in
|
|
||||||
* this process until we hit an <iframe mozapp> or <iframe mozbrowser> (or
|
|
||||||
* until the hierarchy ends). Return true iff the docshell we stopped on has
|
|
||||||
* isIsolatedMozBrowserElement == true.
|
|
||||||
*/
|
|
||||||
[infallible] readonly attribute boolean isInIsolatedMozBrowserElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this docshell corresponds to an <iframe mozbrowser> or
|
|
||||||
* <iframe mozapp>, or if this docshell is contained in an <iframe mozbrowser>
|
|
||||||
* or <iframe mozapp>. <xul:browser> returns false here.
|
|
||||||
*
|
*
|
||||||
* To compute this value, we walk up the docshell hierarchy. If we encounter
|
* To compute this value, we walk up the docshell hierarchy. If we encounter
|
||||||
* a docshell with isMozBrowserOrApp before we hit the end of the hierarchy,
|
* a docshell with isMozBrowser before we hit the end of the hierarchy,
|
||||||
* we return true. Otherwise, we return false.
|
* we return true. Otherwise, we return false.
|
||||||
*/
|
*/
|
||||||
[infallible] readonly attribute boolean isInMozBrowserOrApp;
|
[infallible] readonly attribute boolean isInMozBrowser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this docshell is the top level content docshell.
|
* Returns true if this docshell is the top level content docshell.
|
||||||
*/
|
*/
|
||||||
[infallible] readonly attribute boolean isTopLevelContentDocShell;
|
[infallible] readonly attribute boolean isTopLevelContentDocShell;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the id of the app associated with this docshell. If this docshell
|
|
||||||
* is an <iframe mozbrowser> inside an <iframe mozapp>, we return the app's
|
|
||||||
* appId.
|
|
||||||
*
|
|
||||||
* We compute this value by walking up the docshell hierarchy until we find a
|
|
||||||
* docshell on which origin attributes was set. (ignoring those docshells
|
|
||||||
* where x == UNKNOWN_APP_ID). We return the app id x.
|
|
||||||
*
|
|
||||||
* If we don't find a docshell with an associated app id in our hierarchy, we
|
|
||||||
* return NO_APP_ID. We never return UNKNOWN_APP_ID.
|
|
||||||
*
|
|
||||||
* Notice that a docshell may have an associated app even if it returns true
|
|
||||||
* for isBrowserElement!
|
|
||||||
*/
|
|
||||||
[infallible] readonly attribute unsigned long appId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the manifest URL of the app associated with this docshell.
|
|
||||||
*
|
|
||||||
* If there is no associated app in our hierarchy, we return empty string.
|
|
||||||
*/
|
|
||||||
readonly attribute DOMString appManifestURL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like nsIDocShellTreeItem::GetSameTypeParent, except this ignores <iframe
|
* Like nsIDocShellTreeItem::GetSameTypeParent, except this ignores <iframe
|
||||||
* mozbrowser> and <iframe mozapp> boundaries.
|
* mozbrowser> boundaries.
|
||||||
*/
|
*/
|
||||||
nsIDocShell getSameTypeParentIgnoreBrowserAndAppBoundaries();
|
nsIDocShell getSameTypeParentIgnoreBrowserBoundaries();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Like nsIDocShellTreeItem::GetSameTypeRootTreeItem, except this ignores
|
* Like nsIDocShellTreeItem::GetSameTypeRootTreeItem, except this ignores
|
||||||
* <iframe mozbrowser> and <iframe mozapp> boundaries.
|
* <iframe mozbrowser> boundaries.
|
||||||
*/
|
*/
|
||||||
nsIDocShell getSameTypeRootTreeItemIgnoreBrowserAndAppBoundaries();
|
nsIDocShell getSameTypeRootTreeItemIgnoreBrowserBoundaries();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True iff asynchronous panning and zooming is enabled for this
|
* True if asynchronous panning and zooming is enabled for this docshell.
|
||||||
* docshell.
|
|
||||||
*/
|
*/
|
||||||
readonly attribute bool asyncPanZoomEnabled;
|
readonly attribute bool asyncPanZoomEnabled;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,9 @@ interface nsIDocShellTreeItem : nsISupports
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This getter returns the same thing parent does however if the parent
|
This getter returns the same thing parent does however if the parent
|
||||||
is of a different itemType, or if the parent is an <iframe mozbrowser>
|
is of a different itemType, or if the parent is an <iframe mozbrowser>.
|
||||||
or <iframe mozapp>, it will instead return nullptr. This call is a
|
It will instead return nullptr. This call is a convience function for
|
||||||
convience function for those wishing to not cross the boundaries at
|
Ithose wishing to not cross the boundaries at which item types change.
|
||||||
which item types change.
|
|
||||||
*/
|
*/
|
||||||
readonly attribute nsIDocShellTreeItem sameTypeParent;
|
readonly attribute nsIDocShellTreeItem sameTypeParent;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,21 +104,6 @@ interface nsILoadContext : nsISupports
|
||||||
*/
|
*/
|
||||||
[noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
|
[noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true iff the load is occurring inside an isolated mozbrowser
|
|
||||||
* element. <iframe mozbrowser mozapp> and <xul:browser> are not considered to
|
|
||||||
* be mozbrowser elements. <iframe mozbrowser noisolation> does not count as
|
|
||||||
* isolated since isolation is disabled. Isolation can only be disabled if
|
|
||||||
* the containing document is chrome.
|
|
||||||
*/
|
|
||||||
readonly attribute boolean isInIsolatedMozBrowserElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the app id of the app the load is occurring is in. Returns
|
|
||||||
* nsIScriptSecurityManager::NO_APP_ID if the load is not part of an app.
|
|
||||||
*/
|
|
||||||
readonly attribute unsigned long appId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dictionary of the non-default origin attributes associated with this
|
* A dictionary of the non-default origin attributes associated with this
|
||||||
* nsILoadContext.
|
* nsILoadContext.
|
||||||
|
|
|
||||||
|
|
@ -233,11 +233,6 @@ this.PermissionsTable = { geolocation: {
|
||||||
privileged: DENY_ACTION,
|
privileged: DENY_ACTION,
|
||||||
certified: ALLOW_ACTION
|
certified: ALLOW_ACTION
|
||||||
},
|
},
|
||||||
"embed-apps": {
|
|
||||||
app: DENY_ACTION,
|
|
||||||
privileged: DENY_ACTION,
|
|
||||||
certified: ALLOW_ACTION
|
|
||||||
},
|
|
||||||
"background-sensors": {
|
"background-sensors": {
|
||||||
app: DENY_ACTION,
|
app: DENY_ACTION,
|
||||||
privileged: DENY_ACTION,
|
privileged: DENY_ACTION,
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@
|
||||||
#include "TimeManager.h"
|
#include "TimeManager.h"
|
||||||
#include "nsStreamUtils.h"
|
#include "nsStreamUtils.h"
|
||||||
#include "nsIAppsService.h"
|
#include "nsIAppsService.h"
|
||||||
#include "mozIApplication.h"
|
|
||||||
#include "WidgetUtils.h"
|
#include "WidgetUtils.h"
|
||||||
#include "mozilla/dom/MediaDevices.h"
|
#include "mozilla/dom/MediaDevices.h"
|
||||||
#include "MediaManager.h"
|
#include "MediaManager.h"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
|
#include "nsPIDOMWindow.h"
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(ThirdPartyUtil, mozIThirdPartyUtil)
|
NS_IMPL_ISUPPORTS(ThirdPartyUtil, mozIThirdPartyUtil)
|
||||||
|
|
||||||
|
|
@ -145,7 +146,7 @@ ThirdPartyUtil::IsThirdPartyWindow(mozIDOMWindowProxy* aWindow,
|
||||||
nsCOMPtr<nsIURI> parentURI;
|
nsCOMPtr<nsIURI> parentURI;
|
||||||
do {
|
do {
|
||||||
// We use GetScriptableParent rather than GetParent because we consider
|
// We use GetScriptableParent rather than GetParent because we consider
|
||||||
// <iframe mozbrowser/mozapp> to be a top-level frame.
|
// <iframe mozbrowser> to be a top-level frame.
|
||||||
parent = current->GetScriptableParent();
|
parent = current->GetScriptableParent();
|
||||||
if (SameCOMIdentity(parent, current)) {
|
if (SameCOMIdentity(parent, current)) {
|
||||||
// We're at the topmost content window. We already know the answer.
|
// We're at the topmost content window. We already know the answer.
|
||||||
|
|
|
||||||
|
|
@ -6616,7 +6616,7 @@ nsContentUtils::IsUserFocusIgnored(nsINode* aNode)
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aNode);
|
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aNode);
|
||||||
if (browserFrame &&
|
if (browserFrame &&
|
||||||
aNode->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::ignoreuserfocus) &&
|
aNode->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::ignoreuserfocus) &&
|
||||||
browserFrame->GetReallyIsBrowserOrApp()) {
|
browserFrame->GetReallyIsBrowser()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
nsPIDOMWindowOuter* win = aNode->OwnerDoc()->GetWindow();
|
nsPIDOMWindowOuter* win = aNode->OwnerDoc()->GetWindow();
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
#include "prenv.h"
|
#include "prenv.h"
|
||||||
|
|
||||||
#include "mozIApplication.h"
|
|
||||||
#include "nsDocShell.h"
|
#include "nsDocShell.h"
|
||||||
#include "nsIAppsService.h"
|
#include "nsIAppsService.h"
|
||||||
#include "nsIDOMHTMLIFrameElement.h"
|
#include "nsIDOMHTMLIFrameElement.h"
|
||||||
|
|
@ -88,7 +87,6 @@
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||||
#include "mozilla/layout/RenderFrameParent.h"
|
#include "mozilla/layout/RenderFrameParent.h"
|
||||||
#include "nsIAppsService.h"
|
|
||||||
#include "GeckoProfiler.h"
|
#include "GeckoProfiler.h"
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
|
|
@ -1071,12 +1069,6 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mRemoteBrowser->IsIsolatedMozBrowserElement() !=
|
|
||||||
aOther->mRemoteBrowser->IsIsolatedMozBrowserElement() ||
|
|
||||||
mRemoteBrowser->HasOwnApp() != aOther->mRemoteBrowser->HasOwnApp()) {
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// When we swap docShells, maybe we have to deal with a new page created just
|
// When we swap docShells, maybe we have to deal with a new page created just
|
||||||
// for this operation. In this case, the browser code should already have set
|
// for this operation. In this case, the browser code should already have set
|
||||||
// the correct userContextId attribute value in the owning XULElement, but our
|
// the correct userContextId attribute value in the owning XULElement, but our
|
||||||
|
|
@ -1145,10 +1137,10 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy browser frame scripts for content leaving a frame with browser API
|
// Destroy browser frame scripts for content leaving a frame with browser API
|
||||||
if (OwnerIsMozBrowserOrAppFrame() && !aOther->OwnerIsMozBrowserOrAppFrame()) {
|
if (OwnerIsMozBrowserFrame() && !aOther->OwnerIsMozBrowserFrame()) {
|
||||||
DestroyBrowserFrameScripts();
|
DestroyBrowserFrameScripts();
|
||||||
}
|
}
|
||||||
if (!OwnerIsMozBrowserOrAppFrame() && aOther->OwnerIsMozBrowserOrAppFrame()) {
|
if (!OwnerIsMozBrowserFrame() && aOther->OwnerIsMozBrowserFrame()) {
|
||||||
aOther->DestroyBrowserFrameScripts();
|
aOther->DestroyBrowserFrameScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1320,12 +1312,12 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||||
|
|
||||||
bool ourFullscreenAllowed =
|
bool ourFullscreenAllowed =
|
||||||
ourContent->IsXULElement() ||
|
ourContent->IsXULElement() ||
|
||||||
(OwnerIsMozBrowserOrAppFrame() &&
|
(OwnerIsMozBrowserFrame() &&
|
||||||
(ourContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
|
(ourContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
|
||||||
ourContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)));
|
ourContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)));
|
||||||
bool otherFullscreenAllowed =
|
bool otherFullscreenAllowed =
|
||||||
otherContent->IsXULElement() ||
|
otherContent->IsXULElement() ||
|
||||||
(aOther->OwnerIsMozBrowserOrAppFrame() &&
|
(aOther->OwnerIsMozBrowserFrame() &&
|
||||||
(otherContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
|
(otherContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
|
||||||
otherContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)));
|
otherContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)));
|
||||||
if (ourFullscreenAllowed != otherFullscreenAllowed) {
|
if (ourFullscreenAllowed != otherFullscreenAllowed) {
|
||||||
|
|
@ -1470,12 +1462,6 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ourDocshell->GetIsIsolatedMozBrowserElement() !=
|
|
||||||
otherDocshell->GetIsIsolatedMozBrowserElement() ||
|
|
||||||
ourDocshell->GetIsApp() != otherDocshell->GetIsApp()) {
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// When we swap docShells, maybe we have to deal with a new page created just
|
// When we swap docShells, maybe we have to deal with a new page created just
|
||||||
// for this operation. In this case, the browser code should already have set
|
// for this operation. In this case, the browser code should already have set
|
||||||
// the correct userContextId attribute value in the owning XULElement, but our
|
// the correct userContextId attribute value in the owning XULElement, but our
|
||||||
|
|
@ -1522,10 +1508,10 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy browser frame scripts for content leaving a frame with browser API
|
// Destroy browser frame scripts for content leaving a frame with browser API
|
||||||
if (OwnerIsMozBrowserOrAppFrame() && !aOther->OwnerIsMozBrowserOrAppFrame()) {
|
if (OwnerIsMozBrowserFrame() && !aOther->OwnerIsMozBrowserFrame()) {
|
||||||
DestroyBrowserFrameScripts();
|
DestroyBrowserFrameScripts();
|
||||||
}
|
}
|
||||||
if (!OwnerIsMozBrowserOrAppFrame() && aOther->OwnerIsMozBrowserOrAppFrame()) {
|
if (!OwnerIsMozBrowserFrame() && aOther->OwnerIsMozBrowserFrame()) {
|
||||||
aOther->DestroyBrowserFrameScripts();
|
aOther->DestroyBrowserFrameScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1884,102 +1870,20 @@ nsFrameLoader::SetOwnerContent(Element* aContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsFrameLoader::OwnerIsMozBrowserOrAppFrame()
|
nsFrameLoader::OwnerIsMozBrowserFrame()
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
||||||
return browserFrame ? browserFrame->GetReallyIsBrowserOrApp() : false;
|
return browserFrame ? browserFrame->GetReallyIsBrowser() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The xpcom getter version
|
// The xpcom getter version
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsFrameLoader::GetOwnerIsMozBrowserOrAppFrame(bool* aResult)
|
nsFrameLoader::GetOwnerIsMozBrowserFrame(bool* aResult)
|
||||||
{
|
{
|
||||||
*aResult = OwnerIsMozBrowserOrAppFrame();
|
*aResult = OwnerIsMozBrowserFrame();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
nsFrameLoader::OwnerIsAppFrame()
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
|
||||||
return browserFrame ? browserFrame->GetReallyIsApp() : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsFrameLoader::OwnerIsMozBrowserFrame()
|
|
||||||
{
|
|
||||||
return OwnerIsMozBrowserOrAppFrame() && !OwnerIsAppFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsFrameLoader::OwnerIsIsolatedMozBrowserFrame()
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
|
||||||
if (!browserFrame) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!OwnerIsMozBrowserFrame()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isolated = browserFrame->GetIsolated();
|
|
||||||
if (isolated) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsFrameLoader::GetOwnerAppManifestURL(nsAString& aOut)
|
|
||||||
{
|
|
||||||
aOut.Truncate();
|
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
|
||||||
if (browserFrame) {
|
|
||||||
browserFrame->GetAppManifestURL(aOut);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<mozIApplication>
|
|
||||||
nsFrameLoader::GetOwnApp()
|
|
||||||
{
|
|
||||||
nsAutoString manifest;
|
|
||||||
GetOwnerAppManifestURL(manifest);
|
|
||||||
if (manifest.IsEmpty()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
|
||||||
NS_ENSURE_TRUE(appsService, nullptr);
|
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> app;
|
|
||||||
appsService->GetAppByManifestURL(manifest, getter_AddRefs(app));
|
|
||||||
|
|
||||||
return app.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<mozIApplication>
|
|
||||||
nsFrameLoader::GetContainingApp()
|
|
||||||
{
|
|
||||||
// See if our owner content's principal has an associated app.
|
|
||||||
uint32_t appId = mOwnerContent->NodePrincipal()->GetAppId();
|
|
||||||
MOZ_ASSERT(appId != nsIScriptSecurityManager::UNKNOWN_APP_ID);
|
|
||||||
|
|
||||||
if (appId == nsIScriptSecurityManager::NO_APP_ID ||
|
|
||||||
appId == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
|
||||||
NS_ENSURE_TRUE(appsService, nullptr);
|
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> app;
|
|
||||||
appsService->GetAppByLocalId(appId, getter_AddRefs(app));
|
|
||||||
|
|
||||||
return app.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsFrameLoader::ShouldUseRemoteProcess()
|
nsFrameLoader::ShouldUseRemoteProcess()
|
||||||
{
|
{
|
||||||
|
|
@ -2003,7 +1907,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
|
||||||
|
|
||||||
// If we're an <iframe mozbrowser> and we don't have a "remote" attribute,
|
// If we're an <iframe mozbrowser> and we don't have a "remote" attribute,
|
||||||
// fall back to the default.
|
// fall back to the default.
|
||||||
if (OwnerIsMozBrowserOrAppFrame() &&
|
if (OwnerIsMozBrowserFrame() &&
|
||||||
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::Remote)) {
|
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::Remote)) {
|
||||||
|
|
||||||
return Preferences::GetBool("dom.ipc.browser_frames.oop_by_default", false);
|
return Preferences::GetBool("dom.ipc.browser_frames.oop_by_default", false);
|
||||||
|
|
@ -2011,7 +1915,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
|
||||||
|
|
||||||
// Otherwise, we're remote if we have "remote=true" and we're either a
|
// Otherwise, we're remote if we have "remote=true" and we're either a
|
||||||
// browser frame or a XUL element.
|
// browser frame or a XUL element.
|
||||||
return (OwnerIsMozBrowserOrAppFrame() ||
|
return (OwnerIsMozBrowserFrame() ||
|
||||||
mOwnerContent->GetNameSpaceID() == kNameSpaceID_XUL) &&
|
mOwnerContent->GetNameSpaceID() == kNameSpaceID_XUL) &&
|
||||||
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
||||||
nsGkAtoms::Remote,
|
nsGkAtoms::Remote,
|
||||||
|
|
@ -2189,13 +2093,13 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||||
// Inherit origin attributes from parent document if
|
// Inherit origin attributes from parent document if
|
||||||
// 1. It's in a content docshell.
|
// 1. It's in a content docshell.
|
||||||
// 2. its nodePrincipal is not a SystemPrincipal.
|
// 2. its nodePrincipal is not a SystemPrincipal.
|
||||||
// 3. It's not a mozbrowser nor mozapp frame.
|
// 3. It's not a mozbrowser frame.
|
||||||
//
|
//
|
||||||
// For example, firstPartyDomain is computed from top-level document, it
|
// For example, firstPartyDomain is computed from top-level document, it
|
||||||
// doesn't exist in the top-level docshell.
|
// doesn't exist in the top-level docshell.
|
||||||
if (parentType == nsIDocShellTreeItem::typeContent &&
|
if (parentType == nsIDocShellTreeItem::typeContent &&
|
||||||
!nsContentUtils::IsSystemPrincipal(doc->NodePrincipal()) &&
|
!nsContentUtils::IsSystemPrincipal(doc->NodePrincipal()) &&
|
||||||
!OwnerIsMozBrowserOrAppFrame()) {
|
!OwnerIsMozBrowserFrame()) {
|
||||||
PrincipalOriginAttributes poa = BasePrincipal::Cast(doc->NodePrincipal())->OriginAttributesRef();
|
PrincipalOriginAttributes poa = BasePrincipal::Cast(doc->NodePrincipal())->OriginAttributesRef();
|
||||||
|
|
||||||
// Assert on the firstPartyDomain from top-level docshell should be empty
|
// Assert on the firstPartyDomain from top-level docshell should be empty
|
||||||
|
|
@ -2210,42 +2114,14 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||||
"docshell and document should have the same appId attribute.");
|
"docshell and document should have the same appId attribute.");
|
||||||
MOZ_ASSERT(attrs.mUserContextId == poa.mUserContextId,
|
MOZ_ASSERT(attrs.mUserContextId == poa.mUserContextId,
|
||||||
"docshell and document should have the same userContextId attribute.");
|
"docshell and document should have the same userContextId attribute.");
|
||||||
MOZ_ASSERT(attrs.mInIsolatedMozBrowser == poa.mInIsolatedMozBrowser,
|
|
||||||
"docshell and document should have the same inIsolatedMozBrowser attribute.");
|
|
||||||
MOZ_ASSERT(attrs.mPrivateBrowsingId == poa.mPrivateBrowsingId,
|
MOZ_ASSERT(attrs.mPrivateBrowsingId == poa.mPrivateBrowsingId,
|
||||||
"docshell and document should have the same privateBrowsingId attribute.");
|
"docshell and document should have the same privateBrowsingId attribute.");
|
||||||
|
|
||||||
attrs.InheritFromDocToChildDocShell(poa);
|
attrs.InheritFromDocToChildDocShell(poa);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OwnerIsAppFrame()) {
|
|
||||||
// You can't be both an app and a browser frame.
|
|
||||||
MOZ_ASSERT(!OwnerIsMozBrowserFrame());
|
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
|
|
||||||
MOZ_ASSERT(ownApp);
|
|
||||||
uint32_t ownAppId = nsIScriptSecurityManager::NO_APP_ID;
|
|
||||||
if (ownApp) {
|
|
||||||
NS_ENSURE_SUCCESS(ownApp->GetLocalId(&ownAppId), NS_ERROR_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
attrs.mAppId = ownAppId;
|
|
||||||
mDocShell->SetFrameType(nsIDocShell::FRAME_TYPE_APP);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OwnerIsMozBrowserFrame()) {
|
if (OwnerIsMozBrowserFrame()) {
|
||||||
// You can't be both a browser and an app frame.
|
attrs.mAppId = nsIScriptSecurityManager::NO_APP_ID;
|
||||||
MOZ_ASSERT(!OwnerIsAppFrame());
|
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> containingApp = GetContainingApp();
|
|
||||||
uint32_t containingAppId = nsIScriptSecurityManager::NO_APP_ID;
|
|
||||||
if (containingApp) {
|
|
||||||
NS_ENSURE_SUCCESS(containingApp->GetLocalId(&containingAppId),
|
|
||||||
NS_ERROR_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
attrs.mAppId = containingAppId;
|
|
||||||
attrs.mInIsolatedMozBrowser = OwnerIsIsolatedMozBrowserFrame();
|
|
||||||
mDocShell->SetFrameType(nsIDocShell::FRAME_TYPE_BROWSER);
|
mDocShell->SetFrameType(nsIDocShell::FRAME_TYPE_BROWSER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2276,7 +2152,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||||
}
|
}
|
||||||
attrs.SyncAttributesWithPrivateBrowsing(isPrivate);
|
attrs.SyncAttributesWithPrivateBrowsing(isPrivate);
|
||||||
|
|
||||||
if (OwnerIsMozBrowserOrAppFrame()) {
|
if (OwnerIsMozBrowserFrame()) {
|
||||||
// For inproc frames, set the docshell properties.
|
// For inproc frames, set the docshell properties.
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
if (mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
|
if (mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
|
||||||
|
|
@ -2675,7 +2551,7 @@ nsFrameLoader::TryRemoteBrowser()
|
||||||
}
|
}
|
||||||
|
|
||||||
// <iframe mozbrowser> gets to skip these checks.
|
// <iframe mozbrowser> gets to skip these checks.
|
||||||
if (!OwnerIsMozBrowserOrAppFrame()) {
|
if (!OwnerIsMozBrowserFrame()) {
|
||||||
if (parentDocShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
|
if (parentDocShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2716,8 +2592,8 @@ nsFrameLoader::TryRemoteBrowser()
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
NS_ENSURE_SUCCESS(rv, false);
|
||||||
|
|
||||||
nsCOMPtr<Element> ownerElement = mOwnerContent;
|
nsCOMPtr<Element> ownerElement = mOwnerContent;
|
||||||
mRemoteBrowser = ContentParent::CreateBrowserOrApp(context, ownerElement,
|
mRemoteBrowser = ContentParent::CreateBrowser(context, ownerElement,
|
||||||
openerContentParent, mFreshProcess);
|
openerContentParent, mFreshProcess);
|
||||||
if (!mRemoteBrowser) {
|
if (!mRemoteBrowser) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2980,7 +2856,7 @@ nsFrameLoader::EnsureMessageManager()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mIsTopLevelContent &&
|
if (!mIsTopLevelContent &&
|
||||||
!OwnerIsMozBrowserOrAppFrame() &&
|
!OwnerIsMozBrowserFrame() &&
|
||||||
!IsRemoteFrame() &&
|
!IsRemoteFrame() &&
|
||||||
!(mOwnerContent->IsXULElement() &&
|
!(mOwnerContent->IsXULElement() &&
|
||||||
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
||||||
|
|
@ -3287,7 +3163,7 @@ nsFrameLoader::GetLoadContext(nsILoadContext** aLoadContext)
|
||||||
void
|
void
|
||||||
nsFrameLoader::InitializeBrowserAPI()
|
nsFrameLoader::InitializeBrowserAPI()
|
||||||
{
|
{
|
||||||
if (!OwnerIsMozBrowserOrAppFrame()) {
|
if (!OwnerIsMozBrowserFrame()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!IsRemoteFrame()) {
|
if (!IsRemoteFrame()) {
|
||||||
|
|
@ -3311,7 +3187,7 @@ nsFrameLoader::InitializeBrowserAPI()
|
||||||
void
|
void
|
||||||
nsFrameLoader::DestroyBrowserFrameScripts()
|
nsFrameLoader::DestroyBrowserFrameScripts()
|
||||||
{
|
{
|
||||||
if (!OwnerIsMozBrowserOrAppFrame()) {
|
if (!OwnerIsMozBrowserFrame()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
||||||
|
|
@ -3392,24 +3268,10 @@ nsresult
|
||||||
nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
|
nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
|
||||||
nsIURI* aURI)
|
nsIURI* aURI)
|
||||||
{
|
{
|
||||||
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
|
|
||||||
nsCOMPtr<mozIApplication> containingApp = GetContainingApp();
|
|
||||||
DocShellOriginAttributes attrs;
|
DocShellOriginAttributes attrs;
|
||||||
attrs.mInIsolatedMozBrowser = OwnerIsIsolatedMozBrowserFrame();
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
// Get the AppId from ownApp
|
attrs.mAppId = nsIScriptSecurityManager::NO_APP_ID; // No longer used...
|
||||||
uint32_t appId = nsIScriptSecurityManager::NO_APP_ID;
|
|
||||||
if (ownApp) {
|
|
||||||
rv = ownApp->GetLocalId(&appId);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
NS_ENSURE_STATE(appId != nsIScriptSecurityManager::NO_APP_ID);
|
|
||||||
} else if (containingApp) {
|
|
||||||
rv = containingApp->GetLocalId(&appId);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
NS_ENSURE_STATE(appId != nsIScriptSecurityManager::NO_APP_ID);
|
|
||||||
}
|
|
||||||
attrs.mAppId = appId;
|
|
||||||
|
|
||||||
// set the userContextId on the attrs before we pass them into
|
// set the userContextId on the attrs before we pass them into
|
||||||
// the tab context
|
// the tab context
|
||||||
|
|
@ -3439,8 +3301,6 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
|
||||||
bool tabContextUpdated =
|
bool tabContextUpdated =
|
||||||
aTabContext->SetTabContext(OwnerIsMozBrowserFrame(),
|
aTabContext->SetTabContext(OwnerIsMozBrowserFrame(),
|
||||||
mIsPrerendered,
|
mIsPrerendered,
|
||||||
ownApp,
|
|
||||||
containingApp,
|
|
||||||
showAccelerators,
|
showAccelerators,
|
||||||
showFocusRings,
|
showFocusRings,
|
||||||
attrs);
|
attrs);
|
||||||
|
|
|
||||||
|
|
@ -241,53 +241,18 @@ private:
|
||||||
*/
|
*/
|
||||||
bool IsRemoteFrame();
|
bool IsRemoteFrame();
|
||||||
|
|
||||||
/**
|
|
||||||
* Is this a frameloader for a bona fide <iframe mozbrowser> or
|
|
||||||
* <iframe mozapp>? (I.e., does the frame return true for
|
|
||||||
* nsIMozBrowserFrame::GetReallyIsBrowserOrApp()?)
|
|
||||||
* <xul:browser> is not a mozbrowser or app, so this is false for that case.
|
|
||||||
*/
|
|
||||||
bool OwnerIsMozBrowserOrAppFrame();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is this a frameloader for a bona fide <iframe mozapp>? (I.e., does the
|
|
||||||
* frame return true for nsIMozBrowserFrame::GetReallyIsApp()?)
|
|
||||||
*/
|
|
||||||
bool OwnerIsAppFrame();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this a frame loader for a bona fide <iframe mozbrowser>?
|
* Is this a frame loader for a bona fide <iframe mozbrowser>?
|
||||||
* <xul:browser> is not a mozbrowser, so this is false for that case.
|
* <xul:browser> is not a mozbrowser, so this is false for that case.
|
||||||
*/
|
*/
|
||||||
bool OwnerIsMozBrowserFrame();
|
bool OwnerIsMozBrowserFrame();
|
||||||
|
|
||||||
/**
|
|
||||||
* Is this a frame loader for an isolated <iframe mozbrowser>?
|
|
||||||
*
|
|
||||||
* By default, mozbrowser frames are isolated. Isolation can be disabled by
|
|
||||||
* setting the frame's noisolation attribute. Disabling isolation is
|
|
||||||
* only allowed if the containing document is chrome.
|
|
||||||
*/
|
|
||||||
bool OwnerIsIsolatedMozBrowserFrame();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get our owning element's app manifest URL, or return the empty string if
|
* Get our owning element's app manifest URL, or return the empty string if
|
||||||
* our owning element doesn't have an app manifest URL.
|
* our owning element doesn't have an app manifest URL.
|
||||||
*/
|
*/
|
||||||
void GetOwnerAppManifestURL(nsAString& aOut);
|
void GetOwnerAppManifestURL(nsAString& aOut);
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the app for our frame. This is the app whose manifest is returned by
|
|
||||||
* GetOwnerAppManifestURL.
|
|
||||||
*/
|
|
||||||
already_AddRefed<mozIApplication> GetOwnApp();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the app which contains this frame. This is the app associated with
|
|
||||||
* the frame element's principal.
|
|
||||||
*/
|
|
||||||
already_AddRefed<mozIApplication> GetContainingApp();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we are an IPC frame, set mRemoteFrame. Otherwise, create and
|
* If we are an IPC frame, set mRemoteFrame. Otherwise, create and
|
||||||
* initialize mDocShell.
|
* initialize mDocShell.
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,6 @@ GK_ATOM(animations, "animations")
|
||||||
GK_ATOM(anonid, "anonid")
|
GK_ATOM(anonid, "anonid")
|
||||||
GK_ATOM(anonlocation, "anonlocation")
|
GK_ATOM(anonlocation, "anonlocation")
|
||||||
GK_ATOM(any, "any")
|
GK_ATOM(any, "any")
|
||||||
GK_ATOM(mozapp, "mozapp")
|
|
||||||
GK_ATOM(applet, "applet")
|
GK_ATOM(applet, "applet")
|
||||||
GK_ATOM(applyImports, "apply-imports")
|
GK_ATOM(applyImports, "apply-imports")
|
||||||
GK_ATOM(applyTemplates, "apply-templates")
|
GK_ATOM(applyTemplates, "apply-templates")
|
||||||
|
|
@ -665,7 +664,6 @@ GK_ATOM(nodeSet, "node-set")
|
||||||
GK_ATOM(noembed, "noembed")
|
GK_ATOM(noembed, "noembed")
|
||||||
GK_ATOM(noframes, "noframes")
|
GK_ATOM(noframes, "noframes")
|
||||||
GK_ATOM(nohref, "nohref")
|
GK_ATOM(nohref, "nohref")
|
||||||
GK_ATOM(noisolation, "noisolation")
|
|
||||||
GK_ATOM(nomodule, "nomodule")
|
GK_ATOM(nomodule, "nomodule")
|
||||||
GK_ATOM(nonce, "nonce")
|
GK_ATOM(nonce, "nonce")
|
||||||
GK_ATOM(none, "none")
|
GK_ATOM(none, "none")
|
||||||
|
|
@ -1003,7 +1001,6 @@ GK_ATOM(panel, "panel")
|
||||||
GK_ATOM(param, "param")
|
GK_ATOM(param, "param")
|
||||||
GK_ATOM(parameter, "parameter")
|
GK_ATOM(parameter, "parameter")
|
||||||
GK_ATOM(parent, "parent")
|
GK_ATOM(parent, "parent")
|
||||||
GK_ATOM(parentapp, "parentapp")
|
|
||||||
GK_ATOM(parentfocused, "parentfocused")
|
GK_ATOM(parentfocused, "parentfocused")
|
||||||
GK_ATOM(parsetype, "parsetype")
|
GK_ATOM(parsetype, "parsetype")
|
||||||
GK_ATOM(password, "password")
|
GK_ATOM(password, "password")
|
||||||
|
|
|
||||||
|
|
@ -4485,7 +4485,7 @@ nsGlobalWindow::GetParentOuter()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> parent;
|
nsCOMPtr<nsPIDOMWindowOuter> parent;
|
||||||
if (mDocShell->GetIsMozBrowserOrApp()) {
|
if (mDocShell->GetIsMozBrowser()) {
|
||||||
parent = AsOuter();
|
parent = AsOuter();
|
||||||
} else {
|
} else {
|
||||||
parent = GetParent();
|
parent = GetParent();
|
||||||
|
|
@ -4543,7 +4543,7 @@ nsGlobalWindow::GetParent()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShell> parent;
|
nsCOMPtr<nsIDocShell> parent;
|
||||||
mDocShell->GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent));
|
mDocShell->GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent));
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> win = parent->GetWindow();
|
nsCOMPtr<nsPIDOMWindowOuter> win = parent->GetWindow();
|
||||||
|
|
@ -4662,9 +4662,9 @@ nsGlobalWindow::GetContentInternal(ErrorResult& aError, bool aUnprivilegedCaller
|
||||||
return domWindow.forget();
|
return domWindow.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're contained in <iframe mozbrowser> or <iframe mozapp>, then
|
// If we're contained in <iframe mozbrowser>, then GetContent is the same as
|
||||||
// GetContent is the same as window.top.
|
// window.top.
|
||||||
if (mDocShell && mDocShell->GetIsInMozBrowserOrApp()) {
|
if (mDocShell && mDocShell->GetIsInMozBrowser()) {
|
||||||
return GetTopOuter();
|
return GetTopOuter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7992,7 +7992,7 @@ nsGlobalWindow::ResizeToOuter(int32_t aWidth, int32_t aHeight, ErrorResult& aErr
|
||||||
* If caller is a browser-element then dispatch a resize event to
|
* If caller is a browser-element then dispatch a resize event to
|
||||||
* the embedder.
|
* the embedder.
|
||||||
*/
|
*/
|
||||||
if (mDocShell && mDocShell->GetIsMozBrowserOrApp()) {
|
if (mDocShell && mDocShell->GetIsMozBrowser()) {
|
||||||
CSSIntSize size(aWidth, aHeight);
|
CSSIntSize size(aWidth, aHeight);
|
||||||
if (!DispatchResizeEvent(size)) {
|
if (!DispatchResizeEvent(size)) {
|
||||||
// The embedder chose to prevent the default action for this
|
// The embedder chose to prevent the default action for this
|
||||||
|
|
@ -8042,7 +8042,7 @@ nsGlobalWindow::ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif,
|
||||||
* If caller is a browser-element then dispatch a resize event to
|
* If caller is a browser-element then dispatch a resize event to
|
||||||
* parent.
|
* parent.
|
||||||
*/
|
*/
|
||||||
if (mDocShell && mDocShell->GetIsMozBrowserOrApp()) {
|
if (mDocShell && mDocShell->GetIsMozBrowser()) {
|
||||||
CSSIntSize size;
|
CSSIntSize size;
|
||||||
if (NS_FAILED(GetInnerSize(size))) {
|
if (NS_FAILED(GetInnerSize(size))) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -9013,7 +9013,7 @@ nsGlobalWindow::CloseOuter(bool aTrustedCaller)
|
||||||
MOZ_RELEASE_ASSERT(IsOuterWindow());
|
MOZ_RELEASE_ASSERT(IsOuterWindow());
|
||||||
|
|
||||||
if (!mDocShell || IsInModalState() ||
|
if (!mDocShell || IsInModalState() ||
|
||||||
(IsFrame() && !mDocShell->GetIsMozBrowserOrApp())) {
|
(IsFrame() && !mDocShell->GetIsMozBrowser())) {
|
||||||
// window.close() is called on a frame in a frameset, on a window
|
// window.close() is called on a frame in a frameset, on a window
|
||||||
// that's already closed, or on a window for which there's
|
// that's already closed, or on a window for which there's
|
||||||
// currently a modal dialog open. Ignore such calls.
|
// currently a modal dialog open. Ignore such calls.
|
||||||
|
|
@ -9034,14 +9034,13 @@ nsGlobalWindow::CloseOuter(bool aTrustedCaller)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow scripts from content to close non-app or non-neterror
|
// Don't allow scripts from content to close non-neterror windows that
|
||||||
// windows that were not opened by script.
|
// were not opened by script.
|
||||||
nsAutoString url;
|
nsAutoString url;
|
||||||
nsresult rv = mDoc->GetURL(url);
|
nsresult rv = mDoc->GetURL(url);
|
||||||
NS_ENSURE_SUCCESS_VOID(rv);
|
NS_ENSURE_SUCCESS_VOID(rv);
|
||||||
|
|
||||||
if (!mDocShell->GetIsApp() &&
|
if (!StringBeginsWith(url, NS_LITERAL_STRING("about:neterror")) &&
|
||||||
!StringBeginsWith(url, NS_LITERAL_STRING("about:neterror")) &&
|
|
||||||
!mHadOriginalOpener && !aTrustedCaller) {
|
!mHadOriginalOpener && !aTrustedCaller) {
|
||||||
bool allowClose = mAllowScriptsToClose ||
|
bool allowClose = mAllowScriptsToClose ||
|
||||||
Preferences::GetBool("dom.allow_scripts_to_close_windows", true);
|
Preferences::GetBool("dom.allow_scripts_to_close_windows", true);
|
||||||
|
|
@ -9489,7 +9488,7 @@ nsGlobalWindow::GetFrameElementOuter(nsIPrincipal& aSubjectPrincipal)
|
||||||
{
|
{
|
||||||
MOZ_RELEASE_ASSERT(IsOuterWindow());
|
MOZ_RELEASE_ASSERT(IsOuterWindow());
|
||||||
|
|
||||||
if (!mDocShell || mDocShell->GetIsMozBrowserOrApp()) {
|
if (!mDocShell || mDocShell->GetIsMozBrowser()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -9524,7 +9523,7 @@ nsGlobalWindow::GetRealFrameElementOuter()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShell> parent;
|
nsCOMPtr<nsIDocShell> parent;
|
||||||
mDocShell->GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent));
|
mDocShell->GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent));
|
||||||
|
|
||||||
if (!parent || parent == mDocShell) {
|
if (!parent || parent == mDocShell) {
|
||||||
// We're at a chrome boundary, don't expose the chrome iframe
|
// We're at a chrome boundary, don't expose the chrome iframe
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
interface mozIApplication;
|
|
||||||
interface nsFrameLoader;
|
interface nsFrameLoader;
|
||||||
interface nsIDocShell;
|
interface nsIDocShell;
|
||||||
interface nsIURI;
|
interface nsIURI;
|
||||||
|
|
@ -216,11 +215,10 @@ interface nsIFrameLoader : nsISupports
|
||||||
[infallible] attribute boolean visible;
|
[infallible] attribute boolean visible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find out whether the owner content really is a mozbrowser or app frame
|
* Find out whether the owner content really is a mozbrowser. <xul:browser>
|
||||||
* Especially, a widget frame is regarded as an app frame. <xul:browser> is
|
* is not considered to be a mozbrowser frame.
|
||||||
* not considered to be a mozbrowser frame.
|
|
||||||
*/
|
*/
|
||||||
readonly attribute boolean ownerIsMozBrowserOrAppFrame;
|
readonly attribute boolean ownerIsMozBrowserFrame;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The last known width of the frame. Reading this property will not trigger
|
* The last known width of the frame. Reading this property will not trigger
|
||||||
|
|
@ -265,12 +263,6 @@ interface nsIFrameLoaderOwner : nsISupports
|
||||||
[binaryname(FrameLoaderXPCOM)] readonly attribute nsIFrameLoader frameLoader;
|
[binaryname(FrameLoaderXPCOM)] readonly attribute nsIFrameLoader frameLoader;
|
||||||
[noscript, notxpcom] alreadyAddRefed_nsFrameLoader GetFrameLoader();
|
[noscript, notxpcom] alreadyAddRefed_nsFrameLoader GetFrameLoader();
|
||||||
|
|
||||||
/**
|
|
||||||
* The principal of parent mozIApplication in case of nested mozbrowser
|
|
||||||
* iframes.
|
|
||||||
*/
|
|
||||||
readonly attribute mozIApplication parentApplication;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puts the FrameLoaderOwner in prerendering mode.
|
* Puts the FrameLoaderOwner in prerendering mode.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -88,21 +88,24 @@ nsInProcessTabChildGlobal::DoSendAsyncMessage(JSContext* aCx,
|
||||||
nsInProcessTabChildGlobal::nsInProcessTabChildGlobal(nsIDocShell* aShell,
|
nsInProcessTabChildGlobal::nsInProcessTabChildGlobal(nsIDocShell* aShell,
|
||||||
nsIContent* aOwner,
|
nsIContent* aOwner,
|
||||||
nsFrameMessageManager* aChrome)
|
nsFrameMessageManager* aChrome)
|
||||||
: mDocShell(aShell), mInitialized(false), mLoadingScript(false),
|
: mDocShell(aShell)
|
||||||
mPreventEventsEscaping(false),
|
, mInitialized(false)
|
||||||
mOwner(aOwner), mChromeMessageManager(aChrome)
|
, mLoadingScript(false)
|
||||||
|
, mPreventEventsEscaping(false)
|
||||||
|
, mOwner(aOwner)
|
||||||
|
, mChromeMessageManager(aChrome)
|
||||||
{
|
{
|
||||||
SetIsNotDOMBinding();
|
SetIsNotDOMBinding();
|
||||||
mozilla::HoldJSObjects(this);
|
mozilla::HoldJSObjects(this);
|
||||||
|
|
||||||
// If owner corresponds to an <iframe mozbrowser> or <iframe mozapp>, we'll
|
// If owner corresponds to an <iframe mozbrowser>, we'll have to tweak our
|
||||||
// GetEventTargetParent implementation.
|
// GetEventTargetParent implementation.
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwner);
|
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwner);
|
||||||
if (browserFrame) {
|
if (browserFrame) {
|
||||||
mIsBrowserOrAppFrame = browserFrame->GetReallyIsBrowserOrApp();
|
mIsBrowserFrame = browserFrame->GetReallyIsBrowser();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mIsBrowserOrAppFrame = false;
|
mIsBrowserFrame = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -272,7 +275,7 @@ nsInProcessTabChildGlobal::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsBrowserOrAppFrame &&
|
if (mIsBrowserFrame &&
|
||||||
(!mOwner || !nsContentUtils::IsInChromeDocshell(mOwner->OwnerDoc()))) {
|
(!mOwner || !nsContentUtils::IsInChromeDocshell(mOwner->OwnerDoc()))) {
|
||||||
if (mOwner) {
|
if (mOwner) {
|
||||||
if (nsPIDOMWindowInner* innerWindow = mOwner->OwnerDoc()->GetInnerWindow()) {
|
if (nsPIDOMWindowInner* innerWindow = mOwner->OwnerDoc()->GetInnerWindow()) {
|
||||||
|
|
|
||||||
|
|
@ -165,10 +165,9 @@ protected:
|
||||||
bool mInitialized;
|
bool mInitialized;
|
||||||
bool mLoadingScript;
|
bool mLoadingScript;
|
||||||
|
|
||||||
// Is this the message manager for an in-process <iframe mozbrowser> or
|
// Is this the message manager for an in-process <iframe mozbrowser>? This
|
||||||
// <iframe mozapp>? This affects where events get sent, so it affects
|
// affects where events get sent, so it affects GetEventTargetParent.
|
||||||
// GetEventTargetParent.
|
bool mIsBrowserFrame;
|
||||||
bool mIsBrowserOrAppFrame;
|
|
||||||
bool mPreventEventsEscaping;
|
bool mPreventEventsEscaping;
|
||||||
|
|
||||||
// We keep a strong reference to the frameloader after we've started
|
// We keep a strong reference to the frameloader after we've started
|
||||||
|
|
|
||||||
|
|
@ -1250,17 +1250,6 @@ nsObjectLoadingContent::GetFrameLoader()
|
||||||
return loader.forget();
|
return loader.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsObjectLoadingContent::GetParentApplication(mozIApplication** aApplication)
|
|
||||||
{
|
|
||||||
if (!aApplication) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aApplication = nullptr;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsObjectLoadingContent::PresetOpenerWindow(mozIDOMWindowProxy* aWindow, mozilla::ErrorResult& aRv)
|
nsObjectLoadingContent::PresetOpenerWindow(mozIDOMWindowProxy* aWindow, mozilla::ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ function parentDocShell(docshell) {
|
||||||
function isTopBrowserElement(docShell) {
|
function isTopBrowserElement(docShell) {
|
||||||
while (docShell) {
|
while (docShell) {
|
||||||
docShell = parentDocShell(docShell);
|
docShell = parentDocShell(docShell);
|
||||||
if (docShell && docShell.isMozBrowserOrApp) {
|
if (docShell && docShell.isMozBrowser) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ var CopyPasteAssistent = {
|
||||||
let targetDocShell = currentWindow
|
let targetDocShell = currentWindow
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIWebNavigation);
|
.getInterface(Ci.nsIWebNavigation);
|
||||||
if(targetDocShell.isMozBrowserOrApp) {
|
if(targetDocShell.isMozBrowser) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,23 +54,6 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote)
|
||||||
|
|
||||||
popupFrameElement->SetMozbrowser(true);
|
popupFrameElement->SetMozbrowser(true);
|
||||||
|
|
||||||
// Copy the opener frame's mozapp attribute to the popup frame.
|
|
||||||
if (aOpenerFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozapp)) {
|
|
||||||
nsAutoString mozapp;
|
|
||||||
aOpenerFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, mozapp);
|
|
||||||
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::mozapp,
|
|
||||||
mozapp, /* aNotify = */ false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy the opener frame's parentApp attribute to the popup frame.
|
|
||||||
if (aOpenerFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::parentapp)) {
|
|
||||||
nsAutoString parentApp;
|
|
||||||
aOpenerFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::parentapp,
|
|
||||||
parentApp);
|
|
||||||
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::parentapp,
|
|
||||||
parentApp, /* aNotify = */ false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy the window name onto the iframe.
|
// Copy the window name onto the iframe.
|
||||||
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::name,
|
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::name,
|
||||||
aName, /* aNotify = */ false);
|
aName, /* aNotify = */ false);
|
||||||
|
|
|
||||||
|
|
@ -1279,9 +1279,9 @@ EventStateManager::IsRemoteTarget(nsIContent* target) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <frame/iframe mozbrowser/mozapp>
|
// <frame/iframe mozbrowser>
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(target);
|
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(target);
|
||||||
if (browserFrame && browserFrame->GetReallyIsBrowserOrApp()) {
|
if (browserFrame && browserFrame->GetReallyIsBrowser()) {
|
||||||
return !!TabParent::GetFrom(target);
|
return !!TabParent::GetFrom(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
#include "AudioChannelService.h"
|
#include "AudioChannelService.h"
|
||||||
|
|
||||||
#include "mozIApplication.h"
|
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsFrameLoader.h"
|
#include "nsFrameLoader.h"
|
||||||
|
|
@ -44,13 +43,13 @@ nsBrowserElement::IsBrowserElementOrThrow(ErrorResult& aRv)
|
||||||
void
|
void
|
||||||
nsBrowserElement::InitBrowserElementAPI()
|
nsBrowserElement::InitBrowserElementAPI()
|
||||||
{
|
{
|
||||||
bool isMozBrowserOrApp;
|
bool isMozBrowser;
|
||||||
nsCOMPtr<nsIFrameLoader> frameLoader = GetFrameLoader();
|
nsCOMPtr<nsIFrameLoader> frameLoader = GetFrameLoader();
|
||||||
NS_ENSURE_TRUE_VOID(frameLoader);
|
NS_ENSURE_TRUE_VOID(frameLoader);
|
||||||
nsresult rv = frameLoader->GetOwnerIsMozBrowserOrAppFrame(&isMozBrowserOrApp);
|
nsresult rv = frameLoader->GetOwnerIsMozBrowserFrame(&isMozBrowser);
|
||||||
NS_ENSURE_SUCCESS_VOID(rv);
|
NS_ENSURE_SUCCESS_VOID(rv);
|
||||||
|
|
||||||
if (!isMozBrowserOrApp) {
|
if (!isMozBrowser) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -495,13 +494,13 @@ nsBrowserElement::GetAllowedAudioChannels(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isMozBrowserOrApp;
|
bool isMozBrowser;
|
||||||
aRv = frameLoader->GetOwnerIsMozBrowserOrAppFrame(&isMozBrowserOrApp);
|
aRv = frameLoader->GetOwnerIsMozBrowserFrame(&isMozBrowser);
|
||||||
if (NS_WARN_IF(aRv.Failed())) {
|
if (NS_WARN_IF(aRv.Failed())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isMozBrowserOrApp) {
|
if (!isMozBrowser) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NS_IMETHOD_(already_AddRefed<nsFrameLoader>) GetFrameLoader() = 0;
|
NS_IMETHOD_(already_AddRefed<nsFrameLoader>) GetFrameLoader() = 0;
|
||||||
NS_IMETHOD GetParentApplication(mozIApplication** aApplication) = 0;
|
|
||||||
|
|
||||||
void InitBrowserElementAPI();
|
void InitBrowserElementAPI();
|
||||||
void DestroyBrowserElementFrameScripts();
|
void DestroyBrowserElementFrameScripts();
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,8 @@
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/ErrorResult.h"
|
#include "mozilla/ErrorResult.h"
|
||||||
#include "GeckoProfiler.h"
|
#include "GeckoProfiler.h"
|
||||||
#include "mozIApplication.h"
|
|
||||||
#include "nsAttrValueInlines.h"
|
#include "nsAttrValueInlines.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsIAppsService.h"
|
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
|
|
@ -191,31 +189,6 @@ nsGenericHTMLFrameElement::GetFrameLoader()
|
||||||
return loader.forget();
|
return loader.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericHTMLFrameElement::GetParentApplication(mozIApplication** aApplication)
|
|
||||||
{
|
|
||||||
if (!aApplication) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aApplication = nullptr;
|
|
||||||
|
|
||||||
nsIPrincipal *principal = NodePrincipal();
|
|
||||||
uint32_t appId = principal->GetAppId();
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
|
||||||
if (NS_WARN_IF(!appsService)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult rv = appsService->GetAppByLocalId(appId, aApplication);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsGenericHTMLFrameElement::PresetOpenerWindow(mozIDOMWindowProxy* aWindow, ErrorResult& aRv)
|
nsGenericHTMLFrameElement::PresetOpenerWindow(mozIDOMWindowProxy* aWindow, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
|
@ -512,144 +485,17 @@ nsGenericHTMLFrameElement::BrowserFramesEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if this frame element really is a mozbrowser or mozapp. (It
|
* Return true if this frame element really is a mozbrowser. (It
|
||||||
* needs to have the right attributes, and its creator must have the right
|
* needs to have the right attributes, and its creator must have the right
|
||||||
* permissions.)
|
* permissions.)
|
||||||
*/
|
*/
|
||||||
/* [infallible] */ nsresult
|
/* [infallible] */ nsresult
|
||||||
nsGenericHTMLFrameElement::GetReallyIsBrowserOrApp(bool *aOut)
|
nsGenericHTMLFrameElement::GetReallyIsBrowser(bool *aOut)
|
||||||
{
|
{
|
||||||
*aOut = mReallyIsBrowser;
|
*aOut = mReallyIsBrowser;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [infallible] */ NS_IMETHODIMP
|
|
||||||
nsGenericHTMLFrameElement::GetReallyIsApp(bool *aOut)
|
|
||||||
{
|
|
||||||
nsAutoString manifestURL;
|
|
||||||
GetAppManifestURL(manifestURL);
|
|
||||||
|
|
||||||
*aOut = !manifestURL.IsEmpty();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
bool NestedEnabled()
|
|
||||||
{
|
|
||||||
static bool sMozNestedEnabled = false;
|
|
||||||
static bool sBoolVarCacheInitialized = false;
|
|
||||||
|
|
||||||
if (!sBoolVarCacheInitialized) {
|
|
||||||
sBoolVarCacheInitialized = true;
|
|
||||||
Preferences::AddBoolVarCache(&sMozNestedEnabled,
|
|
||||||
"dom.ipc.tabs.nested.enabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
return sMozNestedEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
/* [infallible] */ NS_IMETHODIMP
|
|
||||||
nsGenericHTMLFrameElement::GetIsolated(bool *aOut)
|
|
||||||
{
|
|
||||||
*aOut = true;
|
|
||||||
|
|
||||||
if (!nsContentUtils::IsSystemPrincipal(NodePrincipal())) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Isolation is only disabled if the attribute is present
|
|
||||||
*aOut = !HasAttr(kNameSpaceID_None, nsGkAtoms::noisolation);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get manifest url of app.
|
|
||||||
*/
|
|
||||||
void nsGenericHTMLFrameElement::GetManifestURL(nsAString& aManifestURL)
|
|
||||||
{
|
|
||||||
aManifestURL.Truncate();
|
|
||||||
|
|
||||||
nsAutoString manifestURL;
|
|
||||||
GetAttr(kNameSpaceID_None, nsGkAtoms::mozapp, manifestURL);
|
|
||||||
if (manifestURL.IsEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check permission.
|
|
||||||
nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager();
|
|
||||||
NS_ENSURE_TRUE_VOID(permMgr);
|
|
||||||
nsIPrincipal *principal = NodePrincipal();
|
|
||||||
const char* aPermissionType = "embed-apps";
|
|
||||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
|
||||||
nsresult rv = permMgr->TestPermissionFromPrincipal(principal,
|
|
||||||
aPermissionType,
|
|
||||||
&permission);
|
|
||||||
NS_ENSURE_SUCCESS_VOID(rv);
|
|
||||||
if (permission != nsIPermissionManager::ALLOW_ACTION) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
|
||||||
NS_ENSURE_TRUE_VOID(appsService);
|
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> app;
|
|
||||||
appsService->GetAppByManifestURL(manifestURL, getter_AddRefs(app));
|
|
||||||
|
|
||||||
if (!app) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
aManifestURL.Assign(manifestURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericHTMLFrameElement::GetAppManifestURL(nsAString& aOut)
|
|
||||||
{
|
|
||||||
aOut.Truncate();
|
|
||||||
|
|
||||||
// At the moment, you can't be an app without being a browser.
|
|
||||||
if (!nsIMozBrowserFrame::GetReallyIsBrowserOrApp()) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only allow content process to embed an app when nested content
|
|
||||||
// process is enabled.
|
|
||||||
if (!XRE_IsParentProcess() &&
|
|
||||||
!(GetBoolAttr(nsGkAtoms::Remote) && NestedEnabled())){
|
|
||||||
NS_WARNING("Can't embed-apps. Embed-apps is restricted to in-proc apps "
|
|
||||||
"or content processes with nested pref enabled, see bug 1097479");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString appManifestURL;
|
|
||||||
|
|
||||||
GetManifestURL(appManifestURL);
|
|
||||||
|
|
||||||
bool isApp = !appManifestURL.IsEmpty();
|
|
||||||
|
|
||||||
if (!isApp) {
|
|
||||||
// No valid case to get manifest
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isApp) {
|
|
||||||
NS_WARNING("Can not simultaneously be mozapp");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString manifestURL;
|
|
||||||
if (isApp) {
|
|
||||||
manifestURL.Assign(appManifestURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
aOut.Assign(manifestURL);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGenericHTMLFrameElement::DisallowCreateFrameLoader()
|
nsGenericHTMLFrameElement::DisallowCreateFrameLoader()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,8 @@ this.Keyboard = {
|
||||||
this.formMM = null;
|
this.formMM = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ignore notifications that aren't from a BrowserOrApp
|
// Ignore notifications that aren't from a Browser
|
||||||
if (!frameLoader.ownerIsMozBrowserOrAppFrame) {
|
if (!frameLoader.ownerIsMozBrowserFrame) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.initFormsFrameScript(mm);
|
this.initFormsFrameScript(mm);
|
||||||
|
|
|
||||||
|
|
@ -12,44 +12,13 @@ interface nsITabParent;
|
||||||
interface nsIMozBrowserFrame : nsIDOMMozBrowserFrame
|
interface nsIMozBrowserFrame : nsIDOMMozBrowserFrame
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Gets whether this frame really is a browser or app frame.
|
* Gets whether this frame really is a browser frame.
|
||||||
*
|
*
|
||||||
* In order to really be a browser frame, this frame's
|
* In order to really be a browser frame, this frame's
|
||||||
* nsIDOMMozBrowserFrame::mozbrowser attribute must be true, and the frame
|
* nsIDOMMozBrowserFrame::mozbrowser attribute must be true, and the frame
|
||||||
* may have to pass various security checks.
|
* may have to pass various security checks.
|
||||||
*/
|
*/
|
||||||
[infallible] readonly attribute boolean reallyIsBrowserOrApp;
|
[infallible] readonly attribute boolean reallyIsBrowser;
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets whether this frame really is an app frame.
|
|
||||||
*
|
|
||||||
* In order to really be an app frame, this frame must really be a browser
|
|
||||||
* frame (this requirement will go away eventually), and the frame's mozapp
|
|
||||||
* attribute must point to the manifest of a valid app.
|
|
||||||
*/
|
|
||||||
[infallible] readonly attribute boolean reallyIsApp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets whether this frame is an isolated frame.
|
|
||||||
*
|
|
||||||
* By default, browser frames are isolated, meaning they have a principal
|
|
||||||
* where OriginAttributes.mIsInIsolatedMozBrowser == true. This isolates
|
|
||||||
* storage and other origin related items from non-browser apps, xul:browsers,
|
|
||||||
* etc.
|
|
||||||
*
|
|
||||||
* Isolation can be disabled by setting the frame's isolated attribute to
|
|
||||||
* false. Disabling isolation is only allowed if the containing document has
|
|
||||||
* browser permission (or equivalent access).
|
|
||||||
*/
|
|
||||||
[infallible] readonly attribute boolean isolated;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets this frame's app manifest URL, if the frame really is an app frame.
|
|
||||||
* Otherwise, returns the empty string.
|
|
||||||
*
|
|
||||||
* This method is guaranteed not to fail.
|
|
||||||
*/
|
|
||||||
readonly attribute AString appManifestURL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normally, a frame tries to create its frame loader when its src is
|
* Normally, a frame tries to create its frame loader when its src is
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,6 @@ ContentBridgeChild::SendPBrowserConstructor(PBrowserChild* aActor,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
return PContentBridgeChild::SendPBrowserConstructor(aActor,
|
return PContentBridgeChild::SendPBrowserConstructor(aActor,
|
||||||
|
|
@ -85,7 +84,6 @@ ContentBridgeChild::SendPBrowserConstructor(PBrowserChild* aActor,
|
||||||
aContext,
|
aContext,
|
||||||
aChromeFlags,
|
aChromeFlags,
|
||||||
aCpID,
|
aCpID,
|
||||||
aIsForApp,
|
|
||||||
aIsForBrowser);
|
aIsForBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,14 +128,12 @@ ContentBridgeChild::AllocPBrowserChild(const TabId& aTabId,
|
||||||
const IPCTabContext &aContext,
|
const IPCTabContext &aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
return nsIContentChild::AllocPBrowserChild(aTabId,
|
return nsIContentChild::AllocPBrowserChild(aTabId,
|
||||||
aContext,
|
aContext,
|
||||||
aChromeFlags,
|
aChromeFlags,
|
||||||
aCpID,
|
aCpID,
|
||||||
aIsForApp,
|
|
||||||
aIsForBrowser);
|
aIsForBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,7 +149,6 @@ ContentBridgeChild::RecvPBrowserConstructor(PBrowserChild* aActor,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
return ContentChild::GetSingleton()->RecvPBrowserConstructor(aActor,
|
return ContentChild::GetSingleton()->RecvPBrowserConstructor(aActor,
|
||||||
|
|
@ -161,7 +156,6 @@ ContentBridgeChild::RecvPBrowserConstructor(PBrowserChild* aActor,
|
||||||
aContext,
|
aContext,
|
||||||
aChromeFlags,
|
aChromeFlags,
|
||||||
aCpID,
|
aCpID,
|
||||||
aIsForApp,
|
|
||||||
aIsForBrowser);
|
aIsForBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ public:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
|
|
||||||
virtual mozilla::ipc::PFileDescriptorSetChild*
|
virtual mozilla::ipc::PFileDescriptorSetChild*
|
||||||
|
|
@ -60,7 +59,6 @@ protected:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
virtual bool DeallocPBrowserChild(PBrowserChild*) override;
|
virtual bool DeallocPBrowserChild(PBrowserChild*) override;
|
||||||
virtual bool RecvPBrowserConstructor(PBrowserChild* aCctor,
|
virtual bool RecvPBrowserConstructor(PBrowserChild* aCctor,
|
||||||
|
|
@ -68,7 +66,6 @@ protected:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
|
|
||||||
virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override;
|
virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override;
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@ ContentBridgeParent::SendPBrowserConstructor(PBrowserParent* aActor,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
return PContentBridgeParent::SendPBrowserConstructor(aActor,
|
return PContentBridgeParent::SendPBrowserConstructor(aActor,
|
||||||
|
|
@ -110,7 +109,6 @@ ContentBridgeParent::SendPBrowserConstructor(PBrowserParent* aActor,
|
||||||
aContext,
|
aContext,
|
||||||
aChromeFlags,
|
aChromeFlags,
|
||||||
aCpID,
|
aCpID,
|
||||||
aIsForApp,
|
|
||||||
aIsForBrowser);
|
aIsForBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,14 +141,12 @@ ContentBridgeParent::AllocPBrowserParent(const TabId& aTabId,
|
||||||
const IPCTabContext &aContext,
|
const IPCTabContext &aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
return nsIContentParent::AllocPBrowserParent(aTabId,
|
return nsIContentParent::AllocPBrowserParent(aTabId,
|
||||||
aContext,
|
aContext,
|
||||||
aChromeFlags,
|
aChromeFlags,
|
||||||
aCpID,
|
aCpID,
|
||||||
aIsForApp,
|
|
||||||
aIsForBrowser);
|
aIsForBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ public:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
|
|
||||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentBridgeParent)
|
FORWARD_SHMEM_ALLOCATOR_TO(PContentBridgeParent)
|
||||||
|
|
@ -53,10 +52,6 @@ public:
|
||||||
{
|
{
|
||||||
return mChildID;
|
return mChildID;
|
||||||
}
|
}
|
||||||
virtual bool IsForApp() const override
|
|
||||||
{
|
|
||||||
return mIsForApp;
|
|
||||||
}
|
|
||||||
virtual bool IsForBrowser() const override
|
virtual bool IsForBrowser() const override
|
||||||
{
|
{
|
||||||
return mIsForBrowser;
|
return mIsForBrowser;
|
||||||
|
|
@ -75,11 +70,6 @@ protected:
|
||||||
mChildID = aId;
|
mChildID = aId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetIsForApp(bool aIsForApp)
|
|
||||||
{
|
|
||||||
mIsForApp = aIsForApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetIsForBrowser(bool aIsForBrowser)
|
void SetIsForBrowser(bool aIsForBrowser)
|
||||||
{
|
{
|
||||||
mIsForBrowser = aIsForBrowser;
|
mIsForBrowser = aIsForBrowser;
|
||||||
|
|
@ -114,7 +104,6 @@ protected:
|
||||||
const IPCTabContext &aContext,
|
const IPCTabContext &aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
|
|
||||||
virtual bool DeallocPBrowserParent(PBrowserParent*) override;
|
virtual bool DeallocPBrowserParent(PBrowserParent*) override;
|
||||||
|
|
@ -140,7 +129,6 @@ protected: // members
|
||||||
RefPtr<ContentBridgeParent> mSelfRef;
|
RefPtr<ContentBridgeParent> mSelfRef;
|
||||||
Transport* mTransport; // owned
|
Transport* mTransport; // owned
|
||||||
ContentParentId mChildID;
|
ContentParentId mChildID;
|
||||||
bool mIsForApp;
|
|
||||||
bool mIsForBrowser;
|
bool mIsForBrowser;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -556,7 +556,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
||||||
SendBackUpXResources(FileDescriptor(xSocketFd));
|
SendBackUpXResources(FileDescriptor(xSocketFd));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SendGetProcessAttributes(&mID, &mIsForApp, &mIsForBrowser);
|
SendGetProcessAttributes(&mID, &mIsForBrowser);
|
||||||
InitProcessAttributes();
|
InitProcessAttributes();
|
||||||
|
|
||||||
#ifdef NS_PRINTING
|
#ifdef NS_PRINTING
|
||||||
|
|
@ -680,7 +680,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
|
||||||
// We release this ref in DeallocPBrowserChild
|
// We release this ref in DeallocPBrowserChild
|
||||||
RefPtr<TabChild>(newChild).forget().take(),
|
RefPtr<TabChild>(newChild).forget().take(),
|
||||||
tabId, *ipcContext, aChromeFlags,
|
tabId, *ipcContext, aChromeFlags,
|
||||||
GetID(), IsForApp(), IsForBrowser());
|
GetID(), IsForBrowser());
|
||||||
|
|
||||||
nsString name(aName);
|
nsString name(aName);
|
||||||
nsAutoCString features(aFeatures);
|
nsAutoCString features(aFeatures);
|
||||||
|
|
@ -1273,14 +1273,12 @@ ContentChild::AllocPBrowserChild(const TabId& aTabId,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
return nsIContentChild::AllocPBrowserChild(aTabId,
|
return nsIContentChild::AllocPBrowserChild(aTabId,
|
||||||
aContext,
|
aContext,
|
||||||
aChromeFlags,
|
aChromeFlags,
|
||||||
aCpID,
|
aCpID,
|
||||||
aIsForApp,
|
|
||||||
aIsForBrowser);
|
aIsForBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1290,7 +1288,6 @@ ContentChild::SendPBrowserConstructor(PBrowserChild* aActor,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
if (IsShuttingDown()) {
|
if (IsShuttingDown()) {
|
||||||
|
|
@ -1302,7 +1299,6 @@ ContentChild::SendPBrowserConstructor(PBrowserChild* aActor,
|
||||||
aContext,
|
aContext,
|
||||||
aChromeFlags,
|
aChromeFlags,
|
||||||
aCpID,
|
aCpID,
|
||||||
aIsForApp,
|
|
||||||
aIsForBrowser);
|
aIsForBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1312,7 +1308,6 @@ ContentChild::RecvPBrowserConstructor(PBrowserChild* aActor,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!IsShuttingDown());
|
MOZ_ASSERT(!IsShuttingDown());
|
||||||
|
|
@ -1339,7 +1334,6 @@ ContentChild::RecvPBrowserConstructor(PBrowserChild* aActor,
|
||||||
// Redo InitProcessAttributes() when the app or browser is really
|
// Redo InitProcessAttributes() when the app or browser is really
|
||||||
// launching so the attributes will be correct.
|
// launching so the attributes will be correct.
|
||||||
mID = aCpID;
|
mID = aCpID;
|
||||||
mIsForApp = aIsForApp;
|
|
||||||
mIsForBrowser = aIsForBrowser;
|
mIsForBrowser = aIsForBrowser;
|
||||||
InitProcessAttributes();
|
InitProcessAttributes();
|
||||||
}
|
}
|
||||||
|
|
@ -2125,7 +2119,7 @@ ContentChild::RecvAppInit()
|
||||||
// PreloadSlowThings() may set the docshell of the first TabChild
|
// PreloadSlowThings() may set the docshell of the first TabChild
|
||||||
// inactive, and we can only safely restore it to active from
|
// inactive, and we can only safely restore it to active from
|
||||||
// BrowserElementChild.js.
|
// BrowserElementChild.js.
|
||||||
if (mIsForApp || mIsForBrowser) {
|
if (mIsForBrowser) {
|
||||||
PreloadSlowThings();
|
PreloadSlowThings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,6 @@ public:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
|
|
||||||
virtual bool DeallocPBrowserChild(PBrowserChild*) override;
|
virtual bool DeallocPBrowserChild(PBrowserChild*) override;
|
||||||
|
|
@ -483,7 +482,6 @@ public:
|
||||||
uint32_t GetMsaaID() const { return mMsaaID; }
|
uint32_t GetMsaaID() const { return mMsaaID; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool IsForApp() const { return mIsForApp; }
|
|
||||||
bool IsForBrowser() const { return mIsForBrowser; }
|
bool IsForBrowser() const { return mIsForBrowser; }
|
||||||
|
|
||||||
virtual PBlobChild*
|
virtual PBlobChild*
|
||||||
|
|
@ -504,7 +502,6 @@ public:
|
||||||
const IPCTabContext& context,
|
const IPCTabContext& context,
|
||||||
const uint32_t& chromeFlags,
|
const uint32_t& chromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
|
|
||||||
virtual bool RecvPBrowserConstructor(PBrowserChild* aCctor,
|
virtual bool RecvPBrowserConstructor(PBrowserChild* aCctor,
|
||||||
|
|
@ -512,7 +509,6 @@ public:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
|
|
||||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentChild)
|
FORWARD_SHMEM_ALLOCATOR_TO(PContentChild)
|
||||||
|
|
@ -618,7 +614,6 @@ private:
|
||||||
|
|
||||||
AppInfo mAppInfo;
|
AppInfo mAppInfo;
|
||||||
|
|
||||||
bool mIsForApp;
|
|
||||||
bool mIsForBrowser;
|
bool mIsForBrowser;
|
||||||
bool mCanOverrideProcessName;
|
bool mCanOverrideProcessName;
|
||||||
bool mIsAlive;
|
bool mIsAlive;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
#include "HandlerServiceParent.h"
|
#include "HandlerServiceParent.h"
|
||||||
#include "IHistory.h"
|
#include "IHistory.h"
|
||||||
#include "imgIContainer.h"
|
#include "imgIContainer.h"
|
||||||
#include "mozIApplication.h"
|
|
||||||
#if defined(XP_WIN) && defined(ACCESSIBILITY)
|
#if defined(XP_WIN) && defined(ACCESSIBILITY)
|
||||||
#include "mozilla/a11y/AccessibleWrap.h"
|
#include "mozilla/a11y/AccessibleWrap.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -460,8 +459,7 @@ ContentParentsMemoryReporter::CollectReports(
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDataHashtable<nsStringHashKey, ContentParent*>* ContentParent::sAppContentParents;
|
nsTArray<ContentParent*>* ContentParent::sBrowserContentParents;
|
||||||
nsTArray<ContentParent*>* ContentParent::sNonAppContentParents;
|
|
||||||
nsTArray<ContentParent*>* ContentParent::sLargeAllocationContentParents;
|
nsTArray<ContentParent*>* ContentParent::sLargeAllocationContentParents;
|
||||||
nsTArray<ContentParent*>* ContentParent::sPrivateContent;
|
nsTArray<ContentParent*>* ContentParent::sPrivateContent;
|
||||||
StaticAutoPtr<LinkedList<ContentParent> > ContentParent::sContentParents;
|
StaticAutoPtr<LinkedList<ContentParent> > ContentParent::sContentParents;
|
||||||
|
|
@ -477,11 +475,6 @@ static bool sDisableUnsafeCPOWWarnings = false;
|
||||||
// The first content child has ID 1, so the chrome process can have ID 0.
|
// The first content child has ID 1, so the chrome process can have ID 0.
|
||||||
static uint64_t gContentChildID = 1;
|
static uint64_t gContentChildID = 1;
|
||||||
|
|
||||||
// We want the prelaunched process to know that it's for apps, but not
|
|
||||||
// actually for any app in particular. Use a magic manifest URL.
|
|
||||||
// Can't be a static constant.
|
|
||||||
#define MAGIC_PREALLOCATED_APP_MANIFEST_URL NS_LITERAL_STRING("{{template}}")
|
|
||||||
|
|
||||||
static const char* sObserverTopics[] = {
|
static const char* sObserverTopics[] = {
|
||||||
"xpcom-shutdown",
|
"xpcom-shutdown",
|
||||||
"profile-before-change",
|
"profile-before-change",
|
||||||
|
|
@ -507,8 +500,7 @@ static const char* sObserverTopics[] = {
|
||||||
ContentParent::PreallocateAppProcess()
|
ContentParent::PreallocateAppProcess()
|
||||||
{
|
{
|
||||||
RefPtr<ContentParent> process =
|
RefPtr<ContentParent> process =
|
||||||
new ContentParent(/* app = */ nullptr,
|
new ContentParent(/* aOpener = */ nullptr,
|
||||||
/* aOpener = */ nullptr,
|
|
||||||
/* isForBrowserElement = */ false,
|
/* isForBrowserElement = */ false,
|
||||||
/* isForPreallocated = */ true);
|
/* isForPreallocated = */ true);
|
||||||
|
|
||||||
|
|
@ -520,57 +512,6 @@ ContentParent::PreallocateAppProcess()
|
||||||
return process.forget();
|
return process.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ already_AddRefed<ContentParent>
|
|
||||||
ContentParent::GetNewOrPreallocatedAppProcess(mozIApplication* aApp,
|
|
||||||
ProcessPriority aInitialPriority,
|
|
||||||
ContentParent* aOpener,
|
|
||||||
/*out*/ bool* aTookPreAllocated)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aApp);
|
|
||||||
RefPtr<ContentParent> process = PreallocatedProcessManager::Take();
|
|
||||||
|
|
||||||
if (process) {
|
|
||||||
if (!process->SetPriorityAndCheckIsAlive(aInitialPriority)) {
|
|
||||||
// Kill the process just in case it's not actually dead; we don't want
|
|
||||||
// to "leak" this process!
|
|
||||||
process->KillHard("GetNewOrPreallocatedAppProcess");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nsAutoString manifestURL;
|
|
||||||
if (NS_FAILED(aApp->GetManifestURL(manifestURL))) {
|
|
||||||
NS_ERROR("Failed to get manifest URL");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
process->TransformPreallocatedIntoApp(aOpener, manifestURL);
|
|
||||||
process->ForwardKnownInfo();
|
|
||||||
|
|
||||||
if (aTookPreAllocated) {
|
|
||||||
*aTookPreAllocated = true;
|
|
||||||
}
|
|
||||||
return process.forget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_WARNING("Unable to use pre-allocated app process");
|
|
||||||
process = new ContentParent(aApp,
|
|
||||||
/* aOpener = */ aOpener,
|
|
||||||
/* isForBrowserElement = */ false,
|
|
||||||
/* isForPreallocated = */ false);
|
|
||||||
|
|
||||||
if (!process->LaunchSubprocess(aInitialPriority)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
process->Init();
|
|
||||||
process->ForwardKnownInfo();
|
|
||||||
|
|
||||||
if (aTookPreAllocated) {
|
|
||||||
*aTookPreAllocated = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return process.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void
|
/*static*/ void
|
||||||
ContentParent::StartUp()
|
ContentParent::StartUp()
|
||||||
{
|
{
|
||||||
|
|
@ -672,10 +613,10 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
|
||||||
|
|
||||||
maxContentParents = Preferences::GetInt("dom.ipc.dedicatedProcessCount", 2);
|
maxContentParents = Preferences::GetInt("dom.ipc.dedicatedProcessCount", 2);
|
||||||
} else {
|
} else {
|
||||||
if (!sNonAppContentParents) {
|
if (!sBrowserContentParents) {
|
||||||
sNonAppContentParents = new nsTArray<ContentParent*>();
|
sBrowserContentParents = new nsTArray<ContentParent*>();
|
||||||
}
|
}
|
||||||
contentParents = sNonAppContentParents;
|
contentParents = sBrowserContentParents;
|
||||||
|
|
||||||
maxContentParents = Preferences::GetInt("dom.ipc.processCount", 1);
|
maxContentParents = Preferences::GetInt("dom.ipc.processCount", 1);
|
||||||
}
|
}
|
||||||
|
|
@ -691,7 +632,7 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
|
||||||
uint32_t currIdx = startIdx;
|
uint32_t currIdx = startIdx;
|
||||||
do {
|
do {
|
||||||
RefPtr<ContentParent> p = (*contentParents)[currIdx];
|
RefPtr<ContentParent> p = (*contentParents)[currIdx];
|
||||||
NS_ASSERTION(p->IsAlive(), "Non-alive contentparent in sNonAppContntParents?");
|
NS_ASSERTION(p->IsAlive(), "Non-alive contentparent in sBrowserContntParents?");
|
||||||
if (p->mOpener == aOpener) {
|
if (p->mOpener == aOpener) {
|
||||||
return p.forget();
|
return p.forget();
|
||||||
}
|
}
|
||||||
|
|
@ -705,8 +646,7 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
|
||||||
p->TransformPreallocatedIntoBrowser(aOpener);
|
p->TransformPreallocatedIntoBrowser(aOpener);
|
||||||
} else {
|
} else {
|
||||||
// Failed in using the preallocated process: fork from the chrome process.
|
// Failed in using the preallocated process: fork from the chrome process.
|
||||||
p = new ContentParent(/* app = */ nullptr,
|
p = new ContentParent(aOpener,
|
||||||
aOpener,
|
|
||||||
aForBrowserElement,
|
aForBrowserElement,
|
||||||
/* isForPreallocated = */ false);
|
/* isForPreallocated = */ false);
|
||||||
|
|
||||||
|
|
@ -782,7 +722,6 @@ ContentParent::RecvCreateChildProcess(const IPCTabContext& aContext,
|
||||||
const hal::ProcessPriority& aPriority,
|
const hal::ProcessPriority& aPriority,
|
||||||
const TabId& aOpenerTabId,
|
const TabId& aOpenerTabId,
|
||||||
ContentParentId* aCpId,
|
ContentParentId* aCpId,
|
||||||
bool* aIsForApp,
|
|
||||||
bool* aIsForBrowser,
|
bool* aIsForBrowser,
|
||||||
TabId* aTabId)
|
TabId* aTabId)
|
||||||
{
|
{
|
||||||
|
|
@ -800,24 +739,16 @@ ContentParent::RecvCreateChildProcess(const IPCTabContext& aContext,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> ownApp = tc.GetTabContext().GetOwnApp();
|
cp = GetNewOrUsedBrowserProcess(/* isBrowserElement = */ true,
|
||||||
if (ownApp) {
|
aPriority, this);
|
||||||
cp = GetNewOrPreallocatedAppProcess(ownApp, aPriority, this);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cp = GetNewOrUsedBrowserProcess(/* isBrowserElement = */ true,
|
|
||||||
aPriority, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cp) {
|
if (!cp) {
|
||||||
*aCpId = 0;
|
*aCpId = 0;
|
||||||
*aIsForApp = false;
|
|
||||||
*aIsForBrowser = false;
|
*aIsForBrowser = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
*aCpId = cp->ChildID();
|
*aCpId = cp->ChildID();
|
||||||
*aIsForApp = cp->IsForApp();
|
|
||||||
*aIsForBrowser = cp->IsForBrowser();
|
*aIsForBrowser = cp->IsForBrowser();
|
||||||
|
|
||||||
ContentProcessManager *cpm = ContentProcessManager::GetSingleton();
|
ContentProcessManager *cpm = ContentProcessManager::GetSingleton();
|
||||||
|
|
@ -950,10 +881,10 @@ ContentParent::RecvFindPlugins(const uint32_t& aPluginEpoch,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ TabParent*
|
/*static*/ TabParent*
|
||||||
ContentParent::CreateBrowserOrApp(const TabContext& aContext,
|
ContentParent::CreateBrowser(const TabContext& aContext,
|
||||||
Element* aFrameElement,
|
Element* aFrameElement,
|
||||||
ContentParent* aOpenerContentParent,
|
ContentParent* aOpenerContentParent,
|
||||||
bool aFreshProcess)
|
bool aFreshProcess)
|
||||||
{
|
{
|
||||||
PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
|
PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
|
||||||
|
|
||||||
|
|
@ -976,222 +907,74 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
|
||||||
openerTabId = TabParent::GetTabIdFrom(docShell);
|
openerTabId = TabParent::GetTabIdFrom(docShell);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aContext.IsMozBrowserElement() || !aContext.HasOwnApp()) {
|
RefPtr<nsIContentParent> constructorSender;
|
||||||
RefPtr<nsIContentParent> constructorSender;
|
|
||||||
if (isInContentProcess) {
|
|
||||||
MOZ_ASSERT(aContext.IsMozBrowserElement());
|
|
||||||
constructorSender = CreateContentBridgeParent(aContext, initialPriority,
|
|
||||||
openerTabId, &tabId);
|
|
||||||
} else {
|
|
||||||
if (aOpenerContentParent) {
|
|
||||||
constructorSender = aOpenerContentParent;
|
|
||||||
} else {
|
|
||||||
constructorSender =
|
|
||||||
GetNewOrUsedBrowserProcess(aContext.IsMozBrowserElement(),
|
|
||||||
initialPriority,
|
|
||||||
nullptr,
|
|
||||||
aFreshProcess);
|
|
||||||
if (!constructorSender) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tabId = AllocateTabId(openerTabId,
|
|
||||||
aContext.AsIPCTabContext(),
|
|
||||||
constructorSender->ChildID());
|
|
||||||
}
|
|
||||||
if (constructorSender) {
|
|
||||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
|
||||||
docShell->GetTreeOwner(getter_AddRefs(treeOwner));
|
|
||||||
if (!treeOwner) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIWebBrowserChrome> wbc = do_GetInterface(treeOwner);
|
|
||||||
if (!wbc) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
uint32_t chromeFlags = 0;
|
|
||||||
wbc->GetChromeFlags(&chromeFlags);
|
|
||||||
|
|
||||||
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell);
|
|
||||||
if (loadContext && loadContext->UsePrivateBrowsing()) {
|
|
||||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
|
||||||
}
|
|
||||||
if (docShell->GetAffectPrivateSessionLifetime()) {
|
|
||||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tabId == 0) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
RefPtr<TabParent> tp(new TabParent(constructorSender, tabId,
|
|
||||||
aContext, chromeFlags));
|
|
||||||
tp->SetInitedByParent();
|
|
||||||
|
|
||||||
PBrowserParent* browser =
|
|
||||||
constructorSender->SendPBrowserConstructor(
|
|
||||||
// DeallocPBrowserParent() releases this ref.
|
|
||||||
tp.forget().take(), tabId,
|
|
||||||
aContext.AsIPCTabContext(),
|
|
||||||
chromeFlags,
|
|
||||||
constructorSender->ChildID(),
|
|
||||||
constructorSender->IsForApp(),
|
|
||||||
constructorSender->IsForBrowser());
|
|
||||||
|
|
||||||
if (aFreshProcess) {
|
|
||||||
Unused << browser->SendSetFreshProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser) {
|
|
||||||
RefPtr<TabParent> constructedTabParent = TabParent::GetFrom(browser);
|
|
||||||
constructedTabParent->SetOwnerElement(aFrameElement);
|
|
||||||
return constructedTabParent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we got here, we have an app and we're not a browser element. ownApp
|
|
||||||
// shouldn't be null, because we otherwise would have gone into the
|
|
||||||
// !HasOwnApp() branch above.
|
|
||||||
RefPtr<nsIContentParent> parent;
|
|
||||||
bool reused = false;
|
|
||||||
bool tookPreallocated = false;
|
|
||||||
nsAutoString manifestURL;
|
|
||||||
|
|
||||||
if (isInContentProcess) {
|
if (isInContentProcess) {
|
||||||
parent = CreateContentBridgeParent(aContext,
|
MOZ_ASSERT(aContext.IsMozBrowserElement());
|
||||||
initialPriority,
|
constructorSender = CreateContentBridgeParent(aContext, initialPriority,
|
||||||
openerTabId,
|
openerTabId, &tabId);
|
||||||
&tabId);
|
} else {
|
||||||
}
|
constructorSender =
|
||||||
else {
|
GetNewOrUsedBrowserProcess(aContext.IsMozBrowserElement(),
|
||||||
nsCOMPtr<mozIApplication> ownApp = aContext.GetOwnApp();
|
initialPriority, nullptr, aFreshProcess);
|
||||||
|
if (!constructorSender) {
|
||||||
if (!sAppContentParents) {
|
return nullptr;
|
||||||
sAppContentParents =
|
|
||||||
new nsDataHashtable<nsStringHashKey, ContentParent*>();
|
|
||||||
}
|
}
|
||||||
|
tabId = AllocateTabId(openerTabId,
|
||||||
|
aContext.AsIPCTabContext(),
|
||||||
|
constructorSender->ChildID());
|
||||||
|
}
|
||||||
|
|
||||||
// Each app gets its own ContentParent instance unless it shares it with
|
if (constructorSender) {
|
||||||
// a parent app.
|
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||||
if (NS_FAILED(ownApp->GetManifestURL(manifestURL))) {
|
docShell->GetTreeOwner(getter_AddRefs(treeOwner));
|
||||||
NS_ERROR("Failed to get manifest URL");
|
if (!treeOwner) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<ContentParent> p = sAppContentParents->Get(manifestURL);
|
nsCOMPtr<nsIWebBrowserChrome> wbc = do_GetInterface(treeOwner);
|
||||||
|
if (!wbc) {
|
||||||
if (!p && Preferences::GetBool("dom.ipc.reuse_parent_app")) {
|
return nullptr;
|
||||||
nsAutoString parentAppManifestURL;
|
|
||||||
aFrameElement->GetAttr(kNameSpaceID_None,
|
|
||||||
nsGkAtoms::parentapp, parentAppManifestURL);
|
|
||||||
nsAdoptingString systemAppManifestURL =
|
|
||||||
Preferences::GetString("b2g.system_manifest_url");
|
|
||||||
nsCOMPtr<nsIAppsService> appsService =
|
|
||||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
|
||||||
if (!parentAppManifestURL.IsEmpty() &&
|
|
||||||
!parentAppManifestURL.Equals(systemAppManifestURL) &&
|
|
||||||
appsService) {
|
|
||||||
nsCOMPtr<mozIApplication> parentApp;
|
|
||||||
nsCOMPtr<mozIApplication> app;
|
|
||||||
appsService->GetAppByManifestURL(parentAppManifestURL,
|
|
||||||
getter_AddRefs(parentApp));
|
|
||||||
appsService->GetAppByManifestURL(manifestURL,
|
|
||||||
getter_AddRefs(app));
|
|
||||||
|
|
||||||
// Only let certified apps re-use the same process.
|
|
||||||
unsigned short parentAppStatus = 0;
|
|
||||||
unsigned short appStatus = 0;
|
|
||||||
if (app &&
|
|
||||||
NS_SUCCEEDED(app->GetAppStatus(&appStatus)) &&
|
|
||||||
appStatus == nsIPrincipal::APP_STATUS_CERTIFIED &&
|
|
||||||
parentApp &&
|
|
||||||
NS_SUCCEEDED(parentApp->GetAppStatus(&parentAppStatus)) &&
|
|
||||||
parentAppStatus == nsIPrincipal::APP_STATUS_CERTIFIED) {
|
|
||||||
// Check if we can re-use the process of the parent app.
|
|
||||||
p = sAppContentParents->Get(parentAppManifestURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p) {
|
uint32_t chromeFlags = 0;
|
||||||
// Check that the process is still alive and set its priority.
|
wbc->GetChromeFlags(&chromeFlags);
|
||||||
// Hopefully the process won't die after this point, if this call
|
|
||||||
// succeeds.
|
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell);
|
||||||
if (!p->SetPriorityAndCheckIsAlive(initialPriority)) {
|
if (loadContext && loadContext->UsePrivateBrowsing()) {
|
||||||
p = nullptr;
|
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reused = !!p;
|
if (docShell->GetAffectPrivateSessionLifetime()) {
|
||||||
if (!p) {
|
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME;
|
||||||
p = GetNewOrPreallocatedAppProcess(ownApp, initialPriority, nullptr,
|
|
||||||
&tookPreallocated);
|
|
||||||
MOZ_ASSERT(p);
|
|
||||||
sAppContentParents->Put(manifestURL, p);
|
|
||||||
}
|
|
||||||
tabId = AllocateTabId(openerTabId, aContext.AsIPCTabContext(),
|
|
||||||
p->ChildID());
|
|
||||||
parent = static_cast<nsIContentParent*>(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!parent || (tabId == 0)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t chromeFlags = 0;
|
|
||||||
|
|
||||||
RefPtr<TabParent> tp = new TabParent(parent, tabId, aContext, chromeFlags);
|
|
||||||
tp->SetInitedByParent();
|
|
||||||
PBrowserParent* browser = parent->SendPBrowserConstructor(
|
|
||||||
// DeallocPBrowserParent() releases this ref.
|
|
||||||
RefPtr<TabParent>(tp).forget().take(),
|
|
||||||
tabId,
|
|
||||||
aContext.AsIPCTabContext(),
|
|
||||||
chromeFlags,
|
|
||||||
parent->ChildID(),
|
|
||||||
parent->IsForApp(),
|
|
||||||
parent->IsForBrowser());
|
|
||||||
|
|
||||||
if (aFreshProcess) {
|
|
||||||
Unused << browser->SendSetFreshProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser) {
|
|
||||||
RefPtr<TabParent> constructedTabParent = TabParent::GetFrom(browser);
|
|
||||||
constructedTabParent->SetOwnerElement(aFrameElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isInContentProcess) {
|
|
||||||
// Just return directly without the following check in content process.
|
|
||||||
return TabParent::GetFrom(browser);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!browser) {
|
|
||||||
// We failed to actually start the PBrowser. This can happen if the
|
|
||||||
// other process has already died.
|
|
||||||
if (!reused) {
|
|
||||||
// Don't leave a broken ContentParent in the hashtable.
|
|
||||||
parent->AsContentParent()->KillHard("CreateBrowserOrApp");
|
|
||||||
sAppContentParents->Remove(manifestURL);
|
|
||||||
parent = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we took the preallocated process and it was already dead, try
|
if (tabId == 0) {
|
||||||
// again with a non-preallocated process. We can be sure this won't
|
return nullptr;
|
||||||
// loop forever, because the next time through there will be no
|
}
|
||||||
// preallocated process to take.
|
RefPtr<TabParent> tp(new TabParent(constructorSender, tabId,
|
||||||
if (tookPreallocated) {
|
aContext, chromeFlags));
|
||||||
return ContentParent::CreateBrowserOrApp(aContext, aFrameElement,
|
tp->SetInitedByParent();
|
||||||
aOpenerContentParent);
|
|
||||||
|
PBrowserParent* browser =
|
||||||
|
constructorSender->SendPBrowserConstructor(
|
||||||
|
// DeallocPBrowserParent() releases this ref.
|
||||||
|
tp.forget().take(), tabId,
|
||||||
|
aContext.AsIPCTabContext(),
|
||||||
|
chromeFlags,
|
||||||
|
constructorSender->ChildID(),
|
||||||
|
constructorSender->IsForBrowser());
|
||||||
|
|
||||||
|
if (aFreshProcess) {
|
||||||
|
Unused << browser->SendSetFreshProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise just give up.
|
if (browser) {
|
||||||
return nullptr;
|
RefPtr<TabParent> constructedTabParent = TabParent::GetFrom(browser);
|
||||||
|
constructedTabParent->SetOwnerElement(aFrameElement);
|
||||||
|
return constructedTabParent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
return TabParent::GetFrom(browser);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ ContentBridgeParent*
|
/*static*/ ContentBridgeParent*
|
||||||
|
|
@ -1204,13 +987,11 @@ ContentParent::CreateContentBridgeParent(const TabContext& aContext,
|
||||||
|
|
||||||
ContentChild* child = ContentChild::GetSingleton();
|
ContentChild* child = ContentChild::GetSingleton();
|
||||||
ContentParentId cpId;
|
ContentParentId cpId;
|
||||||
bool isForApp;
|
|
||||||
bool isForBrowser;
|
bool isForBrowser;
|
||||||
if (!child->SendCreateChildProcess(aContext.AsIPCTabContext(),
|
if (!child->SendCreateChildProcess(aContext.AsIPCTabContext(),
|
||||||
aPriority,
|
aPriority,
|
||||||
aOpenerTabId,
|
aOpenerTabId,
|
||||||
&cpId,
|
&cpId,
|
||||||
&isForApp,
|
|
||||||
&isForBrowser,
|
&isForBrowser,
|
||||||
aTabId)) {
|
aTabId)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -1223,7 +1004,6 @@ ContentParent::CreateContentBridgeParent(const TabContext& aContext,
|
||||||
}
|
}
|
||||||
ContentBridgeParent* parent = child->GetLastBridge();
|
ContentBridgeParent* parent = child->GetLastBridge();
|
||||||
parent->SetChildID(cpId);
|
parent->SetChildID(cpId);
|
||||||
parent->SetIsForApp(isForApp);
|
|
||||||
parent->SetIsForBrowser(isForBrowser);
|
parent->SetIsForBrowser(isForBrowser);
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
@ -1344,48 +1124,12 @@ ContentParent::SetPriorityAndCheckIsAlive(ProcessPriority aPriority)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for ContentParent::TransformPreallocatedIntoApp.
|
|
||||||
static void
|
|
||||||
TryGetNameFromManifestURL(const nsAString& aManifestURL,
|
|
||||||
nsAString& aName)
|
|
||||||
{
|
|
||||||
aName.Truncate();
|
|
||||||
if (aManifestURL.IsEmpty() ||
|
|
||||||
aManifestURL == MAGIC_PREALLOCATED_APP_MANIFEST_URL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
|
||||||
NS_ENSURE_TRUE_VOID(appsService);
|
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> app;
|
|
||||||
appsService->GetAppByManifestURL(aManifestURL, getter_AddRefs(app));
|
|
||||||
|
|
||||||
if (!app) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
app->GetName(aName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ContentParent::TransformPreallocatedIntoApp(ContentParent* aOpener,
|
|
||||||
const nsAString& aAppManifestURL)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsPreallocated());
|
|
||||||
mMetamorphosed = true;
|
|
||||||
mOpener = aOpener;
|
|
||||||
mAppManifestURL = aAppManifestURL;
|
|
||||||
TryGetNameFromManifestURL(aAppManifestURL, mAppName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ContentParent::TransformPreallocatedIntoBrowser(ContentParent* aOpener)
|
ContentParent::TransformPreallocatedIntoBrowser(ContentParent* aOpener)
|
||||||
{
|
{
|
||||||
// Reset mAppManifestURL, mIsForBrowser and mOSPrivileges for browser.
|
// Reset mIsForBrowser and mOSPrivileges for browser.
|
||||||
mMetamorphosed = true;
|
mMetamorphosed = true;
|
||||||
mOpener = aOpener;
|
mOpener = aOpener;
|
||||||
mAppManifestURL.Truncate();
|
|
||||||
mIsForBrowser = true;
|
mIsForBrowser = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1472,29 +1216,19 @@ ContentParent::ShutDownMessageManager()
|
||||||
void
|
void
|
||||||
ContentParent::MarkAsDead()
|
ContentParent::MarkAsDead()
|
||||||
{
|
{
|
||||||
if (!mAppManifestURL.IsEmpty()) {
|
if (sBrowserContentParents) {
|
||||||
if (sAppContentParents) {
|
sBrowserContentParents->RemoveElement(this);
|
||||||
sAppContentParents->Remove(mAppManifestURL);
|
if (!sBrowserContentParents->Length()) {
|
||||||
if (!sAppContentParents->Count()) {
|
delete sBrowserContentParents;
|
||||||
delete sAppContentParents;
|
sBrowserContentParents = nullptr;
|
||||||
sAppContentParents = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (sNonAppContentParents) {
|
|
||||||
sNonAppContentParents->RemoveElement(this);
|
|
||||||
if (!sNonAppContentParents->Length()) {
|
|
||||||
delete sNonAppContentParents;
|
|
||||||
sNonAppContentParents = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sLargeAllocationContentParents) {
|
if (sLargeAllocationContentParents) {
|
||||||
sLargeAllocationContentParents->RemoveElement(this);
|
sLargeAllocationContentParents->RemoveElement(this);
|
||||||
if (!sLargeAllocationContentParents->Length()) {
|
if (!sLargeAllocationContentParents->Length()) {
|
||||||
delete sLargeAllocationContentParents;
|
delete sLargeAllocationContentParents;
|
||||||
sLargeAllocationContentParents = nullptr;
|
sLargeAllocationContentParents = nullptr;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1797,7 +1531,7 @@ ContentParent::NotifyTabDestroying(const TabId& aTabId,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t numberOfParents = sNonAppContentParents ? sNonAppContentParents->Length() : 0;
|
uint32_t numberOfParents = sBrowserContentParents ? sBrowserContentParents->Length() : 0;
|
||||||
int32_t processesToKeepAlive = Preferences::GetInt("dom.ipc.keepProcessesAlive", 0);
|
int32_t processesToKeepAlive = Preferences::GetInt("dom.ipc.keepProcessesAlive", 0);
|
||||||
if (!cp->mLargeAllocationProcess && static_cast<int32_t>(numberOfParents) <= processesToKeepAlive) {
|
if (!cp->mLargeAllocationProcess && static_cast<int32_t>(numberOfParents) <= processesToKeepAlive) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -1854,7 +1588,7 @@ ContentParent::NotifyTabDestroyed(const TabId& aTabId,
|
||||||
|
|
||||||
// We might want to keep alive some content processes for testing, because of performance
|
// We might want to keep alive some content processes for testing, because of performance
|
||||||
// reasons, but we don't want to alter behavior if the pref is not set.
|
// reasons, but we don't want to alter behavior if the pref is not set.
|
||||||
uint32_t numberOfParents = sNonAppContentParents ? sNonAppContentParents->Length() : 0;
|
uint32_t numberOfParents = sBrowserContentParents ? sBrowserContentParents->Length() : 0;
|
||||||
int32_t processesToKeepAlive = Preferences::GetInt("dom.ipc.keepProcessesAlive", 0);
|
int32_t processesToKeepAlive = Preferences::GetInt("dom.ipc.keepProcessesAlive", 0);
|
||||||
bool shouldKeepAliveAny = !mLargeAllocationProcess && processesToKeepAlive > 0;
|
bool shouldKeepAliveAny = !mLargeAllocationProcess && processesToKeepAlive > 0;
|
||||||
bool shouldKeepAliveThis = shouldKeepAliveAny && static_cast<int32_t>(numberOfParents) <= processesToKeepAlive;
|
bool shouldKeepAliveThis = shouldKeepAliveAny && static_cast<int32_t>(numberOfParents) <= processesToKeepAlive;
|
||||||
|
|
@ -1948,20 +1682,20 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentParent::ContentParent(mozIApplication* aApp,
|
ContentParent::ContentParent(ContentParent* aOpener,
|
||||||
ContentParent* aOpener,
|
|
||||||
bool aIsForBrowser,
|
bool aIsForBrowser,
|
||||||
bool aIsForPreallocated)
|
bool aIsForPreallocated)
|
||||||
: nsIContentParent()
|
: nsIContentParent()
|
||||||
, mOpener(aOpener)
|
, mOpener(aOpener)
|
||||||
, mIsForBrowser(aIsForBrowser)
|
, mIsForBrowser(aIsForBrowser)
|
||||||
|
, mIsPreallocated(aIsForPreallocated)
|
||||||
, mLargeAllocationProcess(false)
|
, mLargeAllocationProcess(false)
|
||||||
{
|
{
|
||||||
InitializeMembers(); // Perform common initialization.
|
InitializeMembers(); // Perform common initialization.
|
||||||
|
|
||||||
// No more than one of !!aApp, aIsForBrowser, aIsForPreallocated should be
|
// No more than one of aIsForBrowser, aIsForPreallocated should be
|
||||||
// true.
|
// true.
|
||||||
MOZ_ASSERT(!!aApp + aIsForBrowser + aIsForPreallocated <= 1);
|
MOZ_ASSERT(aIsForBrowser + aIsForPreallocated <= 1);
|
||||||
|
|
||||||
mMetamorphosed = true;
|
mMetamorphosed = true;
|
||||||
|
|
||||||
|
|
@ -1971,13 +1705,6 @@ ContentParent::ContentParent(mozIApplication* aApp,
|
||||||
}
|
}
|
||||||
sContentParents->insertBack(this);
|
sContentParents->insertBack(this);
|
||||||
|
|
||||||
if (aApp) {
|
|
||||||
aApp->GetManifestURL(mAppManifestURL);
|
|
||||||
aApp->GetName(mAppName);
|
|
||||||
} else if (aIsForPreallocated) {
|
|
||||||
mAppManifestURL = MAGIC_PREALLOCATED_APP_MANIFEST_URL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// From this point on, NS_WARNING, NS_ASSERTION, etc. should print out the
|
// From this point on, NS_WARNING, NS_ASSERTION, etc. should print out the
|
||||||
// PID along with the warning.
|
// PID along with the warning.
|
||||||
nsDebugImpl::SetMultiprocessMode("Parent");
|
nsDebugImpl::SetMultiprocessMode("Parent");
|
||||||
|
|
@ -2004,19 +1731,10 @@ ContentParent::~ContentParent()
|
||||||
|
|
||||||
// We should be removed from all these lists in ActorDestroy.
|
// We should be removed from all these lists in ActorDestroy.
|
||||||
MOZ_ASSERT(!sPrivateContent || !sPrivateContent->Contains(this));
|
MOZ_ASSERT(!sPrivateContent || !sPrivateContent->Contains(this));
|
||||||
if (mAppManifestURL.IsEmpty()) {
|
MOZ_ASSERT((!sBrowserContentParents ||
|
||||||
MOZ_ASSERT((!sNonAppContentParents ||
|
!sBrowserContentParents->Contains(this)) &&
|
||||||
!sNonAppContentParents->Contains(this)) &&
|
(!sLargeAllocationContentParents ||
|
||||||
(!sLargeAllocationContentParents ||
|
!sLargeAllocationContentParents->Contains(this)));
|
||||||
!sLargeAllocationContentParents->Contains(this)));
|
|
||||||
} else {
|
|
||||||
// In general, we expect sAppContentParents->Get(mAppManifestURL) to be
|
|
||||||
// nullptr. But it could be that we created another ContentParent for
|
|
||||||
// this app after we did this->ActorDestroy(), so the right check is
|
|
||||||
// that sAppContentParents->Get(mAppManifestURL) != this.
|
|
||||||
MOZ_ASSERT(!sAppContentParents ||
|
|
||||||
sAppContentParents->Get(mAppManifestURL) != this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2152,12 +1870,6 @@ ContentParent::IsAlive() const
|
||||||
return mIsAlive;
|
return mIsAlive;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
ContentParent::IsForApp() const
|
|
||||||
{
|
|
||||||
return !mAppManifestURL.IsEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
ContentParent::Pid() const
|
ContentParent::Pid() const
|
||||||
{
|
{
|
||||||
|
|
@ -2585,10 +2297,9 @@ ContentParent::AllocPProcessHangMonitorParent(Transport* aTransport,
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ContentParent::RecvGetProcessAttributes(ContentParentId* aCpId,
|
ContentParent::RecvGetProcessAttributes(ContentParentId* aCpId,
|
||||||
bool* aIsForApp, bool* aIsForBrowser)
|
bool* aIsForBrowser)
|
||||||
{
|
{
|
||||||
*aCpId = mChildID;
|
*aCpId = mChildID;
|
||||||
*aIsForApp = IsForApp();
|
|
||||||
*aIsForBrowser = mIsForBrowser;
|
*aIsForBrowser = mIsForBrowser;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2697,14 +2408,12 @@ ContentParent::AllocPBrowserParent(const TabId& aTabId,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpId,
|
const ContentParentId& aCpId,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
return nsIContentParent::AllocPBrowserParent(aTabId,
|
return nsIContentParent::AllocPBrowserParent(aTabId,
|
||||||
aContext,
|
aContext,
|
||||||
aChromeFlags,
|
aChromeFlags,
|
||||||
aCpId,
|
aCpId,
|
||||||
aIsForApp,
|
|
||||||
aIsForBrowser);
|
aIsForBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2805,7 +2514,7 @@ ContentParent::KillHard(const char* aReason)
|
||||||
bool
|
bool
|
||||||
ContentParent::IsPreallocated() const
|
ContentParent::IsPreallocated() const
|
||||||
{
|
{
|
||||||
return mAppManifestURL == MAGIC_PREALLOCATED_APP_MANIFEST_URL;
|
return mIsPreallocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2818,11 +2527,6 @@ ContentParent::FriendlyName(nsAString& aName, bool aAnonymize)
|
||||||
aName.AssignLiteral("Browser");
|
aName.AssignLiteral("Browser");
|
||||||
} else if (aAnonymize) {
|
} else if (aAnonymize) {
|
||||||
aName.AssignLiteral("<anonymized-name>");
|
aName.AssignLiteral("<anonymized-name>");
|
||||||
} else if (!mAppName.IsEmpty()) {
|
|
||||||
aName = mAppName;
|
|
||||||
} else if (!mAppManifestURL.IsEmpty()) {
|
|
||||||
aName.AssignLiteral("Unknown app: ");
|
|
||||||
aName.Append(mAppManifestURL);
|
|
||||||
} else {
|
} else {
|
||||||
aName.AssignLiteral("???");
|
aName.AssignLiteral("???");
|
||||||
}
|
}
|
||||||
|
|
@ -3659,7 +3363,6 @@ ContentParent::SendPBrowserConstructor(PBrowserParent* aActor,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpId,
|
const ContentParentId& aCpId,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
return PContentParent::SendPBrowserConstructor(aActor,
|
return PContentParent::SendPBrowserConstructor(aActor,
|
||||||
|
|
@ -3667,7 +3370,6 @@ ContentParent::SendPBrowserConstructor(PBrowserParent* aActor,
|
||||||
aContext,
|
aContext,
|
||||||
aChromeFlags,
|
aChromeFlags,
|
||||||
aCpId,
|
aCpId,
|
||||||
aIsForApp,
|
|
||||||
aIsForBrowser);
|
aIsForBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3785,12 +3487,9 @@ ContentParent::RecvRecordingDeviceEvents(const nsString& aRecordingStatus,
|
||||||
// recording-device-ipc-events needs to gather more information from content process
|
// recording-device-ipc-events needs to gather more information from content process
|
||||||
RefPtr<nsHashPropertyBag> props = new nsHashPropertyBag();
|
RefPtr<nsHashPropertyBag> props = new nsHashPropertyBag();
|
||||||
props->SetPropertyAsUint64(NS_LITERAL_STRING("childID"), ChildID());
|
props->SetPropertyAsUint64(NS_LITERAL_STRING("childID"), ChildID());
|
||||||
props->SetPropertyAsBool(NS_LITERAL_STRING("isApp"), IsForApp());
|
|
||||||
props->SetPropertyAsBool(NS_LITERAL_STRING("isAudio"), aIsAudio);
|
props->SetPropertyAsBool(NS_LITERAL_STRING("isAudio"), aIsAudio);
|
||||||
props->SetPropertyAsBool(NS_LITERAL_STRING("isVideo"), aIsVideo);
|
props->SetPropertyAsBool(NS_LITERAL_STRING("isVideo"), aIsVideo);
|
||||||
|
props->SetPropertyAsAString(NS_LITERAL_STRING("requestURL"), aPageURL);
|
||||||
nsString requestURL = IsForApp() ? AppManifestURL() : aPageURL;
|
|
||||||
props->SetPropertyAsAString(NS_LITERAL_STRING("requestURL"), requestURL);
|
|
||||||
|
|
||||||
obs->NotifyObservers((nsIPropertyBag2*) props,
|
obs->NotifyObservers((nsIPropertyBag2*) props,
|
||||||
"recording-device-ipc-events",
|
"recording-device-ipc-events",
|
||||||
|
|
@ -4245,7 +3944,7 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
|
||||||
thisTabParent = TabParent::GetFrom(aThisTab);
|
thisTabParent = TabParent::GetFrom(aThisTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_WARN_IF(thisTabParent && thisTabParent->IsMozBrowserOrApp())) {
|
if (NS_WARN_IF(thisTabParent && thisTabParent->IsMozBrowser())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,10 +140,10 @@ public:
|
||||||
* associated.
|
* associated.
|
||||||
*/
|
*/
|
||||||
static TabParent*
|
static TabParent*
|
||||||
CreateBrowserOrApp(const TabContext& aContext,
|
CreateBrowser(const TabContext& aContext,
|
||||||
Element* aFrameElement,
|
Element* aFrameElement,
|
||||||
ContentParent* aOpenerContentParent,
|
ContentParent* aOpenerContentParent,
|
||||||
bool aFreshProcess = false);
|
bool aFreshProcess = false);
|
||||||
|
|
||||||
static void GetAll(nsTArray<ContentParent*>& aArray);
|
static void GetAll(nsTArray<ContentParent*>& aArray);
|
||||||
|
|
||||||
|
|
@ -231,7 +231,6 @@ public:
|
||||||
const hal::ProcessPriority& aPriority,
|
const hal::ProcessPriority& aPriority,
|
||||||
const TabId& aOpenerTabId,
|
const TabId& aOpenerTabId,
|
||||||
ContentParentId* aCpId,
|
ContentParentId* aCpId,
|
||||||
bool* aIsForApp,
|
|
||||||
bool* aIsForBrowser,
|
bool* aIsForBrowser,
|
||||||
TabId* aTabId) override;
|
TabId* aTabId) override;
|
||||||
|
|
||||||
|
|
@ -322,8 +321,6 @@ public:
|
||||||
|
|
||||||
bool IsAlive() const;
|
bool IsAlive() const;
|
||||||
|
|
||||||
virtual bool IsForApp() const override;
|
|
||||||
|
|
||||||
virtual bool IsForBrowser() const override
|
virtual bool IsForBrowser() const override
|
||||||
{
|
{
|
||||||
return mIsForBrowser;
|
return mIsForBrowser;
|
||||||
|
|
@ -356,8 +353,6 @@ public:
|
||||||
|
|
||||||
ContentParentId ChildID() const override { return mChildID; }
|
ContentParentId ChildID() const override { return mChildID; }
|
||||||
|
|
||||||
const nsString& AppManifestURL() const { return mAppManifestURL; }
|
|
||||||
|
|
||||||
bool IsPreallocated() const;
|
bool IsPreallocated() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -545,8 +540,7 @@ protected:
|
||||||
void OnCompositorUnexpectedShutdown() override;
|
void OnCompositorUnexpectedShutdown() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static nsDataHashtable<nsStringHashKey, ContentParent*> *sAppContentParents;
|
static nsTArray<ContentParent*>* sBrowserContentParents;
|
||||||
static nsTArray<ContentParent*>* sNonAppContentParents;
|
|
||||||
static nsTArray<ContentParent*>* sLargeAllocationContentParents;
|
static nsTArray<ContentParent*>* sLargeAllocationContentParents;
|
||||||
static nsTArray<ContentParent*>* sPrivateContent;
|
static nsTArray<ContentParent*>* sPrivateContent;
|
||||||
static StaticAutoPtr<LinkedList<ContentParent> > sContentParents;
|
static StaticAutoPtr<LinkedList<ContentParent> > sContentParents;
|
||||||
|
|
@ -554,15 +548,6 @@ private:
|
||||||
static void JoinProcessesIOThread(const nsTArray<ContentParent*>* aProcesses,
|
static void JoinProcessesIOThread(const nsTArray<ContentParent*>* aProcesses,
|
||||||
Monitor* aMonitor, bool* aDone);
|
Monitor* aMonitor, bool* aDone);
|
||||||
|
|
||||||
// Take the preallocated process and transform it into a "real" app process,
|
|
||||||
// for the specified manifest URL. If there is no preallocated process (or
|
|
||||||
// if it's dead), create a new one and set aTookPreAllocated to false.
|
|
||||||
static already_AddRefed<ContentParent>
|
|
||||||
GetNewOrPreallocatedAppProcess(mozIApplication* aApp,
|
|
||||||
hal::ProcessPriority aInitialPriority,
|
|
||||||
ContentParent* aOpener,
|
|
||||||
/*out*/ bool* aTookPreAllocated = nullptr);
|
|
||||||
|
|
||||||
static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);
|
static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);
|
||||||
|
|
||||||
static ContentBridgeParent* CreateContentBridgeParent(const TabContext& aContext,
|
static ContentBridgeParent* CreateContentBridgeParent(const TabContext& aContext,
|
||||||
|
|
@ -578,16 +563,14 @@ private:
|
||||||
const IPCTabContext& context,
|
const IPCTabContext& context,
|
||||||
const uint32_t& chromeFlags,
|
const uint32_t& chromeFlags,
|
||||||
const ContentParentId& aCpId,
|
const ContentParentId& aCpId,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
using PContentParent::SendPTestShellConstructor;
|
using PContentParent::SendPTestShellConstructor;
|
||||||
|
|
||||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
|
FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
|
||||||
|
|
||||||
// No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated may be
|
// No more than one of aIsForBrowser, and aIsForPreallocated may be
|
||||||
// true.
|
// true.
|
||||||
ContentParent(mozIApplication* aApp,
|
ContentParent(ContentParent* aOpener,
|
||||||
ContentParent* aOpener,
|
|
||||||
bool aIsForBrowser,
|
bool aIsForBrowser,
|
||||||
bool aIsForPreallocated);
|
bool aIsForPreallocated);
|
||||||
|
|
||||||
|
|
@ -609,7 +592,7 @@ private:
|
||||||
|
|
||||||
// Some information could be sent to content very early, it
|
// Some information could be sent to content very early, it
|
||||||
// should be send from this function. This function should only be
|
// should be send from this function. This function should only be
|
||||||
// called after the process has been transformed to app or browser.
|
// called after the process has been transformed to browser.
|
||||||
void ForwardKnownInfo();
|
void ForwardKnownInfo();
|
||||||
|
|
||||||
// Set the child process's priority and then check whether the child is
|
// Set the child process's priority and then check whether the child is
|
||||||
|
|
@ -618,11 +601,6 @@ private:
|
||||||
// unlikely that the process will be killed after this point.
|
// unlikely that the process will be killed after this point.
|
||||||
bool SetPriorityAndCheckIsAlive(hal::ProcessPriority aPriority);
|
bool SetPriorityAndCheckIsAlive(hal::ProcessPriority aPriority);
|
||||||
|
|
||||||
// Transform a pre-allocated app process into a "real" app
|
|
||||||
// process, for the specified manifest URL.
|
|
||||||
void TransformPreallocatedIntoApp(ContentParent* aOpener,
|
|
||||||
const nsAString& aAppManifestURL);
|
|
||||||
|
|
||||||
// Transform a pre-allocated app process into a browser process. If this
|
// Transform a pre-allocated app process into a browser process. If this
|
||||||
// returns false, the child process has died.
|
// returns false, the child process has died.
|
||||||
void TransformPreallocatedIntoBrowser(ContentParent* aOpener);
|
void TransformPreallocatedIntoBrowser(ContentParent* aOpener);
|
||||||
|
|
@ -687,7 +665,6 @@ private:
|
||||||
ProcessId aOtherProcess) override;
|
ProcessId aOtherProcess) override;
|
||||||
|
|
||||||
virtual bool RecvGetProcessAttributes(ContentParentId* aCpId,
|
virtual bool RecvGetProcessAttributes(ContentParentId* aCpId,
|
||||||
bool* aIsForApp,
|
|
||||||
bool* aIsForBrowser) override;
|
bool* aIsForBrowser) override;
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
|
|
@ -712,7 +689,6 @@ private:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpId,
|
const ContentParentId& aCpId,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) override;
|
const bool& aIsForBrowser) override;
|
||||||
|
|
||||||
virtual bool DeallocPBrowserParent(PBrowserParent* frame) override;
|
virtual bool DeallocPBrowserParent(PBrowserParent* frame) override;
|
||||||
|
|
@ -1048,17 +1024,8 @@ private:
|
||||||
ContentParentId mChildID;
|
ContentParentId mChildID;
|
||||||
int32_t mGeolocationWatchID;
|
int32_t mGeolocationWatchID;
|
||||||
|
|
||||||
nsString mAppManifestURL;
|
|
||||||
|
|
||||||
nsCString mKillHardAnnotation;
|
nsCString mKillHardAnnotation;
|
||||||
|
|
||||||
/**
|
|
||||||
* We cache mAppName instead of looking it up using mAppManifestURL when we
|
|
||||||
* need it because it turns out that getting an app from the apps service is
|
|
||||||
* expensive.
|
|
||||||
*/
|
|
||||||
nsString mAppName;
|
|
||||||
|
|
||||||
// After we initiate shutdown, we also start a timer to ensure
|
// After we initiate shutdown, we also start a timer to ensure
|
||||||
// that even content processes that are 100% blocked (say from
|
// that even content processes that are 100% blocked (say from
|
||||||
// SIGSTOP), are still killed eventually. This task enforces that
|
// SIGSTOP), are still killed eventually. This task enforces that
|
||||||
|
|
@ -1074,12 +1041,13 @@ private:
|
||||||
// through.
|
// through.
|
||||||
bool mIsAlive;
|
bool mIsAlive;
|
||||||
|
|
||||||
// True only the if process is already a browser or app or has
|
// True only the if process is already a browser or has
|
||||||
// been transformed into one.
|
// been transformed into one.
|
||||||
bool mMetamorphosed;
|
bool mMetamorphosed;
|
||||||
|
|
||||||
bool mSendPermissionUpdates;
|
bool mSendPermissionUpdates;
|
||||||
bool mIsForBrowser;
|
bool mIsForBrowser;
|
||||||
|
bool mIsPreallocated;
|
||||||
|
|
||||||
// These variables track whether we've called Close() and KillHard() on our
|
// These variables track whether we've called Close() and KillHard() on our
|
||||||
// channel.
|
// channel.
|
||||||
|
|
|
||||||
|
|
@ -353,19 +353,5 @@ ContentProcessManager::GetTabParentsByProcessId(const ContentParentId& aChildCpI
|
||||||
return Move(tabIdList);
|
return Move(tabIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
|
||||||
ContentProcessManager::GetAppIdByProcessAndTabId(const ContentParentId& aChildCpId,
|
|
||||||
const TabId& aChildTabId)
|
|
||||||
{
|
|
||||||
uint32_t appId = nsIScriptSecurityManager::NO_APP_ID;
|
|
||||||
if (aChildCpId && aChildTabId) {
|
|
||||||
TabContext tabContext;
|
|
||||||
if (GetTabContextByProcessAndTabId(aChildCpId, aChildTabId, &tabContext)) {
|
|
||||||
appId = tabContext.OwnOrContainingAppId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return appId;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
||||||
|
|
@ -142,15 +142,6 @@ public:
|
||||||
GetTopLevelTabParentByProcessAndTabId(const ContentParentId& aChildCpId,
|
GetTopLevelTabParentByProcessAndTabId(const ContentParentId& aChildCpId,
|
||||||
const TabId& aChildTabId);
|
const TabId& aChildTabId);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return appId by given TabId and ContentParentId.
|
|
||||||
* It will return nsIScriptSecurityManager::NO_APP_ID
|
|
||||||
* if the given tab is not an app.
|
|
||||||
*/
|
|
||||||
uint32_t
|
|
||||||
GetAppIdByProcessAndTabId(const ContentParentId& aChildCpId,
|
|
||||||
const TabId& aChildTabId);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static StaticAutoPtr<ContentProcessManager> sSingleton;
|
static StaticAutoPtr<ContentProcessManager> sSingleton;
|
||||||
TabId mUniqueId;
|
TabId mUniqueId;
|
||||||
|
|
|
||||||
|
|
@ -272,27 +272,20 @@ both:
|
||||||
// The child creates the PBrowser as part of
|
// The child creates the PBrowser as part of
|
||||||
// TabChild::BrowserFrameProvideWindow (which happens when the child's
|
// TabChild::BrowserFrameProvideWindow (which happens when the child's
|
||||||
// content calls window.open()), and the parent creates the PBrowser as part
|
// content calls window.open()), and the parent creates the PBrowser as part
|
||||||
// of ContentParent::CreateBrowserOrApp.
|
// of ContentParent::CreateBrowser.
|
||||||
//
|
//
|
||||||
// When the parent constructs a PBrowser, the child trusts the app token and
|
// When the parent constructs a PBrowser, the child trusts the attributes it
|
||||||
// other attributes it receives from the parent. In that case, the
|
// receives from the parent. In that case, the context should be
|
||||||
// context should be FrameIPCTabContext.
|
// FrameIPCTabContext.
|
||||||
//
|
//
|
||||||
// When the child constructs a PBrowser, the parent doesn't trust the app
|
// When the child constructs a PBrowser, the parent doesn't trust the
|
||||||
// token it receives from the child. In this case, context must have type
|
// attributes it receives from the child. In this case, context must have
|
||||||
// PopupIPCTabContext. The browser created using a PopupIPCTabContext has
|
// type PopupIPCTabContext. The parent checks that if the opener is a
|
||||||
// the opener PBrowser's app-id and containing-app-id. The parent checks
|
// browser element, the context is also for a browser element.
|
||||||
// that if the opener is a browser element, the context is also for a
|
|
||||||
// browser element.
|
|
||||||
//
|
|
||||||
// This allows the parent to prevent a malicious child from escalating its
|
|
||||||
// privileges by requesting a PBrowser corresponding to a highly-privileged
|
|
||||||
// app; the child can only request privileges for an app which the child has
|
|
||||||
// access to (in the form of a TabChild).
|
|
||||||
//
|
//
|
||||||
// Keep the last 3 attributes in sync with GetProcessAttributes!
|
// Keep the last 3 attributes in sync with GetProcessAttributes!
|
||||||
async PBrowser(TabId tabId, IPCTabContext context, uint32_t chromeFlags,
|
async PBrowser(TabId tabId, IPCTabContext context, uint32_t chromeFlags,
|
||||||
ContentParentId cpId, bool isForApp, bool isForBrowser);
|
ContentParentId cpId, bool isForBrowser);
|
||||||
|
|
||||||
async PBlob(BlobConstructorParams params);
|
async PBlob(BlobConstructorParams params);
|
||||||
|
|
||||||
|
|
@ -535,15 +528,13 @@ parent:
|
||||||
* startup. (The message is sync to allow the content process to
|
* startup. (The message is sync to allow the content process to
|
||||||
* control when it receives the information.)
|
* control when it receives the information.)
|
||||||
*
|
*
|
||||||
* |id| is a unique ID among all subprocesses. When |isForApp &&
|
* |id| is a unique ID among all subprocesses. When
|
||||||
* isForBrowser|, we're loading <browser> for an app. When
|
* |isForBrowser|, we're loading <browser> or <xul:browser remote>.
|
||||||
* |isForBrowser|, we're loading <browser>. When |!isForApp &&
|
|
||||||
* !isForBrowser|, we're probably loading <xul:browser remote>.
|
|
||||||
*
|
*
|
||||||
* Keep the return values in sync with PBrowser()!
|
* Keep the return values in sync with PBrowser()!
|
||||||
*/
|
*/
|
||||||
sync GetProcessAttributes()
|
sync GetProcessAttributes()
|
||||||
returns (ContentParentId cpId, bool isForApp, bool isForBrowser);
|
returns (ContentParentId cpId, bool isForBrowser);
|
||||||
sync GetXPCOMProcessAttributes()
|
sync GetXPCOMProcessAttributes()
|
||||||
returns (bool isOffline, bool isConnected, int32_t captivePortalState,
|
returns (bool isOffline, bool isConnected, int32_t captivePortalState,
|
||||||
bool isLangRTL,
|
bool isLangRTL,
|
||||||
|
|
@ -556,7 +547,7 @@ parent:
|
||||||
sync CreateChildProcess(IPCTabContext context,
|
sync CreateChildProcess(IPCTabContext context,
|
||||||
ProcessPriority priority,
|
ProcessPriority priority,
|
||||||
TabId openerTabId)
|
TabId openerTabId)
|
||||||
returns (ContentParentId cpId, bool isForApp, bool isForBrowser, TabId tabId);
|
returns (ContentParentId cpId, bool isForBrowser, TabId tabId);
|
||||||
sync BridgeToChildProcess(ContentParentId cpId);
|
sync BridgeToChildProcess(ContentParentId cpId);
|
||||||
|
|
||||||
#ifdef MOZ_GMP
|
#ifdef MOZ_GMP
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ both:
|
||||||
// Both the parent and the child can construct the PBrowser.
|
// Both the parent and the child can construct the PBrowser.
|
||||||
// See the comment in PContent::PBrowser().
|
// See the comment in PContent::PBrowser().
|
||||||
async PBrowser(TabId tabId, IPCTabContext context, uint32_t chromeFlags,
|
async PBrowser(TabId tabId, IPCTabContext context, uint32_t chromeFlags,
|
||||||
ContentParentId cpId, bool isForApp, bool isForBrowser);
|
ContentParentId cpId, bool isForBrowser);
|
||||||
|
|
||||||
async PBlob(BlobConstructorParams params);
|
async PBlob(BlobConstructorParams params);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,6 @@ struct FrameIPCTabContext
|
||||||
// The originAttributes dictionary.
|
// The originAttributes dictionary.
|
||||||
DocShellOriginAttributes originAttributes;
|
DocShellOriginAttributes originAttributes;
|
||||||
|
|
||||||
// The ID of the app containing this app/browser frame, if applicable.
|
|
||||||
uint32_t frameOwnerAppId;
|
|
||||||
|
|
||||||
// Whether this is a mozbrowser frame. <iframe mozbrowser mozapp> and
|
// Whether this is a mozbrowser frame. <iframe mozbrowser mozapp> and
|
||||||
// <xul:browser> are not considered to be mozbrowser frames.
|
// <xul:browser> are not considered to be mozbrowser frames.
|
||||||
bool isMozBrowserElement;
|
bool isMozBrowserElement;
|
||||||
|
|
|
||||||
|
|
@ -860,10 +860,10 @@ ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(nsISupports* aSubjec
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore notifications that aren't from a BrowserOrApp
|
// Ignore notifications that aren't from a Browser
|
||||||
bool isMozBrowserOrApp;
|
bool isMozBrowser;
|
||||||
fl->GetOwnerIsMozBrowserOrAppFrame(&isMozBrowserOrApp);
|
fl->GetOwnerIsMozBrowserFrame(&isMozBrowser);
|
||||||
if (isMozBrowserOrApp) {
|
if (isMozBrowser) {
|
||||||
ResetPriority();
|
ResetPriority();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -410,7 +410,7 @@ TabChild::Create(nsIContentChild* aManager,
|
||||||
{
|
{
|
||||||
if (sPreallocatedTab &&
|
if (sPreallocatedTab &&
|
||||||
sPreallocatedTab->mChromeFlags == aChromeFlags &&
|
sPreallocatedTab->mChromeFlags == aChromeFlags &&
|
||||||
aContext.IsMozBrowserOrApp()) {
|
aContext.IsMozBrowser()) {
|
||||||
|
|
||||||
RefPtr<TabChild> child = sPreallocatedTab.get();
|
RefPtr<TabChild> child = sPreallocatedTab.get();
|
||||||
sPreallocatedTab = nullptr;
|
sPreallocatedTab = nullptr;
|
||||||
|
|
@ -779,9 +779,9 @@ TabChild::UpdateFrameType()
|
||||||
MOZ_ASSERT(docShell);
|
MOZ_ASSERT(docShell);
|
||||||
|
|
||||||
// TODO: Bug 1252794 - remove frameType from nsIDocShell.idl
|
// TODO: Bug 1252794 - remove frameType from nsIDocShell.idl
|
||||||
docShell->SetFrameType(IsMozBrowserElement() ? nsIDocShell::FRAME_TYPE_BROWSER :
|
docShell->SetFrameType(IsMozBrowserElement() ?
|
||||||
HasOwnApp() ? nsIDocShell::FRAME_TYPE_APP :
|
nsIDocShell::FRAME_TYPE_BROWSER :
|
||||||
nsIDocShell::FRAME_TYPE_REGULAR);
|
nsIDocShell::FRAME_TYPE_REGULAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChild)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChild)
|
||||||
|
|
@ -1091,11 +1091,11 @@ TabChild::ProvideWindow(mozIDOMWindowProxy* aParent,
|
||||||
{
|
{
|
||||||
*aReturn = nullptr;
|
*aReturn = nullptr;
|
||||||
|
|
||||||
// If aParent is inside an <iframe mozbrowser> or <iframe mozapp> and this
|
// If aParent is inside an <iframe mozbrowser> and this isn't a request to
|
||||||
// isn't a request to open a modal-type window, we're going to create a new
|
// open a modal-type window, we're going to create a new <iframe mozbrowser>
|
||||||
// <iframe mozbrowser/mozapp> and return its window here.
|
// and return its window here.
|
||||||
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
|
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
|
||||||
bool iframeMoz = (docshell && docshell->GetIsInMozBrowserOrApp() &&
|
bool iframeMoz = (docshell && docshell->GetIsInMozBrowser() &&
|
||||||
!(aChromeFlags & (nsIWebBrowserChrome::CHROME_MODAL |
|
!(aChromeFlags & (nsIWebBrowserChrome::CHROME_MODAL |
|
||||||
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
||||||
nsIWebBrowserChrome::CHROME_OPENAS_CHROME)));
|
nsIWebBrowserChrome::CHROME_OPENAS_CHROME)));
|
||||||
|
|
@ -1208,24 +1208,6 @@ TabChild::~TabChild()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
TabChild::SetProcessNameToAppName()
|
|
||||||
{
|
|
||||||
nsCOMPtr<mozIApplication> app = GetOwnApp();
|
|
||||||
if (!app) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString appName;
|
|
||||||
nsresult rv = app->GetName(appName);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
NS_WARNING("Failed to retrieve app name");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentChild::GetSingleton()->SetProcessName(appName, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TabChild::RecvLoadURL(const nsCString& aURI,
|
TabChild::RecvLoadURL(const nsCString& aURI,
|
||||||
const ShowInfo& aInfo)
|
const ShowInfo& aInfo)
|
||||||
|
|
@ -1237,8 +1219,6 @@ TabChild::RecvLoadURL(const nsCString& aURI,
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplyShowInfo(aInfo);
|
ApplyShowInfo(aInfo);
|
||||||
|
|
||||||
SetProcessNameToAppName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
|
|
@ -1279,7 +1259,7 @@ TabChild::ApplyShowInfo(const ShowInfo& aInfo)
|
||||||
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
|
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
|
||||||
if (docShell) {
|
if (docShell) {
|
||||||
nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
|
nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
|
||||||
if (IsMozBrowserOrApp()) {
|
if (IsMozBrowser()) {
|
||||||
// B2G allows window.name to be set by changing the name attribute on the
|
// B2G allows window.name to be set by changing the name attribute on the
|
||||||
// <iframe mozbrowser> element. window.open calls cause this attribute to
|
// <iframe mozbrowser> element. window.open calls cause this attribute to
|
||||||
// be set to the correct value. A normal <xul:browser> element has no such
|
// be set to the correct value. A normal <xul:browser> element has no such
|
||||||
|
|
@ -2135,7 +2115,7 @@ TabChild::RecvSwappedWithOtherRemoteLoader(const IPCTabContext& aContext)
|
||||||
// Ignore previous value of mTriedBrowserInit since owner content has changed.
|
// Ignore previous value of mTriedBrowserInit since owner content has changed.
|
||||||
mTriedBrowserInit = true;
|
mTriedBrowserInit = true;
|
||||||
// Initialize the child side of the browser element machinery, if appropriate.
|
// Initialize the child side of the browser element machinery, if appropriate.
|
||||||
if (IsMozBrowserOrApp()) {
|
if (IsMozBrowser()) {
|
||||||
RecvLoadRemoteScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
|
RecvLoadRemoteScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2494,7 +2474,7 @@ TabChild::InitTabChildGlobal(FrameScriptLoading aScriptLoading)
|
||||||
mTriedBrowserInit = true;
|
mTriedBrowserInit = true;
|
||||||
// Initialize the child side of the browser element machinery,
|
// Initialize the child side of the browser element machinery,
|
||||||
// if appropriate.
|
// if appropriate.
|
||||||
if (IsMozBrowserOrApp()) {
|
if (IsMozBrowser()) {
|
||||||
RecvLoadRemoteScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
|
RecvLoadRemoteScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -707,8 +707,6 @@ private:
|
||||||
|
|
||||||
void DestroyWindow();
|
void DestroyWindow();
|
||||||
|
|
||||||
void SetProcessNameToAppName();
|
|
||||||
|
|
||||||
void ApplyShowInfo(const ShowInfo& aInfo);
|
void ApplyShowInfo(const ShowInfo& aInfo);
|
||||||
|
|
||||||
bool HasValidInnerSize();
|
bool HasValidInnerSize();
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
#include "mozilla/dom/PTabContext.h"
|
#include "mozilla/dom/PTabContext.h"
|
||||||
#include "mozilla/dom/TabParent.h"
|
#include "mozilla/dom/TabParent.h"
|
||||||
#include "mozilla/dom/TabChild.h"
|
#include "mozilla/dom/TabChild.h"
|
||||||
#include "nsIAppsService.h"
|
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
|
|
||||||
|
|
@ -23,7 +22,7 @@ TabContext::TabContext()
|
||||||
: mIsPrerendered(false)
|
: mIsPrerendered(false)
|
||||||
, mInitialized(false)
|
, mInitialized(false)
|
||||||
, mIsMozBrowserElement(false)
|
, mIsMozBrowserElement(false)
|
||||||
, mContainingAppId(NO_APP_ID)
|
, mOriginAttributes()
|
||||||
, mShowAccelerators(UIStateChangeType_NoChange)
|
, mShowAccelerators(UIStateChangeType_NoChange)
|
||||||
, mShowFocusRings(UIStateChangeType_NoChange)
|
, mShowFocusRings(UIStateChangeType_NoChange)
|
||||||
{
|
{
|
||||||
|
|
@ -36,117 +35,9 @@ TabContext::IsMozBrowserElement() const
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TabContext::IsIsolatedMozBrowserElement() const
|
TabContext::IsMozBrowser() const
|
||||||
{
|
{
|
||||||
return mOriginAttributes.mInIsolatedMozBrowser;
|
return IsMozBrowserElement();
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
TabContext::IsMozBrowserOrApp() const
|
|
||||||
{
|
|
||||||
return HasOwnApp() || IsMozBrowserElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
TabContext::OwnAppId() const
|
|
||||||
{
|
|
||||||
return mOriginAttributes.mAppId;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<mozIApplication>
|
|
||||||
TabContext::GetOwnApp() const
|
|
||||||
{
|
|
||||||
nsCOMPtr<mozIApplication> ownApp = mOwnApp;
|
|
||||||
return ownApp.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
TabContext::HasOwnApp() const
|
|
||||||
{
|
|
||||||
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
|
|
||||||
return !!ownApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
TabContext::BrowserOwnerAppId() const
|
|
||||||
{
|
|
||||||
if (IsMozBrowserElement()) {
|
|
||||||
return mContainingAppId;
|
|
||||||
}
|
|
||||||
return NO_APP_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<mozIApplication>
|
|
||||||
TabContext::GetBrowserOwnerApp() const
|
|
||||||
{
|
|
||||||
nsCOMPtr<mozIApplication> ownerApp;
|
|
||||||
if (IsMozBrowserElement()) {
|
|
||||||
ownerApp = mContainingApp;
|
|
||||||
}
|
|
||||||
return ownerApp.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
TabContext::HasBrowserOwnerApp() const
|
|
||||||
{
|
|
||||||
nsCOMPtr<mozIApplication> ownerApp = GetBrowserOwnerApp();
|
|
||||||
return !!ownerApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
TabContext::AppOwnerAppId() const
|
|
||||||
{
|
|
||||||
if (HasOwnApp()) {
|
|
||||||
return mContainingAppId;
|
|
||||||
}
|
|
||||||
return NO_APP_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<mozIApplication>
|
|
||||||
TabContext::GetAppOwnerApp() const
|
|
||||||
{
|
|
||||||
nsCOMPtr<mozIApplication> ownerApp;
|
|
||||||
if (HasOwnApp()) {
|
|
||||||
ownerApp = mContainingApp;
|
|
||||||
}
|
|
||||||
return ownerApp.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
TabContext::HasAppOwnerApp() const
|
|
||||||
{
|
|
||||||
nsCOMPtr<mozIApplication> ownerApp = GetAppOwnerApp();
|
|
||||||
return !!ownerApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
TabContext::OwnOrContainingAppId() const
|
|
||||||
{
|
|
||||||
if (HasOwnApp()) {
|
|
||||||
return mOriginAttributes.mAppId;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mContainingAppId;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<mozIApplication>
|
|
||||||
TabContext::GetOwnOrContainingApp() const
|
|
||||||
{
|
|
||||||
nsCOMPtr<mozIApplication> ownOrContainingApp;
|
|
||||||
if (HasOwnApp()) {
|
|
||||||
ownOrContainingApp = mOwnApp;
|
|
||||||
} else {
|
|
||||||
ownOrContainingApp = mContainingApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ownOrContainingApp.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
TabContext::HasOwnOrContainingApp() const
|
|
||||||
{
|
|
||||||
nsCOMPtr<mozIApplication> ownOrContainingApp = GetOwnOrContainingApp();
|
|
||||||
return !!ownOrContainingApp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -174,9 +65,7 @@ TabContext::UpdateTabContextAfterSwap(const TabContext& aContext)
|
||||||
|
|
||||||
// The only permissable change is to `mIsMozBrowserElement`. All other fields
|
// The only permissable change is to `mIsMozBrowserElement`. All other fields
|
||||||
// must match for the change to be accepted.
|
// must match for the change to be accepted.
|
||||||
if (aContext.OwnAppId() != OwnAppId() ||
|
if (aContext.mOriginAttributes != mOriginAttributes) {
|
||||||
aContext.mContainingAppId != mContainingAppId ||
|
|
||||||
aContext.mOriginAttributes != mOriginAttributes) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -205,42 +94,19 @@ TabContext::ShowFocusRings() const
|
||||||
bool
|
bool
|
||||||
TabContext::SetTabContext(bool aIsMozBrowserElement,
|
TabContext::SetTabContext(bool aIsMozBrowserElement,
|
||||||
bool aIsPrerendered,
|
bool aIsPrerendered,
|
||||||
mozIApplication* aOwnApp,
|
|
||||||
mozIApplication* aAppFrameOwnerApp,
|
|
||||||
UIStateChangeType aShowAccelerators,
|
UIStateChangeType aShowAccelerators,
|
||||||
UIStateChangeType aShowFocusRings,
|
UIStateChangeType aShowFocusRings,
|
||||||
const DocShellOriginAttributes& aOriginAttributes)
|
const DocShellOriginAttributes& aOriginAttributes)
|
||||||
{
|
{
|
||||||
NS_ENSURE_FALSE(mInitialized, false);
|
NS_ENSURE_FALSE(mInitialized, false);
|
||||||
|
|
||||||
// Get ids for both apps and only write to our member variables after we've
|
// Verify that app id matches mAppId passed in originAttributes
|
||||||
// verified that this worked.
|
MOZ_RELEASE_ASSERT(aOriginAttributes.mAppId == NO_APP_ID);
|
||||||
uint32_t ownAppId = NO_APP_ID;
|
|
||||||
if (aOwnApp) {
|
|
||||||
nsresult rv = aOwnApp->GetLocalId(&ownAppId);
|
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
|
||||||
NS_ENSURE_TRUE(ownAppId != NO_APP_ID, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t containingAppId = NO_APP_ID;
|
|
||||||
if (aAppFrameOwnerApp) {
|
|
||||||
nsresult rv = aAppFrameOwnerApp->GetLocalId(&containingAppId);
|
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
|
||||||
NS_ENSURE_TRUE(containingAppId != NO_APP_ID, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Veryify that app id matches mAppId passed in originAttributes
|
|
||||||
MOZ_RELEASE_ASSERT((aOwnApp && aOriginAttributes.mAppId == ownAppId) ||
|
|
||||||
(aAppFrameOwnerApp && aOriginAttributes.mAppId == containingAppId) ||
|
|
||||||
aOriginAttributes.mAppId == NO_APP_ID);
|
|
||||||
|
|
||||||
mInitialized = true;
|
mInitialized = true;
|
||||||
mIsMozBrowserElement = aIsMozBrowserElement;
|
mIsMozBrowserElement = aIsMozBrowserElement;
|
||||||
mIsPrerendered = aIsPrerendered;
|
mIsPrerendered = aIsPrerendered;
|
||||||
mOriginAttributes = aOriginAttributes;
|
mOriginAttributes = aOriginAttributes;
|
||||||
mContainingAppId = containingAppId;
|
|
||||||
mOwnApp = aOwnApp;
|
|
||||||
mContainingApp = aAppFrameOwnerApp;
|
|
||||||
mShowAccelerators = aShowAccelerators;
|
mShowAccelerators = aShowAccelerators;
|
||||||
mShowFocusRings = aShowFocusRings;
|
mShowFocusRings = aShowFocusRings;
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -250,31 +116,17 @@ IPCTabContext
|
||||||
TabContext::AsIPCTabContext() const
|
TabContext::AsIPCTabContext() const
|
||||||
{
|
{
|
||||||
return IPCTabContext(FrameIPCTabContext(mOriginAttributes,
|
return IPCTabContext(FrameIPCTabContext(mOriginAttributes,
|
||||||
mContainingAppId,
|
|
||||||
mIsMozBrowserElement,
|
mIsMozBrowserElement,
|
||||||
mIsPrerendered,
|
mIsPrerendered,
|
||||||
mShowAccelerators,
|
mShowAccelerators,
|
||||||
mShowFocusRings));
|
mShowFocusRings));
|
||||||
}
|
}
|
||||||
|
|
||||||
static already_AddRefed<mozIApplication>
|
|
||||||
GetAppForId(uint32_t aAppId)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
|
|
||||||
NS_ENSURE_TRUE(appsService, nullptr);
|
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> app;
|
|
||||||
appsService->GetAppByLocalId(aAppId, getter_AddRefs(app));
|
|
||||||
|
|
||||||
return app.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
||||||
: mInvalidReason(nullptr)
|
: mInvalidReason(nullptr)
|
||||||
{
|
{
|
||||||
bool isMozBrowserElement = false;
|
bool isMozBrowserElement = false;
|
||||||
bool isPrerendered = false;
|
bool isPrerendered = false;
|
||||||
uint32_t containingAppId = NO_APP_ID;
|
|
||||||
DocShellOriginAttributes originAttributes;
|
DocShellOriginAttributes originAttributes;
|
||||||
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
|
UIStateChangeType showAccelerators = UIStateChangeType_NoChange;
|
||||||
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
|
UIStateChangeType showFocusRings = UIStateChangeType_NoChange;
|
||||||
|
|
@ -324,11 +176,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
||||||
// opener app.
|
// opener app.
|
||||||
isMozBrowserElement = ipcContext.isMozBrowserElement();
|
isMozBrowserElement = ipcContext.isMozBrowserElement();
|
||||||
originAttributes = context->mOriginAttributes;
|
originAttributes = context->mOriginAttributes;
|
||||||
if (isMozBrowserElement) {
|
|
||||||
containingAppId = context->OwnOrContainingAppId();
|
|
||||||
} else {
|
|
||||||
containingAppId = context->mContainingAppId;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPCTabContext::TFrameIPCTabContext: {
|
case IPCTabContext::TFrameIPCTabContext: {
|
||||||
|
|
@ -337,7 +184,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
||||||
|
|
||||||
isMozBrowserElement = ipcContext.isMozBrowserElement();
|
isMozBrowserElement = ipcContext.isMozBrowserElement();
|
||||||
isPrerendered = ipcContext.isPrerendered();
|
isPrerendered = ipcContext.isPrerendered();
|
||||||
containingAppId = ipcContext.frameOwnerAppId();
|
|
||||||
showAccelerators = ipcContext.showAccelerators();
|
showAccelerators = ipcContext.showAccelerators();
|
||||||
showFocusRings = ipcContext.showFocusRings();
|
showFocusRings = ipcContext.showFocusRings();
|
||||||
originAttributes = ipcContext.originAttributes();
|
originAttributes = ipcContext.originAttributes();
|
||||||
|
|
@ -352,7 +198,6 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
containingAppId = NO_APP_ID;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
@ -360,28 +205,9 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> ownApp;
|
|
||||||
if (!isMozBrowserElement) {
|
|
||||||
// mAppId corresponds to OwnOrContainingAppId; if isMozBrowserElement is
|
|
||||||
// false then it's ownApp otherwise it's containingApp
|
|
||||||
ownApp = GetAppForId(originAttributes.mAppId);
|
|
||||||
if ((ownApp == nullptr) != (originAttributes.mAppId == NO_APP_ID)) {
|
|
||||||
mInvalidReason = "Got an ownAppId that didn't correspond to an app.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<mozIApplication> containingApp = GetAppForId(containingAppId);
|
|
||||||
if ((containingApp == nullptr) != (containingAppId == NO_APP_ID)) {
|
|
||||||
mInvalidReason = "Got a containingAppId that didn't correspond to an app.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rv;
|
bool rv;
|
||||||
rv = mTabContext.SetTabContext(isMozBrowserElement,
|
rv = mTabContext.SetTabContext(isMozBrowserElement,
|
||||||
isPrerendered,
|
isPrerendered,
|
||||||
ownApp,
|
|
||||||
containingApp,
|
|
||||||
showAccelerators,
|
showAccelerators,
|
||||||
showFocusRings,
|
showFocusRings,
|
||||||
originAttributes);
|
originAttributes);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
#ifndef mozilla_dom_TabContext_h
|
#ifndef mozilla_dom_TabContext_h
|
||||||
#define mozilla_dom_TabContext_h
|
#define mozilla_dom_TabContext_h
|
||||||
|
|
||||||
#include "mozIApplication.h"
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "mozilla/BasePrincipal.h"
|
#include "mozilla/BasePrincipal.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
|
|
@ -18,9 +17,7 @@ namespace dom {
|
||||||
class IPCTabContext;
|
class IPCTabContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TabContext encapsulates information about an iframe that may be a mozbrowser
|
* TabContext encapsulates information about an iframe that may be a mozbrowser.
|
||||||
* or mozapp. You can ask whether a TabContext corresponds to a mozbrowser or
|
|
||||||
* mozapp, get the app that contains the browser, and so on.
|
|
||||||
*
|
*
|
||||||
* TabParent and TabChild both inherit from TabContext, and you can also have
|
* TabParent and TabChild both inherit from TabContext, and you can also have
|
||||||
* standalone TabContext objects.
|
* standalone TabContext objects.
|
||||||
|
|
@ -37,91 +34,29 @@ public:
|
||||||
/* (The implicit copy-constructor and operator= are fine.) */
|
/* (The implicit copy-constructor and operator= are fine.) */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates IPCTabContext of type BrowserFrameIPCTabContext or
|
* Generates IPCTabContext of type BrowserFrameIPCTabContext from this
|
||||||
* AppFrameIPCTabContext from this TabContext's information.
|
* TabContext's information.
|
||||||
*/
|
*/
|
||||||
IPCTabContext AsIPCTabContext() const;
|
IPCTabContext AsIPCTabContext() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this TabContext correspond to a mozbrowser?
|
* Does this TabContext correspond to a mozbrowser?
|
||||||
*
|
*
|
||||||
* <iframe mozbrowser mozapp> and <xul:browser> are not considered to be
|
* <iframe mozbrowser> is a mozbrowser element, but <xul:browser> is not.
|
||||||
* mozbrowser elements.
|
|
||||||
*
|
|
||||||
* If IsMozBrowserElement() is true, HasOwnApp() and HasAppOwnerApp() are
|
|
||||||
* guaranteed to be false.
|
|
||||||
*
|
|
||||||
* If IsMozBrowserElement() is false, HasBrowserOwnerApp() is guaranteed to be
|
|
||||||
* false.
|
|
||||||
*/
|
*/
|
||||||
bool IsMozBrowserElement() const;
|
bool IsMozBrowserElement() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this TabContext correspond to an isolated mozbrowser?
|
* Does this TabContext correspond to a mozbrowser? This is equivalent to
|
||||||
*
|
* IsMozBrowserElement(). Returns false for <xul:browser>, which isn't a
|
||||||
* <iframe mozbrowser mozapp> and <xul:browser> are not considered to be
|
* mozbrowser.
|
||||||
* mozbrowser elements. <iframe mozbrowser noisolation> does not count as
|
|
||||||
* isolated since isolation is disabled. Isolation can only be disabled by
|
|
||||||
* chrome pages.
|
|
||||||
*/
|
*/
|
||||||
bool IsIsolatedMozBrowserElement() const;
|
bool IsMozBrowser() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Does this TabContext correspond to a mozbrowser or mozapp? This is
|
|
||||||
* equivalent to IsMozBrowserElement() || HasOwnApp(). Returns false for
|
|
||||||
* <xul:browser>, which is neither a mozbrowser nor a mozapp.
|
|
||||||
*/
|
|
||||||
bool IsMozBrowserOrApp() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OwnAppId() returns the id of the app which directly corresponds to this
|
|
||||||
* context's frame. GetOwnApp() returns the corresponding app object, and
|
|
||||||
* HasOwnApp() returns true iff GetOwnApp() would return a non-null value.
|
|
||||||
*
|
|
||||||
* If HasOwnApp() is true, IsMozBrowserElement() is guaranteed to be
|
|
||||||
* false.
|
|
||||||
*/
|
|
||||||
uint32_t OwnAppId() const;
|
|
||||||
already_AddRefed<mozIApplication> GetOwnApp() const;
|
|
||||||
bool HasOwnApp() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BrowserOwnerAppId() gets the ID of the app which contains this browser
|
|
||||||
* frame. If this is not a mozbrowser frame (if !IsMozBrowserElement()), then
|
|
||||||
* BrowserOwnerAppId() is guaranteed to return NO_APP_ID.
|
|
||||||
*
|
|
||||||
* Even if we are a browser frame, BrowserOwnerAppId() may still return
|
|
||||||
* NO_APP_ID, if this browser frame is not contained inside an app.
|
|
||||||
*/
|
|
||||||
uint32_t BrowserOwnerAppId() const;
|
|
||||||
already_AddRefed<mozIApplication> GetBrowserOwnerApp() const;
|
|
||||||
bool HasBrowserOwnerApp() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AppOwnerAppId() gets the ID of the app which contains this app frame. If
|
|
||||||
* this is not an app frame (i.e., if !HasOwnApp()), then AppOwnerAppId() is
|
|
||||||
* guaranteed to return NO_APP_ID.
|
|
||||||
*
|
|
||||||
* Even if we are an app frame, AppOwnerAppId() may still return NO_APP_ID, if
|
|
||||||
* this app frame is not contained inside an app.
|
|
||||||
*/
|
|
||||||
uint32_t AppOwnerAppId() const;
|
|
||||||
already_AddRefed<mozIApplication> GetAppOwnerApp() const;
|
|
||||||
bool HasAppOwnerApp() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OwnOrContainingAppId() gets the ID of this frame, if HasOwnApp(). If this
|
|
||||||
* frame does not have its own app, it gets the ID of the app which contains
|
|
||||||
* this frame (i.e., the result of {Browser,App}OwnerAppId(), as applicable).
|
|
||||||
*/
|
|
||||||
uint32_t OwnOrContainingAppId() const;
|
|
||||||
already_AddRefed<mozIApplication> GetOwnOrContainingApp() const;
|
|
||||||
bool HasOwnOrContainingApp() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OriginAttributesRef() returns the DocShellOriginAttributes of this frame to
|
* OriginAttributesRef() returns the DocShellOriginAttributes of this frame to
|
||||||
* the caller. This is used to store any attribute associated with the frame's
|
* the caller. This is used to store any attribute associated with the frame's
|
||||||
* docshell, such as the AppId.
|
* docshell.
|
||||||
*/
|
*/
|
||||||
const DocShellOriginAttributes& OriginAttributesRef() const;
|
const DocShellOriginAttributes& OriginAttributesRef() const;
|
||||||
|
|
||||||
|
|
@ -150,17 +85,8 @@ protected:
|
||||||
*/
|
*/
|
||||||
void SetPrivateBrowsingAttributes(bool aIsPrivateBrowsing);
|
void SetPrivateBrowsingAttributes(bool aIsPrivateBrowsing);
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the TabContext for this frame. This can either be:
|
|
||||||
* - an app frame (with the given own app) inside the given owner app. Either
|
|
||||||
* apps can be null.
|
|
||||||
* - a browser frame inside the given owner app (which may be null).
|
|
||||||
* - a non-browser, non-app frame. Both own app and owner app should be null.
|
|
||||||
*/
|
|
||||||
bool SetTabContext(bool aIsMozBrowserElement,
|
bool SetTabContext(bool aIsMozBrowserElement,
|
||||||
bool aIsPrerendered,
|
bool aIsPrerendered,
|
||||||
mozIApplication* aOwnApp,
|
|
||||||
mozIApplication* aAppFrameOwnerApp,
|
|
||||||
UIStateChangeType aShowAccelerators,
|
UIStateChangeType aShowAccelerators,
|
||||||
UIStateChangeType aShowFocusRings,
|
UIStateChangeType aShowFocusRings,
|
||||||
const DocShellOriginAttributes& aOriginAttributes);
|
const DocShellOriginAttributes& aOriginAttributes);
|
||||||
|
|
@ -190,29 +116,11 @@ private:
|
||||||
/**
|
/**
|
||||||
* Whether this TabContext corresponds to a mozbrowser.
|
* Whether this TabContext corresponds to a mozbrowser.
|
||||||
*
|
*
|
||||||
* <iframe mozbrowser mozapp> and <xul:browser> are not considered to be
|
* <iframe mozbrowser> and <xul:browser> are not considered to be
|
||||||
* mozbrowser elements.
|
* mozbrowser elements.
|
||||||
*/
|
*/
|
||||||
bool mIsMozBrowserElement;
|
bool mIsMozBrowserElement;
|
||||||
|
|
||||||
/**
|
|
||||||
* This TabContext's own app. If this is non-null, then this
|
|
||||||
* TabContext corresponds to an app, and mIsMozBrowserElement must be false.
|
|
||||||
*/
|
|
||||||
nsCOMPtr<mozIApplication> mOwnApp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This TabContext's containing app. If mIsMozBrowserElement, this
|
|
||||||
* corresponds to the app which contains the browser frame; otherwise, this
|
|
||||||
* corresponds to the app which contains the app frame.
|
|
||||||
*/
|
|
||||||
nsCOMPtr<mozIApplication> mContainingApp;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Cache of mContainingApp->GetLocalId().
|
|
||||||
*/
|
|
||||||
uint32_t mContainingAppId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DocShellOriginAttributes of the top level tab docShell
|
* DocShellOriginAttributes of the top level tab docShell
|
||||||
*/
|
*/
|
||||||
|
|
@ -241,16 +149,12 @@ public:
|
||||||
bool
|
bool
|
||||||
SetTabContext(bool aIsMozBrowserElement,
|
SetTabContext(bool aIsMozBrowserElement,
|
||||||
bool aIsPrerendered,
|
bool aIsPrerendered,
|
||||||
mozIApplication* aOwnApp,
|
|
||||||
mozIApplication* aAppFrameOwnerApp,
|
|
||||||
UIStateChangeType aShowAccelerators,
|
UIStateChangeType aShowAccelerators,
|
||||||
UIStateChangeType aShowFocusRings,
|
UIStateChangeType aShowFocusRings,
|
||||||
const DocShellOriginAttributes& aOriginAttributes)
|
const DocShellOriginAttributes& aOriginAttributes)
|
||||||
{
|
{
|
||||||
return TabContext::SetTabContext(aIsMozBrowserElement,
|
return TabContext::SetTabContext(aIsMozBrowserElement,
|
||||||
aIsPrerendered,
|
aIsPrerendered,
|
||||||
aOwnApp,
|
|
||||||
aAppFrameOwnerApp,
|
|
||||||
aShowAccelerators,
|
aShowAccelerators,
|
||||||
aShowFocusRings,
|
aShowFocusRings,
|
||||||
aOriginAttributes);
|
aOriginAttributes);
|
||||||
|
|
@ -261,10 +165,9 @@ public:
|
||||||
* MaybeInvalidTabContext is a simple class that lets you transform an
|
* MaybeInvalidTabContext is a simple class that lets you transform an
|
||||||
* IPCTabContext into a TabContext.
|
* IPCTabContext into a TabContext.
|
||||||
*
|
*
|
||||||
* The issue is that an IPCTabContext is not necessarily valid; for example, it
|
* The issue is that an IPCTabContext is not necessarily valid. So to convert
|
||||||
* might specify an app-id which doesn't exist. So to convert an IPCTabContext
|
* an IPCTabContext into a TabContext, you construct a MaybeInvalidTabContext,
|
||||||
* into a TabContext, you construct a MaybeInvalidTabContext, check whether it's
|
* check whether it's valid, and, if so, read out your TabContext.
|
||||||
* valid, and, if so, read out your TabContext.
|
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include "AudioChannelService.h"
|
#include "AudioChannelService.h"
|
||||||
#include "AppProcessChecker.h"
|
#include "AppProcessChecker.h"
|
||||||
#include "mozIApplication.h"
|
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
#include "mozilla/a11y/DocAccessibleParent.h"
|
#include "mozilla/a11y/DocAccessibleParent.h"
|
||||||
#include "nsAccessibilityService.h"
|
#include "nsAccessibilityService.h"
|
||||||
|
|
@ -2940,8 +2939,6 @@ public:
|
||||||
NS_IMETHOD GetUsePrivateBrowsing(bool*) NO_IMPL
|
NS_IMETHOD GetUsePrivateBrowsing(bool*) NO_IMPL
|
||||||
NS_IMETHOD SetUsePrivateBrowsing(bool) NO_IMPL
|
NS_IMETHOD SetUsePrivateBrowsing(bool) NO_IMPL
|
||||||
NS_IMETHOD SetPrivateBrowsing(bool) NO_IMPL
|
NS_IMETHOD SetPrivateBrowsing(bool) NO_IMPL
|
||||||
NS_IMETHOD GetIsInIsolatedMozBrowserElement(bool*) NO_IMPL
|
|
||||||
NS_IMETHOD GetAppId(uint32_t*) NO_IMPL
|
|
||||||
NS_IMETHOD GetOriginAttributes(JS::MutableHandleValue) NO_IMPL
|
NS_IMETHOD GetOriginAttributes(JS::MutableHandleValue) NO_IMPL
|
||||||
NS_IMETHOD GetUseRemoteTabs(bool*) NO_IMPL
|
NS_IMETHOD GetUseRemoteTabs(bool*) NO_IMPL
|
||||||
NS_IMETHOD SetRemoteTabs(bool) NO_IMPL
|
NS_IMETHOD SetRemoteTabs(bool) NO_IMPL
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ nsIContentChild::AllocPBrowserChild(const TabId& aTabId,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
// We'll happily accept any kind of IPCTabContext here; we don't need to
|
// We'll happily accept any kind of IPCTabContext here; we don't need to
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ public:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpID,
|
const ContentParentId& aCpID,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) = 0;
|
const bool& aIsForBrowser) = 0;
|
||||||
|
|
||||||
virtual mozilla::ipc::PFileDescriptorSetChild*
|
virtual mozilla::ipc::PFileDescriptorSetChild*
|
||||||
|
|
@ -85,7 +84,6 @@ protected:
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpId,
|
const ContentParentId& aCpId,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser);
|
const bool& aIsForBrowser);
|
||||||
virtual bool DeallocPBrowserChild(PBrowserChild*);
|
virtual bool DeallocPBrowserChild(PBrowserChild*);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,11 +122,9 @@ nsIContentParent::AllocPBrowserParent(const TabId& aTabId,
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpId,
|
const ContentParentId& aCpId,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser)
|
const bool& aIsForBrowser)
|
||||||
{
|
{
|
||||||
Unused << aCpId;
|
Unused << aCpId;
|
||||||
Unused << aIsForApp;
|
|
||||||
Unused << aIsForBrowser;
|
Unused << aIsForBrowser;
|
||||||
|
|
||||||
if (!CanOpenBrowser(aContext)) {
|
if (!CanOpenBrowser(aContext)) {
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ public:
|
||||||
BlobParent* GetOrCreateActorForBlobImpl(BlobImpl* aImpl);
|
BlobParent* GetOrCreateActorForBlobImpl(BlobImpl* aImpl);
|
||||||
|
|
||||||
virtual ContentParentId ChildID() const = 0;
|
virtual ContentParentId ChildID() const = 0;
|
||||||
virtual bool IsForApp() const = 0;
|
|
||||||
virtual bool IsForBrowser() const = 0;
|
virtual bool IsForBrowser() const = 0;
|
||||||
|
|
||||||
MOZ_MUST_USE virtual PBlobParent*
|
MOZ_MUST_USE virtual PBlobParent*
|
||||||
|
|
@ -73,7 +72,6 @@ public:
|
||||||
const IPCTabContext& context,
|
const IPCTabContext& context,
|
||||||
const uint32_t& chromeFlags,
|
const uint32_t& chromeFlags,
|
||||||
const ContentParentId& aCpId,
|
const ContentParentId& aCpId,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser) = 0;
|
const bool& aIsForBrowser) = 0;
|
||||||
|
|
||||||
virtual bool IsContentParent() const { return false; }
|
virtual bool IsContentParent() const { return false; }
|
||||||
|
|
@ -99,7 +97,6 @@ protected: // IPDL methods
|
||||||
const IPCTabContext& aContext,
|
const IPCTabContext& aContext,
|
||||||
const uint32_t& aChromeFlags,
|
const uint32_t& aChromeFlags,
|
||||||
const ContentParentId& aCpId,
|
const ContentParentId& aCpId,
|
||||||
const bool& aIsForApp,
|
|
||||||
const bool& aIsForBrowser);
|
const bool& aIsForBrowser);
|
||||||
virtual bool DeallocPBrowserParent(PBrowserParent* frame);
|
virtual bool DeallocPBrowserParent(PBrowserParent* frame);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1893,29 +1893,15 @@ MediaManager::NotifyRecordingStatusChange(nsPIDOMWindowInner* aWindow,
|
||||||
props->SetPropertyAsBool(NS_LITERAL_STRING("isAudio"), aIsAudio);
|
props->SetPropertyAsBool(NS_LITERAL_STRING("isAudio"), aIsAudio);
|
||||||
props->SetPropertyAsBool(NS_LITERAL_STRING("isVideo"), aIsVideo);
|
props->SetPropertyAsBool(NS_LITERAL_STRING("isVideo"), aIsVideo);
|
||||||
|
|
||||||
bool isApp = false;
|
nsCString pageURL;
|
||||||
nsString requestURL;
|
nsCOMPtr<nsIURI> docURI = aWindow->GetDocumentURI();
|
||||||
|
NS_ENSURE_TRUE(docURI, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
if (nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell()) {
|
nsresult rv = docURI->GetSpec(pageURL);
|
||||||
isApp = docShell->GetIsApp();
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
if (isApp) {
|
|
||||||
nsresult rv = docShell->GetAppManifestURL(requestURL);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isApp) {
|
NS_ConvertUTF8toUTF16 requestURL(pageURL);
|
||||||
nsCString pageURL;
|
|
||||||
nsCOMPtr<nsIURI> docURI = aWindow->GetDocumentURI();
|
|
||||||
NS_ENSURE_TRUE(docURI, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
nsresult rv = docURI->GetSpec(pageURL);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
requestURL = NS_ConvertUTF8toUTF16(pageURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
props->SetPropertyAsBool(NS_LITERAL_STRING("isApp"), isApp);
|
|
||||||
props->SetPropertyAsAString(NS_LITERAL_STRING("requestURL"), requestURL);
|
props->SetPropertyAsAString(NS_LITERAL_STRING("requestURL"), requestURL);
|
||||||
|
|
||||||
obs->NotifyObservers(static_cast<nsIPropertyBag2*>(props),
|
obs->NotifyObservers(static_cast<nsIPropertyBag2*>(props),
|
||||||
|
|
|
||||||
|
|
@ -67,25 +67,13 @@ TCPServerSocketParent::Init()
|
||||||
uint32_t
|
uint32_t
|
||||||
TCPServerSocketParent::GetAppId()
|
TCPServerSocketParent::GetAppId()
|
||||||
{
|
{
|
||||||
const PContentParent *content = Manager()->Manager();
|
return nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||||
if (PBrowserParent* browser = SingleManagedOrNull(content->ManagedPBrowserParent())) {
|
|
||||||
TabParent *tab = TabParent::GetFrom(browser);
|
|
||||||
return tab->OwnAppId();
|
|
||||||
} else {
|
|
||||||
return nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TCPServerSocketParent::GetInIsolatedMozBrowser()
|
TCPServerSocketParent::GetInIsolatedMozBrowser()
|
||||||
{
|
{
|
||||||
const PContentParent *content = Manager()->Manager();
|
return false;
|
||||||
if (PBrowserParent* browser = SingleManagedOrNull(content->ManagedPBrowserParent())) {
|
|
||||||
TabParent *tab = TabParent::GetFrom(browser);
|
|
||||||
return tab->IsIsolatedMozBrowserElement();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
||||||
|
|
@ -73,25 +73,13 @@ TCPSocketParentBase::~TCPSocketParentBase()
|
||||||
uint32_t
|
uint32_t
|
||||||
TCPSocketParent::GetAppId()
|
TCPSocketParent::GetAppId()
|
||||||
{
|
{
|
||||||
const PContentParent *content = Manager()->Manager();
|
return nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||||
if (PBrowserParent* browser = SingleManagedOrNull(content->ManagedPBrowserParent())) {
|
}
|
||||||
TabParent *tab = TabParent::GetFrom(browser);
|
|
||||||
return tab->OwnAppId();
|
|
||||||
} else {
|
|
||||||
return nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TCPSocketParent::GetInIsolatedMozBrowser()
|
TCPSocketParent::GetInIsolatedMozBrowser()
|
||||||
{
|
{
|
||||||
const PContentParent *content = Manager()->Manager();
|
return false;
|
||||||
if (PBrowserParent* browser = SingleManagedOrNull(content->ManagedPBrowserParent())) {
|
|
||||||
TabParent *tab = TabParent::GetFrom(browser);
|
|
||||||
return tab->IsIsolatedMozBrowserElement();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -225,20 +213,11 @@ TCPSocketParent::RecvOpenBind(const nsCString& aRemoteHost,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtain App ID
|
|
||||||
uint32_t appId = nsIScriptSecurityManager::NO_APP_ID;
|
|
||||||
bool inIsolatedMozBrowser = false;
|
bool inIsolatedMozBrowser = false;
|
||||||
const PContentParent *content = Manager()->Manager();
|
const PContentParent *content = Manager()->Manager();
|
||||||
if (PBrowserParent* browser = SingleManagedOrNull(content->ManagedPBrowserParent())) {
|
|
||||||
// appId's are for B2G only currently, where managees.Count() == 1
|
|
||||||
// This is not guaranteed currently in Desktop, so skip this there.
|
|
||||||
TabParent *tab = TabParent::GetFrom(browser);
|
|
||||||
appId = tab->OwnAppId();
|
|
||||||
inIsolatedMozBrowser = tab->IsIsolatedMozBrowserElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
mSocket = new TCPSocket(nullptr, NS_ConvertUTF8toUTF16(aRemoteHost), aRemotePort, aUseSSL, aUseArrayBuffers);
|
mSocket = new TCPSocket(nullptr, NS_ConvertUTF8toUTF16(aRemoteHost), aRemotePort, aUseSSL, aUseArrayBuffers);
|
||||||
mSocket->SetAppIdAndBrowser(appId, inIsolatedMozBrowser);
|
mSocket->SetAppIdAndBrowser(nsIScriptSecurityManager::NO_APP_ID, inIsolatedMozBrowser);
|
||||||
mSocket->SetSocketBridgeParent(this);
|
mSocket->SetSocketBridgeParent(this);
|
||||||
rv = mSocket->InitWithUnconnectedTransport(socketTransport);
|
rv = mSocket->InitWithUnconnectedTransport(socketTransport);
|
||||||
NS_ENSURE_SUCCESS(rv, true);
|
NS_ENSURE_SUCCESS(rv, true);
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,5 @@ partial interface HTMLIFrameElement {
|
||||||
attribute boolean mozbrowser;
|
attribute boolean mozbrowser;
|
||||||
};
|
};
|
||||||
|
|
||||||
partial interface HTMLIFrameElement {
|
|
||||||
// nsIMozBrowserFrame
|
|
||||||
[ChromeOnly]
|
|
||||||
readonly attribute DOMString appManifestURL;
|
|
||||||
};
|
|
||||||
|
|
||||||
HTMLIFrameElement implements MozFrameLoaderOwner;
|
HTMLIFrameElement implements MozFrameLoaderOwner;
|
||||||
HTMLIFrameElement implements BrowserElement;
|
HTMLIFrameElement implements BrowserElement;
|
||||||
|
|
|
||||||
|
|
@ -1619,17 +1619,6 @@ nsXULElement::GetFrameLoader()
|
||||||
return already_AddRefed<nsFrameLoader>(static_cast<nsFrameLoader*>(loader.forget().take()));
|
return already_AddRefed<nsFrameLoader>(static_cast<nsFrameLoader*>(loader.forget().take()));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsXULElement::GetParentApplication(mozIApplication** aApplication)
|
|
||||||
{
|
|
||||||
if (!aApplication) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aApplication = nullptr;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsXULElement::PresetOpenerWindow(mozIDOMWindowProxy* aWindow, ErrorResult& aRv)
|
nsXULElement::PresetOpenerWindow(mozIDOMWindowProxy* aWindow, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -412,7 +412,6 @@ public:
|
||||||
virtual mozilla::EventStates IntrinsicState() const override;
|
virtual mozilla::EventStates IntrinsicState() const override;
|
||||||
|
|
||||||
nsresult GetFrameLoaderXPCOM(nsIFrameLoader** aFrameLoader);
|
nsresult GetFrameLoaderXPCOM(nsIFrameLoader** aFrameLoader);
|
||||||
nsresult GetParentApplication(mozIApplication** aApplication);
|
|
||||||
void PresetOpenerWindow(mozIDOMWindowProxy* aWindow, ErrorResult& aRv);
|
void PresetOpenerWindow(mozIDOMWindowProxy* aWindow, ErrorResult& aRv);
|
||||||
nsresult SetIsPrerendered();
|
nsresult SetIsPrerendered();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1982,7 +1982,7 @@ nsWindowWatcher::CalculateChromeFlagsForParent(mozIDOMWindowProxy* aParent,
|
||||||
// Disable CHROME_OPENAS_DIALOG if the window is inside <iframe mozbrowser>.
|
// Disable CHROME_OPENAS_DIALOG if the window is inside <iframe mozbrowser>.
|
||||||
// It's up to the embedder to interpret what dialog=1 means.
|
// It's up to the embedder to interpret what dialog=1 means.
|
||||||
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
|
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
|
||||||
if (docshell && docshell->GetIsInMozBrowserOrApp()) {
|
if (docshell && docshell->GetIsInMozBrowser()) {
|
||||||
chromeFlags &= ~nsIWebBrowserChrome::CHROME_OPENAS_DIALOG;
|
chromeFlags &= ~nsIWebBrowserChrome::CHROME_OPENAS_DIALOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "nsIAppsService.h"
|
#include "nsIAppsService.h"
|
||||||
#include "mozIApplication.h"
|
|
||||||
#include "nsIEffectiveTLDService.h"
|
#include "nsIEffectiveTLDService.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
|
|
||||||
|
|
@ -6882,20 +6882,6 @@ CheckPermissionForBeforeAfterKeyboardEvent(Element* aElement)
|
||||||
if (permission == nsIPermissionManager::ALLOW_ACTION) {
|
if (permission == nsIPermissionManager::ALLOW_ACTION) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check "embed-apps" permission for later use.
|
|
||||||
permission = nsIPermissionManager::DENY_ACTION;
|
|
||||||
permMgr->TestPermissionFromPrincipal(principal, "embed-apps", &permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
// An element can handle before events and after events if the following
|
|
||||||
// conditions are met:
|
|
||||||
// 1) <iframe mozbrowser mozapp>
|
|
||||||
// 2) it has "embed-apps" permission.
|
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame(do_QueryInterface(aElement));
|
|
||||||
if ((permission == nsIPermissionManager::ALLOW_ACTION) &&
|
|
||||||
browserFrame && browserFrame->GetReallyIsApp()) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ ShouldInTopLayerForFullscreen(Element* aElement)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aElement);
|
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aElement);
|
||||||
if (browserFrame && browserFrame->GetReallyIsBrowserOrApp()) {
|
if (browserFrame && browserFrame->GetReallyIsBrowser()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -2310,7 +2310,7 @@ static bool SelectorMatches(Element* aElement,
|
||||||
nsCOMPtr<nsIMozBrowserFrame>
|
nsCOMPtr<nsIMozBrowserFrame>
|
||||||
browserFrame = do_QueryInterface(aElement);
|
browserFrame = do_QueryInterface(aElement);
|
||||||
if (!browserFrame ||
|
if (!browserFrame ||
|
||||||
!browserFrame->GetReallyIsBrowserOrApp()) {
|
!browserFrame->GetReallyIsBrowser()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -960,8 +960,6 @@ pref("devtools.debugger.force-local", true);
|
||||||
pref("devtools.debugger.prompt-connection", true);
|
pref("devtools.debugger.prompt-connection", true);
|
||||||
// Block tools from seeing / interacting with certified apps
|
// Block tools from seeing / interacting with certified apps
|
||||||
pref("devtools.debugger.forbid-certified-apps", true);
|
pref("devtools.debugger.forbid-certified-apps", true);
|
||||||
// List of permissions that a sideloaded app can't ask for
|
|
||||||
pref("devtools.apps.forbidden-permissions", "embed-apps");
|
|
||||||
|
|
||||||
// DevTools default color unit
|
// DevTools default color unit
|
||||||
pref("devtools.defaultColorUnit", "authored");
|
pref("devtools.defaultColorUnit", "authored");
|
||||||
|
|
|
||||||
|
|
@ -568,16 +568,7 @@ NS_LoadGroupMatchesPrincipal(nsILoadGroup *aLoadGroup,
|
||||||
getter_AddRefs(loadContext));
|
getter_AddRefs(loadContext));
|
||||||
NS_ENSURE_TRUE(loadContext, false);
|
NS_ENSURE_TRUE(loadContext, false);
|
||||||
|
|
||||||
// Verify load context appId and browser flag match the principal
|
return true;
|
||||||
uint32_t contextAppId;
|
|
||||||
bool contextInIsolatedBrowser;
|
|
||||||
nsresult rv = loadContext->GetAppId(&contextAppId);
|
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
|
||||||
rv = loadContext->GetIsInIsolatedMozBrowserElement(&contextInIsolatedBrowser);
|
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
|
||||||
|
|
||||||
return contextAppId == aPrincipal->GetAppId() &&
|
|
||||||
contextInIsolatedBrowser == aPrincipal->GetIsInIsolatedMozBrowserElement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
@ -2385,39 +2376,18 @@ NS_CompareLoadInfoAndLoadContext(nsIChannel *aChannel)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t loadContextAppId = 0;
|
|
||||||
nsresult rv = loadContext->GetAppId(&loadContextAppId);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool loadContextIsInBE = false;
|
|
||||||
rv = loadContext->GetIsInIsolatedMozBrowserElement(&loadContextIsInBE);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
OriginAttributes originAttrsLoadInfo = loadInfo->GetOriginAttributes();
|
OriginAttributes originAttrsLoadInfo = loadInfo->GetOriginAttributes();
|
||||||
DocShellOriginAttributes originAttrsLoadContext;
|
DocShellOriginAttributes originAttrsLoadContext;
|
||||||
loadContext->GetOriginAttributes(originAttrsLoadContext);
|
loadContext->GetOriginAttributes(originAttrsLoadContext);
|
||||||
|
|
||||||
LOG(("NS_CompareLoadInfoAndLoadContext - loadInfo: %d, %d, %d, %d; "
|
LOG(("NS_CompareLoadInfoAndLoadContext - loadInfo: %d, %d; "
|
||||||
"loadContext: %d %d, %d, %d. [channel=%p]",
|
"loadContext: %d, %d. [channel=%p]",
|
||||||
originAttrsLoadInfo.mAppId, originAttrsLoadInfo.mInIsolatedMozBrowser,
|
originAttrsLoadInfo.mUserContextId,
|
||||||
originAttrsLoadInfo.mUserContextId, originAttrsLoadInfo.mPrivateBrowsingId,
|
originAttrsLoadInfo.mPrivateBrowsingId,
|
||||||
loadContextAppId, loadContextIsInBE,
|
originAttrsLoadContext.mUserContextId,
|
||||||
originAttrsLoadContext.mUserContextId, originAttrsLoadContext.mPrivateBrowsingId,
|
originAttrsLoadContext.mPrivateBrowsingId,
|
||||||
aChannel));
|
aChannel));
|
||||||
|
|
||||||
MOZ_ASSERT(originAttrsLoadInfo.mAppId == loadContextAppId,
|
|
||||||
"AppId in the loadContext and in the loadInfo are not the "
|
|
||||||
"same!");
|
|
||||||
|
|
||||||
MOZ_ASSERT(originAttrsLoadInfo.mInIsolatedMozBrowser ==
|
|
||||||
loadContextIsInBE,
|
|
||||||
"The value of InIsolatedMozBrowser in the loadContext and in "
|
|
||||||
"the loadInfo are not the same!");
|
|
||||||
|
|
||||||
MOZ_ASSERT(originAttrsLoadInfo.mUserContextId ==
|
MOZ_ASSERT(originAttrsLoadInfo.mUserContextId ==
|
||||||
originAttrsLoadContext.mUserContextId,
|
originAttrsLoadContext.mUserContextId,
|
||||||
"The value of mUserContextId in the loadContext and in the "
|
"The value of mUserContextId in the loadContext and in the "
|
||||||
|
|
|
||||||
|
|
@ -612,8 +612,7 @@ nsUDPSocket::InitWithAddress(const NetAddr *aAddr, nsIPrincipal *aPrincipal,
|
||||||
|
|
||||||
if (aPrincipal) {
|
if (aPrincipal) {
|
||||||
mAppId = aPrincipal->GetAppId();
|
mAppId = aPrincipal->GetAppId();
|
||||||
mIsInIsolatedMozBrowserElement =
|
mIsInIsolatedMozBrowserElement = false;
|
||||||
aPrincipal->GetIsInIsolatedMozBrowserElement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@
|
||||||
#include "mozilla/AutoRestore.h"
|
#include "mozilla/AutoRestore.h"
|
||||||
#include "mozilla/FileUtils.h"
|
#include "mozilla/FileUtils.h"
|
||||||
#include "nsIAppsService.h"
|
#include "nsIAppsService.h"
|
||||||
#include "mozIApplication.h"
|
|
||||||
#include "mozIApplicationClearPrivateDataParams.h"
|
#include "mozIApplicationClearPrivateDataParams.h"
|
||||||
#include "nsIConsoleService.h"
|
#include "nsIConsoleService.h"
|
||||||
#include "nsVariant.h"
|
#include "nsVariant.h"
|
||||||
|
|
|
||||||
|
|
@ -3010,12 +3010,8 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
|
||||||
|
|
||||||
NeckoOriginAttributes attrs = newLoadInfo->GetOriginAttributes();
|
NeckoOriginAttributes attrs = newLoadInfo->GetOriginAttributes();
|
||||||
|
|
||||||
MOZ_ASSERT(docShellAttrs.mAppId == attrs.mAppId,
|
|
||||||
"docshell and necko should have the same appId attribute.");
|
|
||||||
MOZ_ASSERT(docShellAttrs.mUserContextId == attrs.mUserContextId,
|
MOZ_ASSERT(docShellAttrs.mUserContextId == attrs.mUserContextId,
|
||||||
"docshell and necko should have the same userContextId attribute.");
|
"docshell and necko should have the same userContextId attribute.");
|
||||||
MOZ_ASSERT(docShellAttrs.mInIsolatedMozBrowser == attrs.mInIsolatedMozBrowser,
|
|
||||||
"docshell and necko should have the same inIsolatedMozBrowser attribute.");
|
|
||||||
MOZ_ASSERT(docShellAttrs.mPrivateBrowsingId == attrs.mPrivateBrowsingId,
|
MOZ_ASSERT(docShellAttrs.mPrivateBrowsingId == attrs.mPrivateBrowsingId,
|
||||||
"docshell and necko should have the same privateBrowsingId attribute.");
|
"docshell and necko should have the same privateBrowsingId attribute.");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -256,20 +256,6 @@ OfflineCacheUpdateParent::SetRemoteTabs(bool aUseRemoteTabs)
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
OfflineCacheUpdateParent::GetIsInIsolatedMozBrowserElement(bool *aIsInIsolatedMozBrowserElement)
|
|
||||||
{
|
|
||||||
NS_ENSURE_TRUE(mLoadingPrincipal, NS_ERROR_UNEXPECTED);
|
|
||||||
return mLoadingPrincipal->GetIsInIsolatedMozBrowserElement(aIsInIsolatedMozBrowserElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
OfflineCacheUpdateParent::GetAppId(uint32_t *aAppId)
|
|
||||||
{
|
|
||||||
NS_ENSURE_TRUE(mLoadingPrincipal, NS_ERROR_UNEXPECTED);
|
|
||||||
return mLoadingPrincipal->GetAppId(aAppId);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
OfflineCacheUpdateParent::GetOriginAttributes(JS::MutableHandleValue aAttrs)
|
OfflineCacheUpdateParent::GetOriginAttributes(JS::MutableHandleValue aAttrs)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -224,9 +224,9 @@ interface nsIOfflineCacheUpdateService : nsISupports {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule a cache update for a given offline manifest using app cache
|
* Schedule a cache update for a given offline manifest using app cache
|
||||||
* bound to the given appID+inIsolatedMozBrowser flag. If an existing update
|
* bound to the given appID flag. If an existing update is scheduled or
|
||||||
* is scheduled or running, that update will be returned. Otherwise a new
|
* running, that update will be returned. Otherwise a new update will be
|
||||||
* update will be scheduled.
|
* scheduled.
|
||||||
*/
|
*/
|
||||||
nsIOfflineCacheUpdate scheduleAppUpdate(in nsIURI aManifestURI,
|
nsIOfflineCacheUpdate scheduleAppUpdate(in nsIURI aManifestURI,
|
||||||
in nsIURI aDocumentURI,
|
in nsIURI aDocumentURI,
|
||||||
|
|
|
||||||
|
|
@ -820,7 +820,7 @@ nsContentTreeOwner::ProvideWindow(mozIDOMWindowProxy* aParent,
|
||||||
// open a modal-type window, we're going to create a new <iframe mozbrowser>
|
// open a modal-type window, we're going to create a new <iframe mozbrowser>
|
||||||
// and return its window here.
|
// and return its window here.
|
||||||
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
|
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
|
||||||
if (docshell && docshell->GetIsInMozBrowserOrApp() &&
|
if (docshell && docshell->GetIsInMozBrowser() &&
|
||||||
!(aChromeFlags & (nsIWebBrowserChrome::CHROME_MODAL |
|
!(aChromeFlags & (nsIWebBrowserChrome::CHROME_MODAL |
|
||||||
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
||||||
nsIWebBrowserChrome::CHROME_OPENAS_CHROME))) {
|
nsIWebBrowserChrome::CHROME_OPENAS_CHROME))) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue