Skip to content

Commit 01a1a85

Browse files
committed
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.
1 parent b2cab55 commit 01a1a85

File tree

77 files changed

+295
-1799
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+295
-1799
lines changed

accessible/jsat/AccessFu.jsm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ this.AccessFu = { // jshint ignore:line
340340
case 'remote-browser-shown':
341341
case 'inprocess-browser-shown':
342342
{
343-
// Ignore notifications that aren't from a BrowserOrApp
343+
// Ignore notifications that aren't from a Browser
344344
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
345-
if (!frameLoader.ownerIsMozBrowserOrAppFrame) {
345+
if (!frameLoader.ownerIsMozBrowserFrame) {
346346
return;
347347
}
348348
this._handleMessageManager(frameLoader.messageManager);

caps/nsIPrincipal.idl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,6 @@ interface nsIPrincipal : nsISerializable
303303
*/
304304
[infallible] readonly attribute unsigned long privateBrowsingId;
305305

306-
/**
307-
* Returns true iff the principal is inside an isolated mozbrowser element.
308-
* <iframe mozbrowser mozapp> and <xul:browser> are not considered to be
309-
* mozbrowser elements. <iframe mozbrowser noisolation> does not count as
310-
* isolated since isolation is disabled. Isolation can only be disabled if
311-
* the containing document is chrome.
312-
*/
313-
[infallible] readonly attribute boolean isInIsolatedMozBrowserElement;
314-
315306
/**
316307
* Returns true if this principal has an unknown appId. This shouldn't
317308
* generally be used. We only expose it due to not providing the correct

caps/nsScriptSecurityManager.cpp

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -243,63 +243,7 @@ nsScriptSecurityManager::SecurityHashURI(nsIURI* aURI)
243243
uint16_t
244244
nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
245245
{
246-
uint32_t appId = aPrin->GetAppId();
247-
248-
// After bug 1238160, the principal no longer knows how to answer "is this a
249-
// browser element", which is really what this code path wants. Currently,
250-
// desktop is the only platform where we intend to disable isolation on a
251-
// browser frame, so non-desktop should be able to assume that
252-
// inIsolatedMozBrowser is true for all mozbrowser frames. Additionally,
253-
// apps are no longer used on desktop, so appId is always NO_APP_ID. We use
254-
// a release assertion in nsFrameLoader::OwnerIsIsolatedMozBrowserFrame so
255-
// that platforms with apps can assume inIsolatedMozBrowser is true for all
256-
// mozbrowser frames.
257-
bool inIsolatedMozBrowser = aPrin->GetIsInIsolatedMozBrowserElement();
258-
259-
NS_WARNING_ASSERTION(
260-
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
261-
"Asking for app status on a principal with an unknown app id");
262-
263-
// Installed apps have a valid app id (not NO_APP_ID or UNKNOWN_APP_ID)
264-
// and they are not inside a mozbrowser.
265-
if (appId == nsIScriptSecurityManager::NO_APP_ID ||
266-
appId == nsIScriptSecurityManager::UNKNOWN_APP_ID ||
267-
inIsolatedMozBrowser)
268-
{
269-
return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
270-
}
271-
272-
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
273-
NS_ENSURE_TRUE(appsService, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
274-
275-
nsCOMPtr<mozIApplication> app;
276-
appsService->GetAppByLocalId(appId, getter_AddRefs(app));
277-
NS_ENSURE_TRUE(app, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
278-
279-
uint16_t status = nsIPrincipal::APP_STATUS_INSTALLED;
280-
NS_ENSURE_SUCCESS(app->GetAppStatus(&status),
281-
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
282-
283-
nsString appOrigin;
284-
NS_ENSURE_SUCCESS(app->GetOrigin(appOrigin),
285-
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
286-
nsCOMPtr<nsIURI> appURI;
287-
NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(appURI), appOrigin),
288-
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
289-
290-
// The app could contain a cross-origin iframe - make sure that the content
291-
// is actually same-origin with the app.
292-
MOZ_ASSERT(inIsolatedMozBrowser == false, "Checked this above");
293-
nsAutoCString suffix;
294-
PrincipalOriginAttributes attrs;
295-
NS_ENSURE_TRUE(attrs.PopulateFromOrigin(NS_ConvertUTF16toUTF8(appOrigin), suffix),
296-
nsIPrincipal::APP_STATUS_NOT_INSTALLED);
297-
attrs.mAppId = appId;
298-
attrs.mInIsolatedMozBrowser = false;
299-
nsCOMPtr<nsIPrincipal> appPrin = BasePrincipal::CreateCodebasePrincipal(appURI, attrs);
300-
NS_ENSURE_TRUE(appPrin, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
301-
return aPrin->Equals(appPrin) ? status
302-
: nsIPrincipal::APP_STATUS_NOT_INSTALLED;
246+
return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
303247
}
304248

305249
/*

devtools/server/actors/webconsole.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,9 @@ WebConsoleActor.prototype =
569569

570570
let startedListeners = [];
571571
let window = !this.parentActor.isRootActor ? this.window : null;
572-
let appId = null;
573572
let messageManager = null;
574573

575574
if (this._parentIsContentActor) {
576-
appId = this.parentActor.docShell.appId;
577575
messageManager = this.parentActor.messageManager;
578576
}
579577

@@ -604,16 +602,16 @@ WebConsoleActor.prototype =
604602
// Create a StackTraceCollector that's going to be shared both by the
605603
// NetworkMonitorChild (getting messages about requests from parent) and
606604
// by the NetworkMonitor that directly watches service workers requests.
607-
this.stackTraceCollector = new StackTraceCollector({ window, appId });
605+
this.stackTraceCollector = new StackTraceCollector({ window });
608606
this.stackTraceCollector.init();
609607

610608
let processBoundary = Services.appinfo.processType !=
611609
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
612-
if ((appId || messageManager) && processBoundary) {
610+
if (messageManager && processBoundary) {
613611
// Start a network monitor in the parent process to listen to
614612
// most requests than happen in parent
615613
this.networkMonitor =
616-
new NetworkMonitorChild(appId, this.parentActor.outerWindowID,
614+
new NetworkMonitorChild(this.parentActor.outerWindowID,
617615
messageManager, this.conn, this);
618616
this.networkMonitor.init();
619617
// Spawn also one in the child to listen to service workers

devtools/shared/layout/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ function getTopWindow(win) {
3737
.getInterface(Ci.nsIWebNavigation)
3838
.QueryInterface(Ci.nsIDocShell);
3939

40-
if (!docShell.isMozBrowserOrApp) {
40+
if (!docShell.isMozBrowser) {
4141
return win.top;
4242
}
4343

4444
let topDocShell =
45-
docShell.getSameTypeRootTreeItemIgnoreBrowserAndAppBoundaries();
45+
docShell.getSameTypeRootTreeItemIgnoreBrowserBoundaries();
4646

4747
return topDocShell
4848
? topDocShell.contentViewer.DOMDocument.defaultView
@@ -98,12 +98,12 @@ function getParentWindow(win) {
9898
.getInterface(Ci.nsIWebNavigation)
9999
.QueryInterface(Ci.nsIDocShell);
100100

101-
if (!docShell.isMozBrowserOrApp) {
101+
if (!docShell.isMozBrowser) {
102102
return win.parent;
103103
}
104104

105105
let parentDocShell =
106-
docShell.getSameTypeParentIgnoreBrowserAndAppBoundaries();
106+
docShell.getSameTypeParentIgnoreBrowserBoundaries();
107107

108108
return parentDocShell
109109
? parentDocShell.contentViewer.DOMDocument.defaultView

devtools/shared/webconsole/network-monitor.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,8 +1551,6 @@ NetworkMonitor.prototype = {
15511551
* data to the WebConsoleActor or to a NetworkEventActor.
15521552
*
15531553
* @constructor
1554-
* @param number appId
1555-
* The web appId of the child process.
15561554
* @param number outerWindowID
15571555
* The outerWindowID of the TabActor's main window.
15581556
* @param nsIMessageManager messageManager
@@ -1562,8 +1560,7 @@ NetworkMonitor.prototype = {
15621560
* @param object owner
15631561
* The WebConsoleActor that is listening for the network requests.
15641562
*/
1565-
function NetworkMonitorChild(appId, outerWindowID, messageManager, conn, owner) {
1566-
this.appId = appId;
1563+
function NetworkMonitorChild(outerWindowID, messageManager, conn, owner) {
15671564
this.outerWindowID = outerWindowID;
15681565
this.conn = conn;
15691566
this.owner = owner;
@@ -1577,7 +1574,6 @@ function NetworkMonitorChild(appId, outerWindowID, messageManager, conn, owner)
15771574
exports.NetworkMonitorChild = NetworkMonitorChild;
15781575

15791576
NetworkMonitorChild.prototype = {
1580-
appId: null,
15811577
owner: null,
15821578
_netEvents: null,
15831579
_saveRequestAndResponseBodies: true,
@@ -1623,7 +1619,6 @@ NetworkMonitorChild.prototype = {
16231619
mm.addMessageListener(`${this._msgName}:newEvent`, this._onNewEvent);
16241620
mm.addMessageListener(`${this._msgName}:updateEvent`, this._onUpdateEvent);
16251621
mm.sendAsyncMessage(this._msgName, {
1626-
appId: this.appId,
16271622
outerWindowID: this.outerWindowID,
16281623
action: "start",
16291624
});

docshell/base/LoadContext.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -157,28 +157,6 @@ LoadContext::SetRemoteTabs(bool aUseRemoteTabs)
157157
return NS_ERROR_UNEXPECTED;
158158
}
159159

160-
NS_IMETHODIMP
161-
LoadContext::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
162-
{
163-
MOZ_ASSERT(mIsNotNull);
164-
165-
NS_ENSURE_ARG_POINTER(aIsInIsolatedMozBrowserElement);
166-
167-
*aIsInIsolatedMozBrowserElement = mOriginAttributes.mInIsolatedMozBrowser;
168-
return NS_OK;
169-
}
170-
171-
NS_IMETHODIMP
172-
LoadContext::GetAppId(uint32_t* aAppId)
173-
{
174-
MOZ_ASSERT(mIsNotNull);
175-
176-
NS_ENSURE_ARG_POINTER(aAppId);
177-
178-
*aAppId = mOriginAttributes.mAppId;
179-
return NS_OK;
180-
}
181-
182160
NS_IMETHODIMP
183161
LoadContext::GetOriginAttributes(JS::MutableHandleValue aAttrs)
184162
{

docshell/base/LoadContext.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ class LoadContext final
3838
NS_DECL_NSILOADCONTEXT
3939
NS_DECL_NSIINTERFACEREQUESTOR
4040

41-
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
42-
// provided by child process.
4341
LoadContext(const IPC::SerializedLoadContext& aToCopy,
4442
dom::Element* aTopFrameElement,
4543
DocShellOriginAttributes& aAttrs)
@@ -54,8 +52,6 @@ class LoadContext final
5452
{
5553
}
5654

57-
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
58-
// provided by child process.
5955
LoadContext(const IPC::SerializedLoadContext& aToCopy,
6056
uint64_t aNestedFrameId,
6157
DocShellOriginAttributes& aAttrs)

docshell/base/nsDSURIContentListener.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIHttpChannel* aHttpChannel,
334334
curDocShellItem->GetParent(getter_AddRefs(parentDocShellItem))) &&
335335
parentDocShellItem) {
336336
nsCOMPtr<nsIDocShell> curDocShell = do_QueryInterface(curDocShellItem);
337-
if (curDocShell && curDocShell->GetIsMozBrowserOrApp()) {
337+
if (curDocShell && curDocShell->GetIsMozBrowser()) {
338338
break;
339339
}
340340

0 commit comments

Comments
 (0)