Compare commits
87
Commits
ghost-windows
...
2664
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
254efe6759 | ||
|
|
2e68f35707 | ||
|
|
786dc56351 | ||
|
|
2c4ef2600e | ||
|
|
8c8072860d | ||
|
|
54043a8b0a | ||
|
|
350e9c1879 | ||
|
|
0887abea30 | ||
|
|
cd78019ba6 | ||
|
|
3a26f14966 | ||
|
|
e2714e6938 | ||
|
|
c0b74ce133 | ||
|
|
14b9599104 | ||
|
|
f336312483 | ||
|
|
c7f25b6b9a | ||
|
|
29445ecfbe | ||
|
|
b6925236cc | ||
|
|
3b580c88d3 | ||
|
|
946c79b573 | ||
|
|
44ef435a21 | ||
|
|
9f32e371cb | ||
|
|
c959b55dd0 | ||
|
|
7786fc9d84 | ||
|
|
0e09f19795 | ||
|
|
aae12e5b54 | ||
|
|
5418ade030 | ||
|
|
2b85a07fb9 | ||
|
|
25d668395b | ||
|
|
32dd996cf2 | ||
|
|
4222ca929d | ||
|
|
35a4d4172e | ||
|
|
945e5b88fb | ||
|
|
dcba66d719 | ||
|
|
a64ed8a1db | ||
|
|
5206e5316c | ||
|
|
8f21ccd0a2 | ||
|
|
01a1a8557b | ||
|
|
b2cab55756 | ||
|
|
3ead6cadb6 | ||
|
|
8a4db5fa4b | ||
|
|
a421c7fab4 | ||
|
|
7894ac066c | ||
|
|
1d3c46ea86 | ||
|
|
62a47c35c1 | ||
|
|
a2cb54f93b | ||
|
|
4cc45366d7 | ||
|
|
935d1b9e1b | ||
|
|
c18edb0b67 | ||
|
|
7f93d25967 | ||
|
|
0f007a16d5 | ||
|
|
eacd48cccb | ||
|
|
fc1fe7d0c5 | ||
|
|
92873ead3e | ||
|
|
9fede4a3ba | ||
|
|
dbd5dc9554 | ||
|
|
3f538909ab | ||
|
|
8e4ce9b800 | ||
|
|
edf4210e12 | ||
|
|
5a64fd9657 | ||
|
|
12e9db2481 | ||
|
|
0af6123536 | ||
|
|
e2c94125cc | ||
|
|
723ca48613 | ||
|
|
15514da406 | ||
|
|
04d1e3e53a | ||
|
|
c654c1820f | ||
|
|
39dd9d560a | ||
|
|
032357c053 | ||
|
|
ecacd4a4d9 | ||
|
|
a6bc5962c4 | ||
|
|
12e93be21a | ||
|
|
0aeac02b89 | ||
|
|
1402d8eee6 | ||
|
|
42b3e18a4a | ||
|
|
cabe9ea2d5 | ||
|
|
c57a1eee66 | ||
|
|
a8fbc1dfbe | ||
|
|
1f457514b0 | ||
|
|
acd339fcf7 | ||
|
|
07bb7f379b | ||
|
|
8cabf0bf72 | ||
|
|
178f72365d | ||
|
|
f819937a31 | ||
|
|
114b5265d6 | ||
|
|
8595dc550f | ||
|
|
5b8d28ba4d | ||
|
|
8146ba5a07 |
No files matched your search
@@ -19,6 +19,13 @@ If you are interested in the development and building side of things, some
|
||||
information will be available on the [Pale Moon developer site](http://developer.palemoon.org).
|
||||
You are also always welcome to get in touch with our community on the [Pale Moon forum](https://forum.palemoon.org/).
|
||||
|
||||
### Code search
|
||||
|
||||
While our repo has basic code searching capabilities (via `git grep`), you are strongly
|
||||
encouraged to instead use the dedicated code search and cross-referencing site:
|
||||
[https://xref.palemoon.org/](https://xref.palemoon.org/)
|
||||
This repo and a copy of the front-end are amalgamated in the `goanna-central` index.
|
||||
|
||||
### A note about trademarks and branding
|
||||
|
||||
Although this repository is primarily licensed under Mozilla Public License v2.0, the
|
||||
|
||||
@@ -340,9 +340,9 @@ this.AccessFu = { // jshint ignore:line
|
||||
case 'remote-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);
|
||||
if (!frameLoader.ownerIsMozBrowserOrAppFrame) {
|
||||
if (!frameLoader.ownerIsMozBrowserFrame) {
|
||||
return;
|
||||
}
|
||||
this._handleMessageManager(frameLoader.messageManager);
|
||||
|
||||
@@ -624,13 +624,8 @@ BasePrincipal::GetOriginSuffix(nsACString& aOriginAttributes)
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::GetAppStatus(uint16_t* aAppStatus)
|
||||
{
|
||||
if (AppId() == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
NS_WARNING("Asking for app status on a principal with an unknown app id");
|
||||
*aAppStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aAppStatus = nsScriptSecurityManager::AppStatusForPrincipal(this);
|
||||
// TODO: Remove GetAppStatus.
|
||||
*aAppStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -303,15 +303,6 @@ interface nsIPrincipal : nsISerializable
|
||||
*/
|
||||
[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
|
||||
* generally be used. We only expose it due to not providing the correct
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/HashFunctions.h"
|
||||
|
||||
#include "nsIAppsService.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
static bool gCodeBasePrincipalSupport = false;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "xpcpublic.h"
|
||||
#include "XPCWrapper.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsIInputStreamChannel.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@@ -55,7 +54,6 @@
|
||||
#include "nsIChromeRegistry.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsIAsyncVerifyRedirectCallback.h"
|
||||
#include "mozIApplication.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
@@ -240,68 +238,6 @@ nsScriptSecurityManager::SecurityHashURI(nsIURI* aURI)
|
||||
return NS_SecurityHashURI(aURI);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
|
||||
{
|
||||
uint32_t appId = aPrin->GetAppId();
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
/*
|
||||
* GetChannelResultPrincipal will return the principal that the resource
|
||||
* returned by this channel will use. For example, if the resource is in
|
||||
|
||||
@@ -4,7 +4,6 @@ support-files =
|
||||
file_disableScript.html
|
||||
!/js/xpconnect/tests/mochitest/file_empty.html
|
||||
|
||||
[test_app_principal_equality.html]
|
||||
[test_bug246699.html]
|
||||
[test_bug292789.html]
|
||||
[test_bug423375.html]
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=777467
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test app principal's equality</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=777467">Mozilla Bug 777467</a>
|
||||
<p id="display"></p>
|
||||
<script>
|
||||
|
||||
/** Test for app principal's equality **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var permissions = new Promise(resolve => {
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ type: "browser", allow: true, context: document },
|
||||
{ type: "embed-apps", allow: true, context: document }],
|
||||
resolve);
|
||||
});
|
||||
|
||||
permissions.then(() => {
|
||||
$('content').innerHTML =
|
||||
'<iframe src="error404"></iframe>\n' +
|
||||
'<iframe mozbrowser src="error404"></iframe>\n' +
|
||||
'<iframe mozapp="http://example.org/manifest.webapp" mozbrowser src="error404"></iframe>';
|
||||
|
||||
var iframes = document.getElementsByTagName("iframe");
|
||||
var promises = []
|
||||
for (var i = 0; i < promises.length; ++i) {
|
||||
promises.push(new Promise(resolve => {
|
||||
iframes[i].addEventListener("load", resolve);
|
||||
}));
|
||||
}
|
||||
|
||||
return Promise.all(promises);
|
||||
});
|
||||
|
||||
var prefs = new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ set: [[ "dom.mozBrowserFramesEnabled", true ],
|
||||
[ "dom.ipc.browser_frames.oop_by_default", false ]] },
|
||||
resolve);
|
||||
});
|
||||
</script>
|
||||
<div id="content" style="display: none;">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
function canAccessDocument(win) {
|
||||
var result = true;
|
||||
try {
|
||||
win.document;
|
||||
} catch(e) {
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
var loaded = new Promise(resolve => addLoadEvent(resolve));
|
||||
|
||||
Promise.all([ permissions, prefs, loaded ]).then(runTest);
|
||||
|
||||
function runTest() {
|
||||
// Test the witness frame (we can access same-origin frame).
|
||||
is(canAccessDocument(frames[0]), true,
|
||||
"should be able to access the first frame");
|
||||
|
||||
// Test different app/browserElement frames.
|
||||
for (var i=1; i<frames.length; ++i) {
|
||||
is(canAccessDocument(frames[i]), false,
|
||||
"should not be able to access the other frames");
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -86,6 +86,7 @@ included_inclnames_to_ignore = set([
|
||||
'unicode/uclean.h', # ICU
|
||||
'unicode/ucol.h', # ICU
|
||||
'unicode/udat.h', # ICU
|
||||
'unicode/udateintervalformat.h', # ICU
|
||||
'unicode/udatpg.h', # ICU
|
||||
'unicode/udisplaycontext.h',# ICU
|
||||
'unicode/uenum.h', # ICU
|
||||
|
||||
+1
-1
@@ -152,6 +152,7 @@ sources = [
|
||||
'/intl/icu/source/i18n/ucol_sit.cpp',
|
||||
'/intl/icu/source/i18n/ucoleitr.cpp',
|
||||
'/intl/icu/source/i18n/udat.cpp',
|
||||
'/intl/icu/source/i18n/udateintervalformat.cpp',
|
||||
'/intl/icu/source/i18n/udatpg.cpp',
|
||||
'/intl/icu/source/i18n/ufieldpositer.cpp',
|
||||
'/intl/icu/source/i18n/uitercollationiterator.cpp',
|
||||
@@ -217,7 +218,6 @@ other_sources = [
|
||||
'/intl/icu/source/i18n/transreg.cpp',
|
||||
'/intl/icu/source/i18n/tridpars.cpp',
|
||||
'/intl/icu/source/i18n/ucsdet.cpp',
|
||||
'/intl/icu/source/i18n/udateintervalformat.cpp',
|
||||
'/intl/icu/source/i18n/ulocdata.cpp',
|
||||
'/intl/icu/source/i18n/unesctrn.cpp',
|
||||
'/intl/icu/source/i18n/uni2name.cpp',
|
||||
|
||||
@@ -569,11 +569,9 @@ WebConsoleActor.prototype =
|
||||
|
||||
let startedListeners = [];
|
||||
let window = !this.parentActor.isRootActor ? this.window : null;
|
||||
let appId = null;
|
||||
let messageManager = null;
|
||||
|
||||
if (this._parentIsContentActor) {
|
||||
appId = this.parentActor.docShell.appId;
|
||||
messageManager = this.parentActor.messageManager;
|
||||
}
|
||||
|
||||
@@ -604,16 +602,16 @@ WebConsoleActor.prototype =
|
||||
// Create a StackTraceCollector that's going to be shared both by the
|
||||
// NetworkMonitorChild (getting messages about requests from parent) and
|
||||
// by the NetworkMonitor that directly watches service workers requests.
|
||||
this.stackTraceCollector = new StackTraceCollector({ window, appId });
|
||||
this.stackTraceCollector = new StackTraceCollector({ window });
|
||||
this.stackTraceCollector.init();
|
||||
|
||||
let processBoundary = Services.appinfo.processType !=
|
||||
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
if ((appId || messageManager) && processBoundary) {
|
||||
if (messageManager && processBoundary) {
|
||||
// Start a network monitor in the parent process to listen to
|
||||
// most requests than happen in parent
|
||||
this.networkMonitor =
|
||||
new NetworkMonitorChild(appId, this.parentActor.outerWindowID,
|
||||
new NetworkMonitorChild(this.parentActor.outerWindowID,
|
||||
messageManager, this.conn, this);
|
||||
this.networkMonitor.init();
|
||||
// Spawn also one in the child to listen to service workers
|
||||
|
||||
@@ -37,12 +37,12 @@ function getTopWindow(win) {
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell);
|
||||
|
||||
if (!docShell.isMozBrowserOrApp) {
|
||||
if (!docShell.isMozBrowser) {
|
||||
return win.top;
|
||||
}
|
||||
|
||||
let topDocShell =
|
||||
docShell.getSameTypeRootTreeItemIgnoreBrowserAndAppBoundaries();
|
||||
docShell.getSameTypeRootTreeItemIgnoreBrowserBoundaries();
|
||||
|
||||
return topDocShell
|
||||
? topDocShell.contentViewer.DOMDocument.defaultView
|
||||
@@ -98,12 +98,12 @@ function getParentWindow(win) {
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell);
|
||||
|
||||
if (!docShell.isMozBrowserOrApp) {
|
||||
if (!docShell.isMozBrowser) {
|
||||
return win.parent;
|
||||
}
|
||||
|
||||
let parentDocShell =
|
||||
docShell.getSameTypeParentIgnoreBrowserAndAppBoundaries();
|
||||
docShell.getSameTypeParentIgnoreBrowserBoundaries();
|
||||
|
||||
return parentDocShell
|
||||
? parentDocShell.contentViewer.DOMDocument.defaultView
|
||||
|
||||
@@ -1551,8 +1551,6 @@ NetworkMonitor.prototype = {
|
||||
* data to the WebConsoleActor or to a NetworkEventActor.
|
||||
*
|
||||
* @constructor
|
||||
* @param number appId
|
||||
* The web appId of the child process.
|
||||
* @param number outerWindowID
|
||||
* The outerWindowID of the TabActor's main window.
|
||||
* @param nsIMessageManager messageManager
|
||||
@@ -1562,8 +1560,7 @@ NetworkMonitor.prototype = {
|
||||
* @param object owner
|
||||
* The WebConsoleActor that is listening for the network requests.
|
||||
*/
|
||||
function NetworkMonitorChild(appId, outerWindowID, messageManager, conn, owner) {
|
||||
this.appId = appId;
|
||||
function NetworkMonitorChild(outerWindowID, messageManager, conn, owner) {
|
||||
this.outerWindowID = outerWindowID;
|
||||
this.conn = conn;
|
||||
this.owner = owner;
|
||||
@@ -1577,7 +1574,6 @@ function NetworkMonitorChild(appId, outerWindowID, messageManager, conn, owner)
|
||||
exports.NetworkMonitorChild = NetworkMonitorChild;
|
||||
|
||||
NetworkMonitorChild.prototype = {
|
||||
appId: null,
|
||||
owner: null,
|
||||
_netEvents: null,
|
||||
_saveRequestAndResponseBodies: true,
|
||||
@@ -1623,7 +1619,6 @@ NetworkMonitorChild.prototype = {
|
||||
mm.addMessageListener(`${this._msgName}:newEvent`, this._onNewEvent);
|
||||
mm.addMessageListener(`${this._msgName}:updateEvent`, this._onUpdateEvent);
|
||||
mm.sendAsyncMessage(this._msgName, {
|
||||
appId: this.appId,
|
||||
outerWindowID: this.outerWindowID,
|
||||
action: "start",
|
||||
});
|
||||
|
||||
@@ -157,28 +157,6 @@ LoadContext::SetRemoteTabs(bool aUseRemoteTabs)
|
||||
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
|
||||
LoadContext::GetOriginAttributes(JS::MutableHandleValue aAttrs)
|
||||
{
|
||||
|
||||
@@ -38,8 +38,6 @@ public:
|
||||
NS_DECL_NSILOADCONTEXT
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
|
||||
// provided by child process.
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
dom::Element* aTopFrameElement,
|
||||
DocShellOriginAttributes& aAttrs)
|
||||
@@ -54,8 +52,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
// appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext
|
||||
// provided by child process.
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
uint64_t aNestedFrameId,
|
||||
DocShellOriginAttributes& aAttrs)
|
||||
|
||||
@@ -334,7 +334,7 @@ nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIHttpChannel* aHttpChannel,
|
||||
curDocShellItem->GetParent(getter_AddRefs(parentDocShellItem))) &&
|
||||
parentDocShellItem) {
|
||||
nsCOMPtr<nsIDocShell> curDocShell = do_QueryInterface(curDocShellItem);
|
||||
if (curDocShell && curDocShell->GetIsMozBrowserOrApp()) {
|
||||
if (curDocShell && curDocShell->GetIsMozBrowser()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -427,6 +427,7 @@ ShouldIgnoreFrameOptions(nsIChannel* aChannel, nsIPrincipal* aPrincipal)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// log warning to console that xfo is ignored because of CSP
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
|
||||
uint64_t innerWindowID = loadInfo ? loadInfo->GetInnerWindowID() : 0;
|
||||
@@ -440,7 +441,7 @@ ShouldIgnoreFrameOptions(nsIChannel* aChannel, nsIPrincipal* aPrincipal)
|
||||
0, // no columnnumber
|
||||
nsIScriptError::warningFlag,
|
||||
"CSP", innerWindowID);
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+18
-103
@@ -193,7 +193,6 @@
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsDSURIContentListener.h"
|
||||
#include "nsDocShellLoadTypes.h"
|
||||
#include "nsDocShellTransferableHooks.h"
|
||||
@@ -2564,7 +2563,7 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetFullscreenAllowed(bool aFullscreenAllowed)
|
||||
{
|
||||
if (!nsIDocShell::GetIsMozBrowserOrApp()) {
|
||||
if (!nsIDocShell::GetIsMozBrowser()) {
|
||||
// Only allow setting of fullscreenAllowed on content/process boundaries.
|
||||
// At non-boundaries the fullscreenAllowed attribute is calculated based on
|
||||
// whether all enclosing frames have the "mozFullscreenAllowed" attribute
|
||||
@@ -3396,7 +3395,7 @@ nsDocShell::GetSameTypeParent(nsIDocShellTreeItem** aParent)
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nullptr;
|
||||
|
||||
if (nsIDocShell::GetIsMozBrowserOrApp()) {
|
||||
if (nsIDocShell::GetIsMozBrowser()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -3413,7 +3412,7 @@ nsDocShell::GetSameTypeParent(nsIDocShellTreeItem** aParent)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetSameTypeParentIgnoreBrowserAndAppBoundaries(nsIDocShell** aParent)
|
||||
nsDocShell::GetSameTypeParentIgnoreBrowserBoundaries(nsIDocShell** aParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nullptr;
|
||||
@@ -3467,18 +3466,18 @@ nsDocShell::GetSameTypeRootTreeItem(nsIDocShellTreeItem** aRootTreeItem)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetSameTypeRootTreeItemIgnoreBrowserAndAppBoundaries(nsIDocShell ** aRootTreeItem)
|
||||
nsDocShell::GetSameTypeRootTreeItemIgnoreBrowserBoundaries(nsIDocShell ** aRootTreeItem)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRootTreeItem);
|
||||
*aRootTreeItem = static_cast<nsIDocShell *>(this);
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent;
|
||||
NS_ENSURE_SUCCESS(GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent)),
|
||||
NS_ENSURE_SUCCESS(GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent)),
|
||||
NS_ERROR_FAILURE);
|
||||
while (parent) {
|
||||
*aRootTreeItem = parent;
|
||||
NS_ENSURE_SUCCESS((*aRootTreeItem)->
|
||||
GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent)),
|
||||
GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent)),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
NS_ADDREF(*aRootTreeItem);
|
||||
@@ -3532,12 +3531,6 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (targetDS->GetIsInIsolatedMozBrowserElement() !=
|
||||
accessingDS->GetIsInIsolatedMozBrowserElement() ||
|
||||
targetDS->GetAppId() != accessingDS->GetAppId()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> accessingRoot;
|
||||
aAccessingItem->GetSameTypeRootTreeItem(getter_AddRefs(accessingRoot));
|
||||
nsCOMPtr<nsIDocShell> accessingRootDS = do_QueryInterface(accessingRoot);
|
||||
@@ -3558,7 +3551,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
||||
if (OriginAttributes::IsFirstPartyEnabled()) {
|
||||
if (accessingDS == accessingRootDS &&
|
||||
aAccessingItem->ItemType() == nsIDocShellTreeItem::typeContent &&
|
||||
!accessingDS->GetIsMozBrowserOrApp()) {
|
||||
!accessingDS->GetIsMozBrowser()) {
|
||||
|
||||
nsCOMPtr<nsIDocument> accessingDoc = aAccessingItem->GetDocument();
|
||||
|
||||
@@ -3572,7 +3565,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
||||
|
||||
if (targetDS == targetRootDS &&
|
||||
aTargetItem->ItemType() == nsIDocShellTreeItem::typeContent &&
|
||||
!targetDS->GetIsMozBrowserOrApp()) {
|
||||
!targetDS->GetIsMozBrowser()) {
|
||||
|
||||
nsCOMPtr<nsIDocument> targetDoc = aAccessingItem->GetDocument();
|
||||
|
||||
@@ -3769,7 +3762,7 @@ nsDocShell::DoFindItemWithName(const nsAString& aName,
|
||||
|
||||
// If we have a same-type parent, respecting browser and app boundaries.
|
||||
// NOTE: Could use GetSameTypeParent if the issues described in bug 1310344 are fixed.
|
||||
if (!GetIsMozBrowserOrApp() && parentAsTreeItem->ItemType() == mItemType) {
|
||||
if (!GetIsMozBrowser() && parentAsTreeItem->ItemType() == mItemType) {
|
||||
return parentAsTreeItem->FindItemWithName(
|
||||
aName,
|
||||
static_cast<nsIDocShellTreeItem*>(this),
|
||||
@@ -5282,16 +5275,6 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
|
||||
errorPageUrl.AppendLiteral("&f=");
|
||||
errorPageUrl.AppendASCII(frameType.get());
|
||||
|
||||
// Append the manifest URL if the error comes from an app.
|
||||
nsString manifestURL;
|
||||
nsresult rv = GetAppManifestURL(manifestURL);
|
||||
if (manifestURL.Length() > 0) {
|
||||
nsCString manifestParam;
|
||||
SAFE_ESCAPE(manifestParam, NS_ConvertUTF16toUTF8(manifestURL), url_Path);
|
||||
errorPageUrl.AppendLiteral("&m=");
|
||||
errorPageUrl.AppendASCII(manifestParam.get());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICaptivePortalService> cps = do_GetService(NS_CAPTIVEPORTAL_CID);
|
||||
int32_t cpsState;
|
||||
if (cps && NS_SUCCEEDED(cps->GetState(&cpsState)) &&
|
||||
@@ -5305,7 +5288,7 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
|
||||
errorPageUrl.AppendASCII(escapedDescription.get());
|
||||
|
||||
nsCOMPtr<nsIURI> errorPageURI;
|
||||
rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return InternalLoad(errorPageURI, nullptr, false, false,
|
||||
@@ -6190,9 +6173,7 @@ nsDocShell::SetIsActive(bool aIsActive)
|
||||
mScriptGlobal->SetIsBackground(!aIsActive);
|
||||
if (nsCOMPtr<nsIDocument> doc = mScriptGlobal->GetExtantDoc()) {
|
||||
// Update orientation when the top-level browsing context becomes active.
|
||||
// We make an exception for apps because they currently rely on
|
||||
// orientation locks persisting across browsing contexts.
|
||||
if (aIsActive && !GetIsApp()) {
|
||||
if (aIsActive) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
GetSameTypeParent(getter_AddRefs(parent));
|
||||
if (!parent) {
|
||||
@@ -6229,7 +6210,7 @@ nsDocShell::SetIsActive(bool aIsActive)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!docshell->GetIsMozBrowserOrApp()) {
|
||||
if (!docshell->GetIsMozBrowser()) {
|
||||
docshell->SetIsActive(aIsActive);
|
||||
}
|
||||
}
|
||||
@@ -10565,9 +10546,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
// lock the orientation of the document to the document's default
|
||||
// orientation. We don't explicitly check for a top-level browsing context
|
||||
// here because orientation is only set on top-level browsing contexts.
|
||||
// We make an exception for apps because they currently rely on
|
||||
// orientation locks persisting across browsing contexts.
|
||||
if (OrientationLock() != eScreenOrientation_None && !GetIsApp()) {
|
||||
if (OrientationLock() != eScreenOrientation_None) {
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
GetSameTypeParent(getter_AddRefs(parent));
|
||||
@@ -10950,7 +10929,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
NeckoOriginAttributes neckoAttrs;
|
||||
bool isTopLevelDoc = aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT &&
|
||||
mItemType == typeContent &&
|
||||
!GetIsMozBrowserOrApp();
|
||||
!GetIsMozBrowser();
|
||||
neckoAttrs.InheritFromDocShellToNecko(GetOriginAttributes(), isTopLevelDoc, aURI);
|
||||
rv = loadInfo->SetOriginAttributes(neckoAttrs);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
@@ -14387,16 +14366,9 @@ nsDocShell::GetFrameType(uint32_t* aFrameType)
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsApp(bool* aIsApp)
|
||||
nsDocShell::GetIsMozBrowser(bool* aIsMozBrowser)
|
||||
{
|
||||
*aIsApp = (mFrameType == FRAME_TYPE_APP);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsMozBrowserOrApp(bool* aIsMozBrowserOrApp)
|
||||
{
|
||||
*aIsMozBrowserOrApp = (mFrameType != FRAME_TYPE_REGULAR);
|
||||
*aIsMozBrowser = (mFrameType == FRAME_TYPE_BROWSER);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -14419,30 +14391,9 @@ nsDocShell::GetInheritedFrameType()
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsIsolatedMozBrowserElement(bool* aIsIsolatedMozBrowserElement)
|
||||
nsDocShell::GetIsInMozBrowser(bool* aIsInMozBrowser)
|
||||
{
|
||||
bool result = mFrameType == FRAME_TYPE_BROWSER &&
|
||||
mOriginAttributes.mInIsolatedMozBrowser;
|
||||
*aIsIsolatedMozBrowserElement = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement)
|
||||
{
|
||||
MOZ_ASSERT(!mOriginAttributes.mInIsolatedMozBrowser ||
|
||||
(GetInheritedFrameType() == FRAME_TYPE_BROWSER),
|
||||
"Isolated mozbrowser should only be true inside browser frames");
|
||||
bool result = (GetInheritedFrameType() == FRAME_TYPE_BROWSER) &&
|
||||
mOriginAttributes.mInIsolatedMozBrowser;
|
||||
*aIsInIsolatedMozBrowserElement = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetIsInMozBrowserOrApp(bool* aIsInMozBrowserOrApp)
|
||||
{
|
||||
*aIsInMozBrowserOrApp = (GetInheritedFrameType() != FRAME_TYPE_REGULAR);
|
||||
*aIsInMozBrowser = (GetInheritedFrameType() == FRAME_TYPE_BROWSER);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -14460,25 +14411,6 @@ nsDocShell::GetIsTopLevelContentDocShell(bool* aIsTopLevelContentDocShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [infallible] */ NS_IMETHODIMP
|
||||
nsDocShell::GetAppId(uint32_t* aAppId)
|
||||
{
|
||||
if (mOriginAttributes.mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
*aAppId = mOriginAttributes.mAppId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent;
|
||||
GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent));
|
||||
|
||||
if (!parent) {
|
||||
*aAppId = nsIScriptSecurityManager::NO_APP_ID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return parent->GetAppId(aAppId);
|
||||
}
|
||||
|
||||
// Implements nsILoadContext.originAttributes
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetOriginAttributes(JS::MutableHandle<JS::Value> aVal)
|
||||
@@ -14587,23 +14519,6 @@ nsDocShell::SetOriginAttributes(JS::Handle<JS::Value> aOriginAttributes,
|
||||
return SetOriginAttributes(attrs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAppManifestURL(nsAString& aAppManifestURL)
|
||||
{
|
||||
uint32_t appId = nsIDocShell::GetAppId();
|
||||
if (appId != nsIScriptSecurityManager::NO_APP_ID &&
|
||||
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
NS_ASSERTION(appsService, "No AppsService available");
|
||||
appsService->GetManifestURLByLocalId(appId, aAppManifestURL);
|
||||
} else {
|
||||
aAppManifestURL.SetLength(0);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
|
||||
{
|
||||
|
||||
@@ -786,8 +786,6 @@ protected:
|
||||
static const nsCString FrameTypeToString(uint32_t aFrameType)
|
||||
{
|
||||
switch (aFrameType) {
|
||||
case FRAME_TYPE_APP:
|
||||
return NS_LITERAL_CSTRING("app");
|
||||
case FRAME_TYPE_BROWSER:
|
||||
return NS_LITERAL_CSTRING("browser");
|
||||
case FRAME_TYPE_REGULAR:
|
||||
|
||||
@@ -827,109 +827,50 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||
*/
|
||||
[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.
|
||||
*/
|
||||
const unsigned long FRAME_TYPE_REGULAR = 0;
|
||||
const unsigned long FRAME_TYPE_BROWSER = 1;
|
||||
const unsigned long FRAME_TYPE_APP = 2;
|
||||
|
||||
[infallible] attribute unsigned long frameType;
|
||||
|
||||
/**
|
||||
* Returns true if this docshell corresponds to an <iframe mozbrowser> or
|
||||
* <iframe mozapp>. <xul:browser> returns false here.
|
||||
* Returns true if this docshell corresponds to an <iframe mozbrowser>.
|
||||
* <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
|
||||
* 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.
|
||||
*/
|
||||
[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.
|
||||
* Returns true if this docshell corresponds to an <iframe mozbrowser>, or
|
||||
* if this docshell is contained in an <iframe mozbrowser>. <xul:browser>
|
||||
* returns false here.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
[infallible] readonly attribute boolean isInMozBrowserOrApp;
|
||||
[infallible] readonly attribute boolean isInMozBrowser;
|
||||
|
||||
/**
|
||||
* Returns true if this docshell is the top level content docshell.
|
||||
*/
|
||||
[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
|
||||
* mozbrowser> and <iframe mozapp> boundaries.
|
||||
* mozbrowser> boundaries.
|
||||
*/
|
||||
nsIDocShell getSameTypeParentIgnoreBrowserAndAppBoundaries();
|
||||
nsIDocShell getSameTypeParentIgnoreBrowserBoundaries();
|
||||
|
||||
/**
|
||||
* 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
|
||||
* docshell.
|
||||
* True if asynchronous panning and zooming is enabled for this docshell.
|
||||
*/
|
||||
readonly attribute bool asyncPanZoomEnabled;
|
||||
|
||||
|
||||
@@ -57,10 +57,9 @@ interface nsIDocShellTreeItem : nsISupports
|
||||
|
||||
/*
|
||||
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>
|
||||
or <iframe mozapp>, it will instead return nullptr. This call is a
|
||||
convience function for those wishing to not cross the boundaries at
|
||||
which item types change.
|
||||
is of a different itemType, or if the parent is an <iframe mozbrowser>.
|
||||
It will instead return nullptr. This call is a convience function for
|
||||
Ithose wishing to not cross the boundaries at which item types change.
|
||||
*/
|
||||
readonly attribute nsIDocShellTreeItem sameTypeParent;
|
||||
|
||||
|
||||
@@ -104,21 +104,6 @@ interface nsILoadContext : nsISupports
|
||||
*/
|
||||
[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
|
||||
* nsILoadContext.
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict"
|
||||
|
||||
function debug(s) {
|
||||
//dump("-*- AppsService.js: " + s + "\n");
|
||||
}
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
const APPS_SERVICE_CID = Components.ID("{05072afa-92fe-45bf-ae22-39b69c117058}");
|
||||
|
||||
function AppsService()
|
||||
{
|
||||
debug("AppsService Constructor");
|
||||
this.inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
|
||||
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
debug("inParent: " + this.inParent);
|
||||
if (!this.inParent) {
|
||||
Cu.import("resource://gre/modules/AppsServiceChild.jsm");
|
||||
}
|
||||
}
|
||||
|
||||
AppsService.prototype = {
|
||||
|
||||
isInvalidId: function(localId) {
|
||||
return (localId == Ci.nsIScriptSecurityManager.NO_APP_ID ||
|
||||
localId == Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID);
|
||||
},
|
||||
|
||||
getAppByManifestURL: function getAppByManifestURL(aManifestURL) {
|
||||
debug("GetAppByManifestURL( " + aManifestURL + " )");
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getManifestFor: function getManifestFor(aManifestURL) {
|
||||
debug("getManifestFor(" + aManifestURL + ")");
|
||||
if (this.inParent) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
} else {
|
||||
return Promise.reject(
|
||||
new Error("Calling getManifestFor() from child is not supported"));
|
||||
}
|
||||
},
|
||||
|
||||
getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aManifestURL) {
|
||||
debug("getAppLocalIdByManifestURL( " + aManifestURL + " )");
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getAppLocalIdByStoreId: function getAppLocalIdByStoreId(aStoreId) {
|
||||
debug("getAppLocalIdByStoreId( " + aStoreId + " )");
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getAppByLocalId: function getAppByLocalId(aLocalId) {
|
||||
debug("getAppByLocalId( " + aLocalId + " )");
|
||||
if (this.isInvalidId(aLocalId)) {
|
||||
return null;
|
||||
}
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) {
|
||||
debug("getManifestURLByLocalId( " + aLocalId + " )");
|
||||
if (this.isInvalidId(aLocalId)) {
|
||||
return null;
|
||||
}
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getCoreAppsBasePath: function getCoreAppsBasePath() {
|
||||
debug("getCoreAppsBasePath()");
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getWebAppsBasePath: function getWebAppsBasePath() {
|
||||
debug("getWebAppsBasePath()");
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
areAnyAppsInstalled: function() {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getAppInfo: function getAppInfo(aAppId) {
|
||||
debug("getAppInfo()");
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getScopeByLocalId: function(aLocalId) {
|
||||
debug("getScopeByLocalId( " + aLocalId + " )");
|
||||
if (this.isInvalidId(aLocalId)) {
|
||||
return null;
|
||||
}
|
||||
// TODO : implement properly!
|
||||
// We just return null for now to not break PushService.jsm
|
||||
return null;
|
||||
},
|
||||
|
||||
classID : APPS_SERVICE_CID,
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService])
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AppsService])
|
||||
@@ -1,2 +0,0 @@
|
||||
component {05072afa-92fe-45bf-ae22-39b69c117058} AppsService.js
|
||||
contract @mozilla.org/AppsService;1 {05072afa-92fe-45bf-ae22-39b69c117058}
|
||||
@@ -1,408 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
// This module exposes a subset of the functionalities of the parent DOM
|
||||
// Registry to content processes, to be used from the AppsService component.
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["DOMApplicationRegistry", "WrappedManifestCache"];
|
||||
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function debug(s) {
|
||||
//dump("-*- AppsServiceChild.jsm: " + s + "\n");
|
||||
}
|
||||
|
||||
const APPS_IPC_MSG_NAMES = [
|
||||
"Webapps:AddApp",
|
||||
"Webapps:RemoveApp",
|
||||
"Webapps:UpdateApp",
|
||||
"Webapps:CheckForUpdate:Return:KO",
|
||||
"Webapps:FireEvent",
|
||||
"Webapps:UpdateState"
|
||||
];
|
||||
|
||||
// A simple cache for the wrapped manifests.
|
||||
this.WrappedManifestCache = {
|
||||
_cache: { },
|
||||
|
||||
// Gets an entry from the cache, and populates the cache if needed.
|
||||
get: function mcache_get(aManifestURL, aManifest, aWindow, aInnerWindowID) {
|
||||
if (!aManifest) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(aManifestURL in this._cache)) {
|
||||
this._cache[aManifestURL] = { };
|
||||
}
|
||||
|
||||
let winObjs = this._cache[aManifestURL];
|
||||
if (!(aInnerWindowID in winObjs)) {
|
||||
winObjs[aInnerWindowID] = Cu.cloneInto(aManifest, aWindow);
|
||||
}
|
||||
|
||||
return winObjs[aInnerWindowID];
|
||||
},
|
||||
|
||||
// Invalidates an entry in the cache.
|
||||
evict: function mcache_evict(aManifestURL, aInnerWindowID) {
|
||||
debug("Evicting manifest " + aManifestURL + " window ID " +
|
||||
aInnerWindowID);
|
||||
if (aManifestURL in this._cache) {
|
||||
let winObjs = this._cache[aManifestURL];
|
||||
if (aInnerWindowID in winObjs) {
|
||||
delete winObjs[aInnerWindowID];
|
||||
}
|
||||
|
||||
if (Object.keys(winObjs).length == 0) {
|
||||
delete this._cache[aManifestURL];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
// Clear the cache on memory pressure.
|
||||
this._cache = { };
|
||||
Cu.forceGC();
|
||||
},
|
||||
|
||||
init: function() {
|
||||
Services.obs.addObserver(this, "memory-pressure", false);
|
||||
}
|
||||
};
|
||||
|
||||
this.WrappedManifestCache.init();
|
||||
|
||||
|
||||
// DOMApplicationRegistry keeps a cache containing a list of apps in the device.
|
||||
// This information is updated with the data received from the main process and
|
||||
// it is queried by the DOM objects to set their state.
|
||||
// This module handle all the messages broadcasted from the parent process,
|
||||
// including DOM events, which are dispatched to the corresponding DOM objects.
|
||||
|
||||
this.DOMApplicationRegistry = {
|
||||
// DOMApps will hold a list of arrays of weak references to
|
||||
// mozIDOMApplication objects indexed by manifest URL.
|
||||
DOMApps: {},
|
||||
|
||||
ready: false,
|
||||
webapps: null,
|
||||
|
||||
init: function init() {
|
||||
this.cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsISyncMessageSender);
|
||||
|
||||
APPS_IPC_MSG_NAMES.forEach((function(aMsgName) {
|
||||
this.cpmm.addMessageListener(aMsgName, this);
|
||||
}).bind(this));
|
||||
|
||||
this.webapps = { };
|
||||
// We need a fast mapping from localId -> app, so we add an index.
|
||||
// We also add the manifest to the app object.
|
||||
this.localIdIndex = { };
|
||||
for (let id in this.webapps) {
|
||||
let app = this.webapps[id];
|
||||
this.localIdIndex[app.localId] = app;
|
||||
app.manifest = list.manifests[id];
|
||||
}
|
||||
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
},
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
// cpmm.addMessageListener causes the DOMApplicationRegistry object to
|
||||
// live forever if we don't clean up properly.
|
||||
this.webapps = null;
|
||||
this.DOMApps = null;
|
||||
|
||||
APPS_IPC_MSG_NAMES.forEach((aMsgName) => {
|
||||
this.cpmm.removeMessageListener(aMsgName, this);
|
||||
});
|
||||
},
|
||||
|
||||
receiveMessage: function receiveMessage(aMessage) {
|
||||
debug("Received " + aMessage.name + " message.");
|
||||
let msg = aMessage.data;
|
||||
switch (aMessage.name) {
|
||||
case "Webapps:AddApp":
|
||||
this.webapps[msg.id] = msg.app;
|
||||
this.localIdIndex[msg.app.localId] = msg.app;
|
||||
if (msg.manifest) {
|
||||
this.webapps[msg.id].manifest = msg.manifest;
|
||||
}
|
||||
break;
|
||||
case "Webapps:RemoveApp":
|
||||
delete this.DOMApps[this.webapps[msg.id].manifestURL];
|
||||
delete this.localIdIndex[this.webapps[msg.id].localId];
|
||||
delete this.webapps[msg.id];
|
||||
break;
|
||||
case "Webapps:UpdateApp":
|
||||
let app = this.webapps[msg.oldId];
|
||||
if (!app) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.app) {
|
||||
for (let prop in msg.app) {
|
||||
app[prop] = msg.app[prop];
|
||||
}
|
||||
}
|
||||
|
||||
this.webapps[msg.newId] = app;
|
||||
this.localIdIndex[app.localId] = app;
|
||||
delete this.webapps[msg.oldId];
|
||||
|
||||
let apps = this.DOMApps[msg.app.manifestURL];
|
||||
if (!apps) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < apps.length; i++) {
|
||||
let domApp = apps[i].get();
|
||||
if (!domApp || domApp._window === null) {
|
||||
apps.splice(i, 1);
|
||||
continue;
|
||||
}
|
||||
domApp._proxy = new Proxy(domApp, {
|
||||
get: function(target, prop) {
|
||||
if (!DOMApplicationRegistry.webapps[msg.newId]) {
|
||||
return;
|
||||
}
|
||||
return DOMApplicationRegistry.webapps[msg.newId][prop];
|
||||
},
|
||||
set: function(target, prop, val) {
|
||||
if (!DOMApplicationRegistry.webapps[msg.newId]) {
|
||||
return;
|
||||
}
|
||||
DOMApplicationRegistry.webapps[msg.newId][prop] = val;
|
||||
return;
|
||||
},
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "Webapps:FireEvent":
|
||||
this._fireEvent(aMessage);
|
||||
break;
|
||||
case "Webapps:UpdateState":
|
||||
this._updateState(msg);
|
||||
break;
|
||||
case "Webapps:CheckForUpdate:Return:KO":
|
||||
let DOMApps = this.DOMApps[msg.manifestURL];
|
||||
if (!DOMApps || !msg.requestID) {
|
||||
return;
|
||||
}
|
||||
DOMApps.forEach((DOMApp) => {
|
||||
let domApp = DOMApp.get();
|
||||
if (domApp && msg.requestID) {
|
||||
domApp._fireRequestResult(aMessage, true /* aIsError */);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* mozIDOMApplication management
|
||||
*/
|
||||
|
||||
// Every time a DOM app is created, we save a weak reference to it that will
|
||||
// be used to dispatch events and fire request results.
|
||||
addDOMApp: function(aApp, aManifestURL, aId) {
|
||||
let weakRef = Cu.getWeakReference(aApp);
|
||||
|
||||
if (!this.DOMApps[aManifestURL]) {
|
||||
this.DOMApps[aManifestURL] = [];
|
||||
}
|
||||
|
||||
let apps = this.DOMApps[aManifestURL];
|
||||
|
||||
// Get rid of dead weak references.
|
||||
for (let i = 0; i < apps.length; i++) {
|
||||
let app = apps[i].get();
|
||||
if (!app || app._window === null) {
|
||||
apps.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
apps.push(weakRef);
|
||||
|
||||
// Each DOM app contains a proxy object used to build their state. We
|
||||
// return the handler for this proxy object with traps to get and set
|
||||
// app properties kept in the DOMApplicationRegistry app cache.
|
||||
return {
|
||||
get: function(target, prop) {
|
||||
if (!DOMApplicationRegistry.webapps[aId]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (prop in DOMApplicationRegistry.webapps[aId]) {
|
||||
return DOMApplicationRegistry.webapps[aId][prop];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
set: function(target, prop, val) {
|
||||
if (!DOMApplicationRegistry.webapps[aId]) {
|
||||
return;
|
||||
}
|
||||
DOMApplicationRegistry.webapps[aId][prop] = val;
|
||||
return;
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
_fireEvent: function(aMessage) {
|
||||
let msg = aMessage.data;
|
||||
debug("_fireEvent " + JSON.stringify(msg));
|
||||
if (!this.DOMApps || !msg.manifestURL || !msg.eventType) {
|
||||
return;
|
||||
}
|
||||
|
||||
let DOMApps = this.DOMApps[msg.manifestURL];
|
||||
if (!DOMApps) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The parent might ask childs to trigger more than one event in one
|
||||
// shot, so in order to avoid needless IPC we allow an array for the
|
||||
// 'eventType' IPC message field.
|
||||
if (!Array.isArray(msg.eventType)) {
|
||||
msg.eventType = [msg.eventType];
|
||||
}
|
||||
|
||||
DOMApps.forEach((DOMApp) => {
|
||||
let domApp = DOMApp.get();
|
||||
if (!domApp) {
|
||||
return;
|
||||
}
|
||||
msg.eventType.forEach((aEventType) => {
|
||||
if ('on' + aEventType in domApp) {
|
||||
domApp._fireEvent(aEventType);
|
||||
}
|
||||
});
|
||||
|
||||
if (msg.requestID) {
|
||||
aMessage.data.result = msg.manifestURL;
|
||||
domApp._fireRequestResult(aMessage);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_updateState: function(aMessage) {
|
||||
if (!this.DOMApps || !aMessage.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
let app = this.webapps[aMessage.id];
|
||||
if (!app) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aMessage.app) {
|
||||
for (let prop in aMessage.app) {
|
||||
app[prop] = aMessage.app[prop];
|
||||
}
|
||||
}
|
||||
|
||||
if ("error" in aMessage) {
|
||||
app.downloadError = aMessage.error;
|
||||
}
|
||||
|
||||
if (aMessage.manifest) {
|
||||
app.manifest = aMessage.manifest;
|
||||
// Evict the wrapped manifest cache for all the affected DOM objects.
|
||||
let DOMApps = this.DOMApps[app.manifestURL];
|
||||
if (!DOMApps) {
|
||||
return;
|
||||
}
|
||||
DOMApps.forEach((DOMApp) => {
|
||||
let domApp = DOMApp.get();
|
||||
if (!domApp) {
|
||||
return;
|
||||
}
|
||||
WrappedManifestCache.evict(app.manifestURL, domApp.innerWindowID);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getAll: function(aCallback) {
|
||||
debug("getAll()\n");
|
||||
if (!aCallback || typeof aCallback !== "function") {
|
||||
return;
|
||||
}
|
||||
|
||||
let res = [];
|
||||
for (let id in this.webapps) {
|
||||
res.push(this.webapps[id]);
|
||||
}
|
||||
aCallback(res);
|
||||
},
|
||||
|
||||
getAdditionalLanguages: function(aManifestURL) {
|
||||
for (let id in this.webapps) {
|
||||
if (this.webapps[id].manifestURL == aManifestURL) {
|
||||
return this.webapps[id].additionalLanguages || {};
|
||||
}
|
||||
}
|
||||
return {};
|
||||
},
|
||||
|
||||
/**
|
||||
* nsIAppsService API
|
||||
*/
|
||||
getAppByManifestURL: function getAppByManifestURL(aManifestURL) {
|
||||
debug("getAppByManifestURL " + aManifestURL);
|
||||
return AppsUtils.getAppByManifestURL(this.webapps, aManifestURL);
|
||||
},
|
||||
|
||||
getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aManifestURL) {
|
||||
debug("getAppLocalIdByManifestURL " + aManifestURL);
|
||||
return AppsUtils.getAppLocalIdByManifestURL(this.webapps, aManifestURL);
|
||||
},
|
||||
|
||||
getAppLocalIdByStoreId: function(aStoreId) {
|
||||
debug("getAppLocalIdByStoreId:" + aStoreId);
|
||||
return AppsUtils.getAppLocalIdByStoreId(this.webapps, aStoreId);
|
||||
},
|
||||
|
||||
getAppByLocalId: function getAppByLocalId(aLocalId) {
|
||||
debug("getAppByLocalId " + aLocalId + " - ready: " + this.ready);
|
||||
let app = this.localIdIndex[aLocalId];
|
||||
if (!app) {
|
||||
debug("Ouch, No app!");
|
||||
return null;
|
||||
}
|
||||
|
||||
return new mozIApplication(app);
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) {
|
||||
debug("getManifestURLByLocalId " + aLocalId);
|
||||
return AppsUtils.getManifestURLByLocalId(this.webapps, aLocalId);
|
||||
},
|
||||
|
||||
getCoreAppsBasePath: function getCoreAppsBasePath() {
|
||||
debug("getCoreAppsBasePath() not yet supported on child!");
|
||||
return null;
|
||||
},
|
||||
|
||||
getWebAppsBasePath: function getWebAppsBasePath() {
|
||||
debug("getWebAppsBasePath() not yet supported on child!");
|
||||
return null;
|
||||
},
|
||||
|
||||
areAnyAppsInstalled: function() {
|
||||
return AppsUtils.areAnyAppsInstalled(this.webapps);
|
||||
},
|
||||
|
||||
getAppInfo: function getAppInfo(aAppId) {
|
||||
return AppsUtils.getAppInfo(this.webapps, aAppId);
|
||||
}
|
||||
}
|
||||
|
||||
DOMApplicationRegistry.init();
|
||||
+2
-81
@@ -19,14 +19,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||
"resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "appsService",
|
||||
"@mozilla.org/AppsService;1",
|
||||
"nsIAppsService");
|
||||
|
||||
// Shared code for AppsServiceChild.jsm, Webapps.jsm and Webapps.js
|
||||
// Shared code for Webapps.jsm and Webapps.js
|
||||
|
||||
this.EXPORTED_SYMBOLS =
|
||||
["AppsUtils", "ManifestHelper", "isAbsoluteURI", "mozIApplication"];
|
||||
["AppsUtils", "ManifestHelper", "isAbsoluteURI"];
|
||||
|
||||
function debug(s) {
|
||||
//dump("-*- AppsUtils.jsm: " + s + "\n");
|
||||
@@ -39,46 +35,6 @@ this.isAbsoluteURI = function(aURI) {
|
||||
Services.io.newURI(aURI, null, bar).prePath != bar.prePath;
|
||||
}
|
||||
|
||||
this.mozIApplication = function(aApp) {
|
||||
_setAppProperties(this, aApp);
|
||||
}
|
||||
|
||||
mozIApplication.prototype = {
|
||||
hasPermission: function(aPermission) {
|
||||
// This helper checks an URI inside |aApp|'s origin and part of |aApp| has a
|
||||
// specific permission. It is not checking if browsers inside |aApp| have such
|
||||
// permission.
|
||||
let perm = Services.perms.testExactPermissionFromPrincipal(this.principal,
|
||||
aPermission);
|
||||
return (perm === Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
},
|
||||
|
||||
get principal() {
|
||||
if (this._principal) {
|
||||
return this._principal;
|
||||
}
|
||||
|
||||
this._principal = null;
|
||||
|
||||
try {
|
||||
this._principal = Services.scriptSecurityManager.createCodebasePrincipal(
|
||||
Services.io.newURI(this.origin, null, null),
|
||||
{appId: this.localId});
|
||||
} catch(e) {
|
||||
dump("Could not create app principal " + e + "\n");
|
||||
}
|
||||
|
||||
return this._principal;
|
||||
},
|
||||
|
||||
QueryInterface: function(aIID) {
|
||||
if (aIID.equals(Ci.mozIApplication) ||
|
||||
aIID.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
function _setAppProperties(aObj, aApp) {
|
||||
aObj.name = aApp.name;
|
||||
aObj.csp = aApp.csp;
|
||||
@@ -217,21 +173,6 @@ this.AppsUtils = {
|
||||
return aPagePath.substr(pathPos, pathLen);
|
||||
},
|
||||
|
||||
getAppByManifestURL: function getAppByManifestURL(aApps, aManifestURL) {
|
||||
debug("getAppByManifestURL " + aManifestURL);
|
||||
// This could be O(1) if |webapps| was a dictionary indexed on manifestURL
|
||||
// which should be the unique app identifier.
|
||||
// It's currently O(n).
|
||||
for (let id in aApps) {
|
||||
let app = aApps[id];
|
||||
if (app.manifestURL == aManifestURL) {
|
||||
return new mozIApplication(app);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getManifestFor: function getManifestFor(aManifestURL) {
|
||||
debug("getManifestFor(" + aManifestURL + ")");
|
||||
return DOMApplicationRegistry.getManifestFor(aManifestURL);
|
||||
@@ -259,18 +200,6 @@ this.AppsUtils = {
|
||||
return Ci.nsIScriptSecurityManager.NO_APP_ID;
|
||||
},
|
||||
|
||||
getAppByLocalId: function getAppByLocalId(aApps, aLocalId) {
|
||||
debug("getAppByLocalId " + aLocalId);
|
||||
for (let id in aApps) {
|
||||
let app = aApps[id];
|
||||
if (app.localId == aLocalId) {
|
||||
return new mozIApplication(app);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function getManifestURLByLocalId(aApps, aLocalId) {
|
||||
debug("getManifestURLByLocalId " + aLocalId);
|
||||
for (let id in aApps) {
|
||||
@@ -697,14 +626,6 @@ this.AppsUtils = {
|
||||
return this.computeHash(JSON.stringify(aObject));
|
||||
},
|
||||
|
||||
getAppManifestURLFromWindow: function(aWindow) {
|
||||
let appId = aWindow.document.nodePrincipal.appId;
|
||||
if (appId === Ci.nsIScriptSecurityManager.NO_APP_ID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return appsService.getManifestURLByLocalId(appId);
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -233,11 +233,6 @@ this.PermissionsTable = { geolocation: {
|
||||
privileged: DENY_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
"embed-apps": {
|
||||
app: DENY_ACTION,
|
||||
privileged: DENY_ACTION,
|
||||
certified: ALLOW_ACTION
|
||||
},
|
||||
"background-sensors": {
|
||||
app: DENY_ACTION,
|
||||
privileged: DENY_ACTION,
|
||||
|
||||
@@ -5,13 +5,7 @@
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'AppsService.js',
|
||||
'AppsService.manifest',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'AppsServiceChild.jsm',
|
||||
'AppsUtils.jsm',
|
||||
'PermissionsInstaller.jsm',
|
||||
'PermissionsTable.jsm',
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource:///modules/AppsUtils.jsm");
|
||||
|
||||
add_test(() => {
|
||||
let app = {
|
||||
name: "TestApp",
|
||||
csp: "aCsp",
|
||||
installOrigin: "http://installorigin.com",
|
||||
origin: "http://www.example.com",
|
||||
installTime: Date.now(),
|
||||
manifestURL: "http://www.example.com/manifest.webapp",
|
||||
appStatus: Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED,
|
||||
removable: false,
|
||||
id: 123,
|
||||
localId: 123,
|
||||
basePath: "/",
|
||||
progress: 1.0,
|
||||
installState: "installed",
|
||||
downloadAvailable: false,
|
||||
downloading: false,
|
||||
lastUpdateCheck: Date.now(),
|
||||
updateTime: Date.now(),
|
||||
etag: "aEtag",
|
||||
packageEtag: "aPackageEtag",
|
||||
manifestHash: "aManifestHash",
|
||||
packageHash: "aPackageHash",
|
||||
staged: false,
|
||||
installerAppId: 345,
|
||||
installerIsBrowser: false,
|
||||
storeId: "aStoreId",
|
||||
storeVersion: 1,
|
||||
role: "aRole",
|
||||
kind: "aKind",
|
||||
enabled: true,
|
||||
sideloaded: false
|
||||
};
|
||||
|
||||
let mozapp = new mozIApplication(app);
|
||||
|
||||
Object.keys(app).forEach((key) => {
|
||||
if (key == "principal") {
|
||||
return;
|
||||
}
|
||||
Assert.equal(app[key], mozapp[key],
|
||||
"app[" + key + "] should be equal to mozapp[" + key + "]");
|
||||
});
|
||||
|
||||
Assert.ok(mozapp.principal, "app principal should exist");
|
||||
let expectedPrincipalOrigin = app.origin + "^appId=" + app.localId;
|
||||
Assert.equal(mozapp.principal.origin, expectedPrincipalOrigin,
|
||||
"app principal origin ok");
|
||||
Assert.equal(mozapp.principal.appId, app.localId, "app principal appId ok");
|
||||
Assert.equal(mozapp.principal.isInIsolatedMozBrowserElement, false,
|
||||
"app principal isInIsolatedMozBrowserElement ok");
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
@@ -2,4 +2,3 @@
|
||||
|
||||
[test_manifestSanitizer.js]
|
||||
[test_manifestHelper.js]
|
||||
[test_moziapplication.js]
|
||||
+40
-150
@@ -30,7 +30,6 @@
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIIPCBackgroundChildCreateCallback.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
@@ -443,11 +442,9 @@ public:
|
||||
mPrincipalInfo(aPrincipalInfo),
|
||||
mOpenMode(aOpenMode),
|
||||
mWriteParams(aWriteParams),
|
||||
mPersistence(quota::PERSISTENCE_TYPE_INVALID),
|
||||
mState(eInitial),
|
||||
mResult(JS::AsmJSCache_InternalError),
|
||||
mIsApp(false),
|
||||
mEnforcingQuota(true),
|
||||
mDeleteReceived(false),
|
||||
mActorDestroyed(false),
|
||||
mOpened(false)
|
||||
{
|
||||
@@ -488,31 +485,6 @@ private:
|
||||
MOZ_ASSERT(!IsOnOwningThread());
|
||||
}
|
||||
|
||||
// This method is called on the owning thread when no cache entry was found
|
||||
// to open. If we just tried a lookup in persistent storage then we might
|
||||
// still get a hit in temporary storage (for an asm.js module that wasn't
|
||||
// compiled at install-time).
|
||||
void
|
||||
CacheMiss()
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mState == eFailedToReadMetadata ||
|
||||
mState == eWaitingToOpenCacheFileForRead);
|
||||
MOZ_ASSERT(mOpenMode == eOpenForRead);
|
||||
|
||||
if (mPersistence == quota::PERSISTENCE_TYPE_TEMPORARY) {
|
||||
Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
// Try again with a clean slate. InitOnMainThread will see that mPersistence
|
||||
// is initialized and switch to temporary storage.
|
||||
MOZ_ASSERT(mPersistence == quota::PERSISTENCE_TYPE_PERSISTENT);
|
||||
FinishOnOwningThread();
|
||||
mState = eInitial;
|
||||
NS_DispatchToMainThread(this);
|
||||
}
|
||||
|
||||
// This method is called on the owning thread when the JS engine is finished
|
||||
// reading/writing the cache entry.
|
||||
void
|
||||
@@ -542,7 +514,7 @@ private:
|
||||
|
||||
FinishOnOwningThread();
|
||||
|
||||
if (!mActorDestroyed) {
|
||||
if (!mDeleteReceived && !mActorDestroyed) {
|
||||
Unused << Send__delete__(this, mResult);
|
||||
}
|
||||
}
|
||||
@@ -561,9 +533,6 @@ private:
|
||||
MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
|
||||
}
|
||||
|
||||
void
|
||||
InitPersistenceType();
|
||||
|
||||
nsresult
|
||||
InitOnMainThread();
|
||||
|
||||
@@ -615,6 +584,10 @@ private:
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mState != eFinished);
|
||||
|
||||
MOZ_ASSERT(!mDeleteReceived);
|
||||
|
||||
mDeleteReceived = true;
|
||||
|
||||
if (mOpened) {
|
||||
Close();
|
||||
} else {
|
||||
@@ -666,23 +639,12 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RecvCacheMiss() override
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
CacheMiss();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIEventTarget> mOwningThread;
|
||||
const PrincipalInfo mPrincipalInfo;
|
||||
const OpenMode mOpenMode;
|
||||
const WriteParams mWriteParams;
|
||||
|
||||
// State initialized during eInitial:
|
||||
quota::PersistenceType mPersistence;
|
||||
nsCString mSuffix;
|
||||
nsCString mGroup;
|
||||
nsCString mOrigin;
|
||||
@@ -702,7 +664,6 @@ private:
|
||||
eWaitingToOpenDirectory, // Waiting to open directory
|
||||
eWaitingToOpenMetadata, // Waiting to be called back from OpenDirectory
|
||||
eReadyToReadMetadata, // Waiting to read the metadata file on the IO thread
|
||||
eFailedToReadMetadata, // Waiting to be dispatched to owning thread after fail
|
||||
eSendingMetadataForRead, // Waiting to send OnOpenMetadataForRead
|
||||
eWaitingToOpenCacheFileForRead, // Waiting to hear back from child
|
||||
eReadyToOpenCacheFileForRead, // Waiting to open cache file for read
|
||||
@@ -714,58 +675,11 @@ private:
|
||||
State mState;
|
||||
JS::AsmJSCacheResult mResult;
|
||||
|
||||
bool mIsApp;
|
||||
bool mEnforcingQuota;
|
||||
bool mDeleteReceived;
|
||||
bool mActorDestroyed;
|
||||
bool mOpened;
|
||||
};
|
||||
|
||||
void
|
||||
ParentRunnable::InitPersistenceType()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mState == eInitial);
|
||||
|
||||
if (mOpenMode == eOpenForWrite) {
|
||||
MOZ_ASSERT(mPersistence == quota::PERSISTENCE_TYPE_INVALID);
|
||||
|
||||
// If we are performing install-time caching of an app, we'd like to store
|
||||
// the cache entry in persistent storage so the entry is never evicted,
|
||||
// but we need to check that quota is not enforced for the app.
|
||||
// That justifies us in skipping all quota checks when storing the cache
|
||||
// entry and avoids all the issues around the persistent quota prompt.
|
||||
// If quota is enforced for the app, then we can still cache in temporary
|
||||
// for a likely good first-run experience.
|
||||
|
||||
MOZ_ASSERT_IF(mWriteParams.mInstalled, mIsApp);
|
||||
|
||||
if (mWriteParams.mInstalled &&
|
||||
!QuotaManager::IsQuotaEnforced(quota::PERSISTENCE_TYPE_PERSISTENT,
|
||||
mOrigin, mIsApp)) {
|
||||
mPersistence = quota::PERSISTENCE_TYPE_PERSISTENT;
|
||||
} else {
|
||||
mPersistence = quota::PERSISTENCE_TYPE_TEMPORARY;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// For the reasons described above, apps may have cache entries in both
|
||||
// persistent and temporary storage. At lookup time we don't know how and
|
||||
// where the given script was cached, so start the search in persistent
|
||||
// storage and, if that fails, search in temporary storage. (Non-apps can
|
||||
// only be stored in temporary storage.)
|
||||
|
||||
MOZ_ASSERT_IF(mPersistence != quota::PERSISTENCE_TYPE_INVALID,
|
||||
mIsApp && mPersistence == quota::PERSISTENCE_TYPE_PERSISTENT);
|
||||
|
||||
if (mPersistence == quota::PERSISTENCE_TYPE_INVALID && mIsApp) {
|
||||
mPersistence = quota::PERSISTENCE_TYPE_PERSISTENT;
|
||||
} else {
|
||||
mPersistence = quota::PERSISTENCE_TYPE_TEMPORARY;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
ParentRunnable::InitOnMainThread()
|
||||
{
|
||||
@@ -780,15 +694,9 @@ ParentRunnable::InitOnMainThread()
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = QuotaManager::GetInfoFromPrincipal(principal, &mSuffix, &mGroup,
|
||||
&mOrigin, &mIsApp);
|
||||
rv = QuotaManager::GetInfoFromPrincipal(principal, &mSuffix, &mGroup, &mOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
InitPersistenceType();
|
||||
|
||||
mEnforcingQuota =
|
||||
QuotaManager::IsQuotaEnforced(mPersistence, mOrigin, mIsApp);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -803,10 +711,9 @@ ParentRunnable::OpenDirectory()
|
||||
mState = eWaitingToOpenMetadata;
|
||||
|
||||
// XXX The exclusive lock shouldn't be needed for read operations.
|
||||
QuotaManager::Get()->OpenDirectory(mPersistence,
|
||||
QuotaManager::Get()->OpenDirectory(quota::PERSISTENCE_TYPE_TEMPORARY,
|
||||
mGroup,
|
||||
mOrigin,
|
||||
mIsApp,
|
||||
quota::Client::ASMJS,
|
||||
/* aExclusive */ true,
|
||||
this);
|
||||
@@ -822,8 +729,11 @@ ParentRunnable::ReadMetadata()
|
||||
MOZ_ASSERT(qm, "We are on the QuotaManager's IO thread");
|
||||
|
||||
nsresult rv =
|
||||
qm->EnsureOriginIsInitialized(mPersistence, mSuffix, mGroup, mOrigin,
|
||||
mIsApp, getter_AddRefs(mDirectory));
|
||||
qm->EnsureOriginIsInitialized(quota::PERSISTENCE_TYPE_TEMPORARY,
|
||||
mSuffix,
|
||||
mGroup,
|
||||
mOrigin,
|
||||
getter_AddRefs(mDirectory));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
mResult = JS::AsmJSCache_StorageInitFailure;
|
||||
return rv;
|
||||
@@ -894,25 +804,23 @@ ParentRunnable::OpenCacheFileForWrite()
|
||||
QuotaManager* qm = QuotaManager::Get();
|
||||
MOZ_ASSERT(qm, "We are on the QuotaManager's IO thread");
|
||||
|
||||
if (mEnforcingQuota) {
|
||||
// Create the QuotaObject before all file IO and keep it alive until caching
|
||||
// completes to get maximum assertion coverage in QuotaManager against
|
||||
// concurrent removal, etc.
|
||||
mQuotaObject = qm->GetQuotaObject(mPersistence, mGroup, mOrigin, file);
|
||||
NS_ENSURE_STATE(mQuotaObject);
|
||||
// Create the QuotaObject before all file IO and keep it alive until caching
|
||||
// completes to get maximum assertion coverage in QuotaManager against
|
||||
// concurrent removal, etc.
|
||||
mQuotaObject = qm->GetQuotaObject(quota::PERSISTENCE_TYPE_TEMPORARY, mGroup, mOrigin, file);
|
||||
NS_ENSURE_STATE(mQuotaObject);
|
||||
|
||||
if (!mQuotaObject->MaybeUpdateSize(mWriteParams.mSize,
|
||||
/* aTruncate */ false)) {
|
||||
// If the request fails, it might be because mOrigin is using too much
|
||||
// space (MaybeUpdateSize will not evict our own origin since it is
|
||||
// active). Try to make some space by evicting LRU entries until there is
|
||||
// enough space.
|
||||
EvictEntries(mDirectory, mGroup, mOrigin, mWriteParams.mSize, mMetadata);
|
||||
if (!mQuotaObject->MaybeUpdateSize(mWriteParams.mSize,
|
||||
/* aTruncate */ false)) {
|
||||
// If the request fails, it might be because mOrigin is using too much
|
||||
// space (MaybeUpdateSize will not evict our own origin since it is
|
||||
// active). Try to make some space by evicting LRU entries until there is
|
||||
// enough space.
|
||||
EvictEntries(mDirectory, mGroup, mOrigin, mWriteParams.mSize, mMetadata);
|
||||
if (!mQuotaObject->MaybeUpdateSize(mWriteParams.mSize,
|
||||
/* aTruncate */ false)) {
|
||||
mResult = JS::AsmJSCache_QuotaExceeded;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mResult = JS::AsmJSCache_QuotaExceeded;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,13 +856,11 @@ ParentRunnable::OpenCacheFileForRead()
|
||||
QuotaManager* qm = QuotaManager::Get();
|
||||
MOZ_ASSERT(qm, "We are on the QuotaManager's IO thread");
|
||||
|
||||
if (mEnforcingQuota) {
|
||||
// Even though it's not strictly necessary, create the QuotaObject before
|
||||
// all file IO and keep it alive until caching completes to get maximum
|
||||
// assertion coverage in QuotaManager against concurrent removal, etc.
|
||||
mQuotaObject = qm->GetQuotaObject(mPersistence, mGroup, mOrigin, file);
|
||||
NS_ENSURE_STATE(mQuotaObject);
|
||||
}
|
||||
// Even though it's not strictly necessary, create the QuotaObject before
|
||||
// all file IO and keep it alive until caching completes to get maximum
|
||||
// assertion coverage in QuotaManager against concurrent removal, etc.
|
||||
mQuotaObject = qm->GetQuotaObject(quota::PERSISTENCE_TYPE_TEMPORARY, mGroup, mOrigin, file);
|
||||
NS_ENSURE_STATE(mQuotaObject);
|
||||
|
||||
rv = file->GetFileSize(&mFileSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@@ -1058,8 +964,7 @@ ParentRunnable::Run()
|
||||
|
||||
rv = ReadMetadata();
|
||||
if (NS_FAILED(rv)) {
|
||||
mState = eFailedToReadMetadata;
|
||||
MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(this, NS_DISPATCH_NORMAL));
|
||||
FailOnNonOwningThread();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1081,18 +986,6 @@ ParentRunnable::Run()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
case eFailedToReadMetadata: {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
if (mOpenMode == eOpenForRead) {
|
||||
CacheMiss();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Fail();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
case eSendingMetadataForRead: {
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mOpenMode == eOpenForRead);
|
||||
@@ -1404,11 +1297,13 @@ private:
|
||||
MOZ_ASSERT(mState == eOpening);
|
||||
|
||||
uint32_t moduleIndex;
|
||||
if (FindHashMatch(aMetadata, mReadParams, &moduleIndex)) {
|
||||
return SendSelectCacheFileToRead(moduleIndex);
|
||||
if (!FindHashMatch(aMetadata, mReadParams, &moduleIndex)) {
|
||||
Fail(JS::AsmJSCache_InternalError);
|
||||
Send__delete__(this, JS::AsmJSCache_InternalError);
|
||||
return true;
|
||||
}
|
||||
|
||||
return SendCacheMiss();
|
||||
return SendSelectCacheFileToRead(moduleIndex);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -1760,7 +1655,6 @@ CloseEntryForRead(size_t aSize,
|
||||
|
||||
JS::AsmJSCacheResult
|
||||
OpenEntryForWrite(nsIPrincipal* aPrincipal,
|
||||
bool aInstalled,
|
||||
const char16_t* aBegin,
|
||||
const char16_t* aEnd,
|
||||
size_t aSize,
|
||||
@@ -1777,7 +1671,6 @@ OpenEntryForWrite(nsIPrincipal* aPrincipal,
|
||||
static_assert(sNumFastHashChars < sMinCachedModuleLength, "HashString safe");
|
||||
|
||||
WriteParams writeParams;
|
||||
writeParams.mInstalled = aInstalled;
|
||||
writeParams.mSize = aSize;
|
||||
writeParams.mFastHash = HashString(aBegin, sNumFastHashChars);
|
||||
writeParams.mNumChars = aEnd - aBegin;
|
||||
@@ -2043,7 +1936,6 @@ ParamTraits<WriteParams>::Write(Message* aMsg, const paramType& aParam)
|
||||
WriteParam(aMsg, aParam.mFastHash);
|
||||
WriteParam(aMsg, aParam.mNumChars);
|
||||
WriteParam(aMsg, aParam.mFullHash);
|
||||
WriteParam(aMsg, aParam.mInstalled);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -2053,8 +1945,7 @@ ParamTraits<WriteParams>::Read(const Message* aMsg, PickleIterator* aIter,
|
||||
return ReadParam(aMsg, aIter, &aResult->mSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFastHash) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mNumChars) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFullHash) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mInstalled);
|
||||
ReadParam(aMsg, aIter, &aResult->mFullHash);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2064,7 +1955,6 @@ ParamTraits<WriteParams>::Log(const paramType& aParam, std::wstring* aLog)
|
||||
LogParam(aParam.mFastHash, aLog);
|
||||
LogParam(aParam.mNumChars, aLog);
|
||||
LogParam(aParam.mFullHash, aLog);
|
||||
LogParam(aParam.mInstalled, aLog);
|
||||
}
|
||||
|
||||
} // namespace IPC
|
||||
@@ -72,14 +72,12 @@ struct WriteParams
|
||||
int64_t mFastHash;
|
||||
int64_t mNumChars;
|
||||
int64_t mFullHash;
|
||||
bool mInstalled;
|
||||
|
||||
WriteParams()
|
||||
: mSize(0),
|
||||
mFastHash(0),
|
||||
mNumChars(0),
|
||||
mFullHash(0),
|
||||
mInstalled(false)
|
||||
: mSize(0)
|
||||
, mFastHash(0)
|
||||
, mNumChars(0)
|
||||
, mFullHash(0)
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -90,8 +88,8 @@ struct ReadParams
|
||||
const char16_t* mLimit;
|
||||
|
||||
ReadParams()
|
||||
: mBegin(nullptr),
|
||||
mLimit(nullptr)
|
||||
: mBegin(nullptr)
|
||||
, mLimit(nullptr)
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -120,7 +118,6 @@ CloseEntryForRead(size_t aSize,
|
||||
intptr_t aHandle);
|
||||
JS::AsmJSCacheResult
|
||||
OpenEntryForWrite(nsIPrincipal* aPrincipal,
|
||||
bool aInstalled,
|
||||
const char16_t* aBegin,
|
||||
const char16_t* aEnd,
|
||||
size_t aSize,
|
||||
|
||||
@@ -22,7 +22,6 @@ child:
|
||||
async OnOpenMetadataForRead(Metadata metadata);
|
||||
parent:
|
||||
async SelectCacheFileToRead(uint32_t moduleIndex);
|
||||
async CacheMiss();
|
||||
|
||||
child:
|
||||
// Once the cache file has been opened, the child is notified and sent an
|
||||
|
||||
@@ -64,8 +64,6 @@
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "TimeManager.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "mozIApplication.h"
|
||||
#include "WidgetUtils.h"
|
||||
#include "mozilla/dom/MediaDevices.h"
|
||||
#include "MediaManager.h"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(ThirdPartyUtil, mozIThirdPartyUtil)
|
||||
|
||||
@@ -145,7 +146,7 @@ ThirdPartyUtil::IsThirdPartyWindow(mozIDOMWindowProxy* aWindow,
|
||||
nsCOMPtr<nsIURI> parentURI;
|
||||
do {
|
||||
// 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();
|
||||
if (SameCOMIdentity(parent, current)) {
|
||||
// We're at the topmost content window. We already know the answer.
|
||||
|
||||
@@ -472,6 +472,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
||||
nsAutoString media;
|
||||
nsAutoString anchor;
|
||||
nsAutoString crossOrigin;
|
||||
nsAutoString referrerPolicy;
|
||||
nsAutoString destination;
|
||||
|
||||
crossOrigin.SetIsVoid(true);
|
||||
@@ -660,6 +661,15 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
||||
destination = value;
|
||||
destination.StripWhitespace();
|
||||
}
|
||||
} else if (attr.LowerCaseEqualsLiteral("referrerpolicy")) {
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#referrer-policy-attribute
|
||||
// The spec says that the referrer policy attribute is an enumerated attribute,
|
||||
// case insensitive and includes the empty string.
|
||||
// We will parse the value with AttributeReferrerPolicyFromString
|
||||
// later, which will handle parsing it as an enumerated attribute.
|
||||
if (referrerPolicy.IsEmpty()) {
|
||||
referrerPolicy = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,7 +683,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
||||
rv = ProcessLink(anchor, href, rel,
|
||||
// prefer RFC 5987 variant over non-I18zed version
|
||||
titleStar.IsEmpty() ? title : titleStar,
|
||||
type, media, crossOrigin, destination);
|
||||
type, media, crossOrigin, referrerPolicy, destination);
|
||||
}
|
||||
|
||||
href.Truncate();
|
||||
@@ -682,6 +692,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
||||
type.Truncate();
|
||||
media.Truncate();
|
||||
anchor.Truncate();
|
||||
referrerPolicy.Truncate();
|
||||
crossOrigin.SetIsVoid(true);
|
||||
destination.Truncate();
|
||||
|
||||
@@ -696,7 +707,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
||||
rv = ProcessLink(anchor, href, rel,
|
||||
// prefer RFC 5987 variant over non-I18zed version
|
||||
titleStar.IsEmpty() ? title : titleStar,
|
||||
type, media, crossOrigin, destination);
|
||||
type, media, crossOrigin, referrerPolicy, destination);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@@ -708,6 +719,7 @@ nsContentSink::ProcessLink(const nsSubstring& aAnchor, const nsSubstring& aHref,
|
||||
const nsSubstring& aRel, const nsSubstring& aTitle,
|
||||
const nsSubstring& aType, const nsSubstring& aMedia,
|
||||
const nsSubstring& aCrossOrigin,
|
||||
const nsAString& aReferrerPolicy,
|
||||
const nsSubstring& aDestination)
|
||||
{
|
||||
uint32_t linkTypes =
|
||||
@@ -749,7 +761,7 @@ nsContentSink::ProcessLink(const nsSubstring& aAnchor, const nsSubstring& aHref,
|
||||
|
||||
bool isAlternate = linkTypes & nsStyleLinkElement::eALTERNATE;
|
||||
return ProcessStyleLink(nullptr, aHref, isAlternate, aTitle, aType,
|
||||
aMedia);
|
||||
aMedia, aReferrerPolicy);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -758,7 +770,8 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement,
|
||||
bool aAlternate,
|
||||
const nsSubstring& aTitle,
|
||||
const nsSubstring& aType,
|
||||
const nsSubstring& aMedia)
|
||||
const nsSubstring& aMedia,
|
||||
const nsSubstring& aReferrerPolicy)
|
||||
{
|
||||
if (aAlternate && aTitle.IsEmpty()) {
|
||||
// alternates must have title return without error, for now
|
||||
@@ -797,13 +810,18 @@ nsContentSink::ProcessStyleLink(nsIContent* aElement,
|
||||
("nsContentSink::ProcessStyleLink, integrity=%s",
|
||||
NS_ConvertUTF16toUTF8(integrity).get()));
|
||||
}
|
||||
mozilla::net::ReferrerPolicy referrerPolicy =
|
||||
mozilla::net::AttributeReferrerPolicyFromString(aReferrerPolicy);
|
||||
if (referrerPolicy == net::RP_Unset) {
|
||||
referrerPolicy = mDocument->GetReferrerPolicy();
|
||||
}
|
||||
|
||||
// If this is a fragment parser, we don't want to observe.
|
||||
// We don't support CORS for processing instructions
|
||||
bool isAlternate;
|
||||
bool isExplicitlyEnabled;
|
||||
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, aAlternate,
|
||||
CORS_NONE, mDocument->GetReferrerPolicy(),
|
||||
CORS_NONE, referrerPolicy,
|
||||
integrity, mRunsToCompletion ? nullptr : this,
|
||||
&isAlternate, &isExplicitlyEnabled);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@@ -154,6 +154,7 @@ protected:
|
||||
const nsSubstring& aHref, const nsSubstring& aRel,
|
||||
const nsSubstring& aTitle, const nsSubstring& aType,
|
||||
const nsSubstring& aMedia, const nsSubstring& aCrossOrigin,
|
||||
const nsSubstring& aReferrerPolicy,
|
||||
const nsSubstring& aDestination);
|
||||
|
||||
virtual nsresult ProcessStyleLink(nsIContent* aElement,
|
||||
@@ -161,7 +162,8 @@ protected:
|
||||
bool aAlternate,
|
||||
const nsSubstring& aTitle,
|
||||
const nsSubstring& aType,
|
||||
const nsSubstring& aMedia);
|
||||
const nsSubstring& aMedia,
|
||||
const nsSubstring& aReferrerPolicy);
|
||||
|
||||
void PrefetchOrPreloadHref(const nsAString &aHref,
|
||||
nsINode *aSource,
|
||||
|
||||
@@ -6616,7 +6616,7 @@ nsContentUtils::IsUserFocusIgnored(nsINode* aNode)
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aNode);
|
||||
if (browserFrame &&
|
||||
aNode->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::ignoreuserfocus) &&
|
||||
browserFrame->GetReallyIsBrowserOrApp()) {
|
||||
browserFrame->GetReallyIsBrowser()) {
|
||||
return true;
|
||||
}
|
||||
nsPIDOMWindowOuter* win = aNode->OwnerDoc()->GetWindow();
|
||||
@@ -8868,10 +8868,8 @@ nsContentUtils::SetFetchReferrerURIWithPolicy(nsIPrincipal* aPrincipal,
|
||||
referrerURI = principalURI;
|
||||
}
|
||||
|
||||
net::ReferrerPolicy referrerPolicy = aReferrerPolicy;
|
||||
if (referrerPolicy == net::RP_Default) {
|
||||
referrerPolicy = aDoc->GetReferrerPolicy();
|
||||
}
|
||||
net::ReferrerPolicy referrerPolicy = (aReferrerPolicy != net::RP_Unset) ?
|
||||
aReferrerPolicy : net::RP_Default;
|
||||
return aChannel->SetReferrerWithPolicy(referrerURI, referrerPolicy);
|
||||
}
|
||||
|
||||
|
||||
@@ -3026,8 +3026,7 @@ nsDOMWindowUtils::GetFileReferences(const nsAString& aDatabaseName, int64_t aId,
|
||||
|
||||
nsCString origin;
|
||||
nsresult rv =
|
||||
quota::QuotaManager::GetInfoFromWindow(window, nullptr, nullptr, &origin,
|
||||
nullptr);
|
||||
quota::QuotaManager::GetInfoFromWindow(window, nullptr, nullptr, &origin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
IDBOpenDBOptions options;
|
||||
|
||||
+23
-164
@@ -12,9 +12,7 @@
|
||||
|
||||
#include "prenv.h"
|
||||
|
||||
#include "mozIApplication.h"
|
||||
#include "nsDocShell.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsIDOMHTMLIFrameElement.h"
|
||||
#include "nsIDOMHTMLFrameElement.h"
|
||||
#include "nsIDOMMozBrowserFrame.h"
|
||||
@@ -90,7 +88,6 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "mozilla/layout/RenderFrameParent.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
@@ -1071,12 +1068,6 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
|
||||
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
|
||||
// for this operation. In this case, the browser code should already have set
|
||||
// the correct userContextId attribute value in the owning XULElement, but our
|
||||
@@ -1145,10 +1136,10 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
|
||||
}
|
||||
|
||||
// Destroy browser frame scripts for content leaving a frame with browser API
|
||||
if (OwnerIsMozBrowserOrAppFrame() && !aOther->OwnerIsMozBrowserOrAppFrame()) {
|
||||
if (OwnerIsMozBrowserFrame() && !aOther->OwnerIsMozBrowserFrame()) {
|
||||
DestroyBrowserFrameScripts();
|
||||
}
|
||||
if (!OwnerIsMozBrowserOrAppFrame() && aOther->OwnerIsMozBrowserOrAppFrame()) {
|
||||
if (!OwnerIsMozBrowserFrame() && aOther->OwnerIsMozBrowserFrame()) {
|
||||
aOther->DestroyBrowserFrameScripts();
|
||||
}
|
||||
|
||||
@@ -1322,12 +1313,12 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
|
||||
bool ourFullscreenAllowed =
|
||||
ourContent->IsXULElement() ||
|
||||
(OwnerIsMozBrowserOrAppFrame() &&
|
||||
(OwnerIsMozBrowserFrame() &&
|
||||
(ourContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
|
||||
ourContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)));
|
||||
bool otherFullscreenAllowed =
|
||||
otherContent->IsXULElement() ||
|
||||
(aOther->OwnerIsMozBrowserOrAppFrame() &&
|
||||
(aOther->OwnerIsMozBrowserFrame() &&
|
||||
(otherContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
|
||||
otherContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen)));
|
||||
if (ourFullscreenAllowed != otherFullscreenAllowed) {
|
||||
@@ -1472,12 +1463,6 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
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
|
||||
// for this operation. In this case, the browser code should already have set
|
||||
// the correct userContextId attribute value in the owning XULElement, but our
|
||||
@@ -1524,10 +1509,10 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
}
|
||||
|
||||
// Destroy browser frame scripts for content leaving a frame with browser API
|
||||
if (OwnerIsMozBrowserOrAppFrame() && !aOther->OwnerIsMozBrowserOrAppFrame()) {
|
||||
if (OwnerIsMozBrowserFrame() && !aOther->OwnerIsMozBrowserFrame()) {
|
||||
DestroyBrowserFrameScripts();
|
||||
}
|
||||
if (!OwnerIsMozBrowserOrAppFrame() && aOther->OwnerIsMozBrowserOrAppFrame()) {
|
||||
if (!OwnerIsMozBrowserFrame() && aOther->OwnerIsMozBrowserFrame()) {
|
||||
aOther->DestroyBrowserFrameScripts();
|
||||
}
|
||||
|
||||
@@ -1886,102 +1871,20 @@ nsFrameLoader::SetOwnerContent(Element* aContent)
|
||||
}
|
||||
|
||||
bool
|
||||
nsFrameLoader::OwnerIsMozBrowserOrAppFrame()
|
||||
nsFrameLoader::OwnerIsMozBrowserFrame()
|
||||
{
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
||||
return browserFrame ? browserFrame->GetReallyIsBrowserOrApp() : false;
|
||||
return browserFrame ? browserFrame->GetReallyIsBrowser() : false;
|
||||
}
|
||||
|
||||
// The xpcom getter version
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetOwnerIsMozBrowserOrAppFrame(bool* aResult)
|
||||
nsFrameLoader::GetOwnerIsMozBrowserFrame(bool* aResult)
|
||||
{
|
||||
*aResult = OwnerIsMozBrowserOrAppFrame();
|
||||
*aResult = OwnerIsMozBrowserFrame();
|
||||
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
|
||||
nsFrameLoader::ShouldUseRemoteProcess()
|
||||
{
|
||||
@@ -2005,7 +1908,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
|
||||
|
||||
// If we're an <iframe mozbrowser> and we don't have a "remote" attribute,
|
||||
// fall back to the default.
|
||||
if (OwnerIsMozBrowserOrAppFrame() &&
|
||||
if (OwnerIsMozBrowserFrame() &&
|
||||
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::Remote)) {
|
||||
|
||||
return Preferences::GetBool("dom.ipc.browser_frames.oop_by_default", false);
|
||||
@@ -2013,7 +1916,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
|
||||
|
||||
// Otherwise, we're remote if we have "remote=true" and we're either a
|
||||
// browser frame or a XUL element.
|
||||
return (OwnerIsMozBrowserOrAppFrame() ||
|
||||
return (OwnerIsMozBrowserFrame() ||
|
||||
mOwnerContent->GetNameSpaceID() == kNameSpaceID_XUL) &&
|
||||
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::Remote,
|
||||
@@ -2191,13 +2094,13 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
// Inherit origin attributes from parent document if
|
||||
// 1. It's in a content docshell.
|
||||
// 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
|
||||
// doesn't exist in the top-level docshell.
|
||||
if (parentType == nsIDocShellTreeItem::typeContent &&
|
||||
!nsContentUtils::IsSystemPrincipal(doc->NodePrincipal()) &&
|
||||
!OwnerIsMozBrowserOrAppFrame()) {
|
||||
!OwnerIsMozBrowserFrame()) {
|
||||
PrincipalOriginAttributes poa = BasePrincipal::Cast(doc->NodePrincipal())->OriginAttributesRef();
|
||||
|
||||
// Assert on the firstPartyDomain from top-level docshell should be empty
|
||||
@@ -2212,42 +2115,14 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
"docshell and document should have the same appId attribute.");
|
||||
MOZ_ASSERT(attrs.mUserContextId == poa.mUserContextId,
|
||||
"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,
|
||||
"docshell and document should have the same privateBrowsingId attribute.");
|
||||
|
||||
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()) {
|
||||
// You can't be both a browser and an app frame.
|
||||
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();
|
||||
attrs.mAppId = nsIScriptSecurityManager::NO_APP_ID;
|
||||
mDocShell->SetFrameType(nsIDocShell::FRAME_TYPE_BROWSER);
|
||||
}
|
||||
|
||||
@@ -2278,7 +2153,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
}
|
||||
attrs.SyncAttributesWithPrivateBrowsing(isPrivate);
|
||||
|
||||
if (OwnerIsMozBrowserOrAppFrame()) {
|
||||
if (OwnerIsMozBrowserFrame()) {
|
||||
// For inproc frames, set the docshell properties.
|
||||
nsAutoString name;
|
||||
if (mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
|
||||
@@ -2677,7 +2552,7 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
}
|
||||
|
||||
// <iframe mozbrowser> gets to skip these checks.
|
||||
if (!OwnerIsMozBrowserOrAppFrame()) {
|
||||
if (!OwnerIsMozBrowserFrame()) {
|
||||
if (parentDocShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
|
||||
return false;
|
||||
}
|
||||
@@ -2718,8 +2593,8 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
nsCOMPtr<Element> ownerElement = mOwnerContent;
|
||||
mRemoteBrowser = ContentParent::CreateBrowserOrApp(context, ownerElement,
|
||||
openerContentParent, mFreshProcess);
|
||||
mRemoteBrowser = ContentParent::CreateBrowser(context, ownerElement,
|
||||
openerContentParent, mFreshProcess);
|
||||
if (!mRemoteBrowser) {
|
||||
return false;
|
||||
}
|
||||
@@ -2982,7 +2857,7 @@ nsFrameLoader::EnsureMessageManager()
|
||||
}
|
||||
|
||||
if (!mIsTopLevelContent &&
|
||||
!OwnerIsMozBrowserOrAppFrame() &&
|
||||
!OwnerIsMozBrowserFrame() &&
|
||||
!IsRemoteFrame() &&
|
||||
!(mOwnerContent->IsXULElement() &&
|
||||
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
||||
@@ -3287,7 +3162,7 @@ nsFrameLoader::GetLoadContext(nsILoadContext** aLoadContext)
|
||||
void
|
||||
nsFrameLoader::InitializeBrowserAPI()
|
||||
{
|
||||
if (!OwnerIsMozBrowserOrAppFrame()) {
|
||||
if (!OwnerIsMozBrowserFrame()) {
|
||||
return;
|
||||
}
|
||||
if (!IsRemoteFrame()) {
|
||||
@@ -3311,7 +3186,7 @@ nsFrameLoader::InitializeBrowserAPI()
|
||||
void
|
||||
nsFrameLoader::DestroyBrowserFrameScripts()
|
||||
{
|
||||
if (!OwnerIsMozBrowserOrAppFrame()) {
|
||||
if (!OwnerIsMozBrowserFrame()) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
||||
@@ -3392,24 +3267,10 @@ nsresult
|
||||
nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
|
||||
nsIURI* aURI)
|
||||
{
|
||||
nsCOMPtr<mozIApplication> ownApp = GetOwnApp();
|
||||
nsCOMPtr<mozIApplication> containingApp = GetContainingApp();
|
||||
DocShellOriginAttributes attrs;
|
||||
attrs.mInIsolatedMozBrowser = OwnerIsIsolatedMozBrowserFrame();
|
||||
nsresult rv;
|
||||
|
||||
// Get the AppId from ownApp
|
||||
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;
|
||||
attrs.mAppId = nsIScriptSecurityManager::NO_APP_ID; // No longer used...
|
||||
|
||||
// set the userContextId on the attrs before we pass them into
|
||||
// the tab context
|
||||
@@ -3439,8 +3300,6 @@ nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
|
||||
bool tabContextUpdated =
|
||||
aTabContext->SetTabContext(OwnerIsMozBrowserFrame(),
|
||||
mIsPrerendered,
|
||||
ownApp,
|
||||
containingApp,
|
||||
showAccelerators,
|
||||
showFocusRings,
|
||||
attrs);
|
||||
|
||||
@@ -241,53 +241,18 @@ private:
|
||||
*/
|
||||
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>?
|
||||
* <xul:browser> is not a mozbrowser, so this is false for that case.
|
||||
*/
|
||||
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
|
||||
* our owning element doesn't have an app manifest URL.
|
||||
*/
|
||||
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
|
||||
* initialize mDocShell.
|
||||
|
||||
@@ -101,7 +101,6 @@ GK_ATOM(animations, "animations")
|
||||
GK_ATOM(anonid, "anonid")
|
||||
GK_ATOM(anonlocation, "anonlocation")
|
||||
GK_ATOM(any, "any")
|
||||
GK_ATOM(mozapp, "mozapp")
|
||||
GK_ATOM(applet, "applet")
|
||||
GK_ATOM(applyImports, "apply-imports")
|
||||
GK_ATOM(applyTemplates, "apply-templates")
|
||||
@@ -664,7 +663,6 @@ GK_ATOM(nodeSet, "node-set")
|
||||
GK_ATOM(noembed, "noembed")
|
||||
GK_ATOM(noframes, "noframes")
|
||||
GK_ATOM(nohref, "nohref")
|
||||
GK_ATOM(noisolation, "noisolation")
|
||||
GK_ATOM(nomodule, "nomodule")
|
||||
GK_ATOM(nonce, "nonce")
|
||||
GK_ATOM(none, "none")
|
||||
@@ -1002,7 +1000,6 @@ GK_ATOM(panel, "panel")
|
||||
GK_ATOM(param, "param")
|
||||
GK_ATOM(parameter, "parameter")
|
||||
GK_ATOM(parent, "parent")
|
||||
GK_ATOM(parentapp, "parentapp")
|
||||
GK_ATOM(parentfocused, "parentfocused")
|
||||
GK_ATOM(parsetype, "parsetype")
|
||||
GK_ATOM(password, "password")
|
||||
|
||||
+13
-16
@@ -2300,13 +2300,11 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
nsGlobalWindow::RiskyUnlink()
|
||||
{
|
||||
NS_CYCLE_COLLECTION_INNERNAME.Unlink(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGlobalWindow)
|
||||
if (tmp->mCachedXBLPrototypeHandlers) {
|
||||
@@ -4485,7 +4483,7 @@ nsGlobalWindow::GetParentOuter()
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowOuter> parent;
|
||||
if (mDocShell->GetIsMozBrowserOrApp()) {
|
||||
if (mDocShell->GetIsMozBrowser()) {
|
||||
parent = AsOuter();
|
||||
} else {
|
||||
parent = GetParent();
|
||||
@@ -4543,7 +4541,7 @@ nsGlobalWindow::GetParent()
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent;
|
||||
mDocShell->GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent));
|
||||
mDocShell->GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent));
|
||||
|
||||
if (parent) {
|
||||
nsCOMPtr<nsPIDOMWindowOuter> win = parent->GetWindow();
|
||||
@@ -4662,9 +4660,9 @@ nsGlobalWindow::GetContentInternal(ErrorResult& aError, bool aUnprivilegedCaller
|
||||
return domWindow.forget();
|
||||
}
|
||||
|
||||
// If we're contained in <iframe mozbrowser> or <iframe mozapp>, then
|
||||
// GetContent is the same as window.top.
|
||||
if (mDocShell && mDocShell->GetIsInMozBrowserOrApp()) {
|
||||
// If we're contained in <iframe mozbrowser>, then GetContent is the same as
|
||||
// window.top.
|
||||
if (mDocShell && mDocShell->GetIsInMozBrowser()) {
|
||||
return GetTopOuter();
|
||||
}
|
||||
|
||||
@@ -7988,7 +7986,7 @@ nsGlobalWindow::ResizeToOuter(int32_t aWidth, int32_t aHeight, ErrorResult& aErr
|
||||
* If caller is a browser-element then dispatch a resize event to
|
||||
* the embedder.
|
||||
*/
|
||||
if (mDocShell && mDocShell->GetIsMozBrowserOrApp()) {
|
||||
if (mDocShell && mDocShell->GetIsMozBrowser()) {
|
||||
CSSIntSize size(aWidth, aHeight);
|
||||
if (!DispatchResizeEvent(size)) {
|
||||
// The embedder chose to prevent the default action for this
|
||||
@@ -8038,7 +8036,7 @@ nsGlobalWindow::ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif,
|
||||
* If caller is a browser-element then dispatch a resize event to
|
||||
* parent.
|
||||
*/
|
||||
if (mDocShell && mDocShell->GetIsMozBrowserOrApp()) {
|
||||
if (mDocShell && mDocShell->GetIsMozBrowser()) {
|
||||
CSSIntSize size;
|
||||
if (NS_FAILED(GetInnerSize(size))) {
|
||||
return;
|
||||
@@ -9009,7 +9007,7 @@ nsGlobalWindow::CloseOuter(bool aTrustedCaller)
|
||||
MOZ_RELEASE_ASSERT(IsOuterWindow());
|
||||
|
||||
if (!mDocShell || IsInModalState() ||
|
||||
(IsFrame() && !mDocShell->GetIsMozBrowserOrApp())) {
|
||||
(IsFrame() && !mDocShell->GetIsMozBrowser())) {
|
||||
// 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
|
||||
// currently a modal dialog open. Ignore such calls.
|
||||
@@ -9030,14 +9028,13 @@ nsGlobalWindow::CloseOuter(bool aTrustedCaller)
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow scripts from content to close non-app or non-neterror
|
||||
// windows that were not opened by script.
|
||||
// Don't allow scripts from content to close non-neterror windows that
|
||||
// were not opened by script.
|
||||
nsAutoString url;
|
||||
nsresult rv = mDoc->GetURL(url);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
if (!mDocShell->GetIsApp() &&
|
||||
!StringBeginsWith(url, NS_LITERAL_STRING("about:neterror")) &&
|
||||
if (!StringBeginsWith(url, NS_LITERAL_STRING("about:neterror")) &&
|
||||
!mHadOriginalOpener && !aTrustedCaller) {
|
||||
bool allowClose = mAllowScriptsToClose ||
|
||||
Preferences::GetBool("dom.allow_scripts_to_close_windows", true);
|
||||
@@ -9485,7 +9482,7 @@ nsGlobalWindow::GetFrameElementOuter(nsIPrincipal& aSubjectPrincipal)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(IsOuterWindow());
|
||||
|
||||
if (!mDocShell || mDocShell->GetIsMozBrowserOrApp()) {
|
||||
if (!mDocShell || mDocShell->GetIsMozBrowser()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -9520,7 +9517,7 @@ nsGlobalWindow::GetRealFrameElementOuter()
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent;
|
||||
mDocShell->GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent));
|
||||
mDocShell->GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent));
|
||||
|
||||
if (!parent || parent == mDocShell) {
|
||||
// We're at a chrome boundary, don't expose the chrome iframe
|
||||
|
||||
@@ -597,11 +597,9 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
|
||||
nsIDOMEventTarget)
|
||||
|
||||
#ifdef DEBUG
|
||||
// Call Unlink on this window. This may cause bad things to happen, so use
|
||||
// with caution.
|
||||
void RiskyUnlink();
|
||||
#endif
|
||||
|
||||
virtual JSObject*
|
||||
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) override;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface mozIApplication;
|
||||
interface nsFrameLoader;
|
||||
interface nsIDocShell;
|
||||
interface nsIURI;
|
||||
@@ -216,11 +215,10 @@ interface nsIFrameLoader : nsISupports
|
||||
[infallible] attribute boolean visible;
|
||||
|
||||
/**
|
||||
* Find out whether the owner content really is a mozbrowser or app frame
|
||||
* Especially, a widget frame is regarded as an app frame. <xul:browser> is
|
||||
* not considered to be a mozbrowser frame.
|
||||
* Find out whether the owner content really is a mozbrowser. <xul:browser>
|
||||
* is 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
|
||||
@@ -265,12 +263,6 @@ interface nsIFrameLoaderOwner : nsISupports
|
||||
[binaryname(FrameLoaderXPCOM)] readonly attribute nsIFrameLoader frameLoader;
|
||||
[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.
|
||||
*/
|
||||
|
||||
@@ -88,21 +88,24 @@ nsInProcessTabChildGlobal::DoSendAsyncMessage(JSContext* aCx,
|
||||
nsInProcessTabChildGlobal::nsInProcessTabChildGlobal(nsIDocShell* aShell,
|
||||
nsIContent* aOwner,
|
||||
nsFrameMessageManager* aChrome)
|
||||
: mDocShell(aShell), mInitialized(false), mLoadingScript(false),
|
||||
mPreventEventsEscaping(false),
|
||||
mOwner(aOwner), mChromeMessageManager(aChrome)
|
||||
: mDocShell(aShell)
|
||||
, mInitialized(false)
|
||||
, mLoadingScript(false)
|
||||
, mPreventEventsEscaping(false)
|
||||
, mOwner(aOwner)
|
||||
, mChromeMessageManager(aChrome)
|
||||
{
|
||||
SetIsNotDOMBinding();
|
||||
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.
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwner);
|
||||
if (browserFrame) {
|
||||
mIsBrowserOrAppFrame = browserFrame->GetReallyIsBrowserOrApp();
|
||||
mIsBrowserFrame = browserFrame->GetReallyIsBrowser();
|
||||
}
|
||||
else {
|
||||
mIsBrowserOrAppFrame = false;
|
||||
mIsBrowserFrame = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +275,7 @@ nsInProcessTabChildGlobal::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mIsBrowserOrAppFrame &&
|
||||
if (mIsBrowserFrame &&
|
||||
(!mOwner || !nsContentUtils::IsInChromeDocshell(mOwner->OwnerDoc()))) {
|
||||
if (mOwner) {
|
||||
if (nsPIDOMWindowInner* innerWindow = mOwner->OwnerDoc()->GetInnerWindow()) {
|
||||
|
||||
@@ -165,10 +165,9 @@ protected:
|
||||
bool mInitialized;
|
||||
bool mLoadingScript;
|
||||
|
||||
// Is this the message manager for an in-process <iframe mozbrowser> or
|
||||
// <iframe mozapp>? This affects where events get sent, so it affects
|
||||
// GetEventTargetParent.
|
||||
bool mIsBrowserOrAppFrame;
|
||||
// Is this the message manager for an in-process <iframe mozbrowser>? This
|
||||
// affects where events get sent, so it affects GetEventTargetParent.
|
||||
bool mIsBrowserFrame;
|
||||
bool mPreventEventsEscaping;
|
||||
|
||||
// We keep a strong reference to the frameloader after we've started
|
||||
|
||||
@@ -2265,7 +2265,6 @@ AsmJSCacheOpenEntryForRead(JS::Handle<JSObject*> aGlobal,
|
||||
|
||||
static JS::AsmJSCacheResult
|
||||
AsmJSCacheOpenEntryForWrite(JS::Handle<JSObject*> aGlobal,
|
||||
bool aInstalled,
|
||||
const char16_t* aBegin,
|
||||
const char16_t* aEnd,
|
||||
size_t aSize,
|
||||
@@ -2274,8 +2273,7 @@ AsmJSCacheOpenEntryForWrite(JS::Handle<JSObject*> aGlobal,
|
||||
{
|
||||
nsIPrincipal* principal =
|
||||
nsJSPrincipals::get(JS_GetCompartmentPrincipals(js::GetObjectCompartment(aGlobal)));
|
||||
return asmjscache::OpenEntryForWrite(principal, aInstalled, aBegin, aEnd,
|
||||
aSize, aMemory, aHandle);
|
||||
return asmjscache::OpenEntryForWrite(principal, aBegin, aEnd, aSize, aMemory, aHandle);
|
||||
}
|
||||
|
||||
class AsyncTaskRunnable final : public Runnable
|
||||
|
||||
@@ -1253,17 +1253,6 @@ nsObjectLoadingContent::GetFrameLoader()
|
||||
return loader.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetParentApplication(mozIApplication** aApplication)
|
||||
{
|
||||
if (!aApplication) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aApplication = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsObjectLoadingContent::PresetOpenerWindow(mozIDOMWindowProxy* aWindow, mozilla::ErrorResult& aRv)
|
||||
{
|
||||
|
||||
@@ -411,6 +411,16 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
||||
|
||||
bool doneLoading = false;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Load the link's referrerpolicy attribute. If the link does not provide a
|
||||
// referrerpolicy attribute, ignore this and use the document's referrer
|
||||
// policy
|
||||
|
||||
net::ReferrerPolicy referrerPolicy = GetLinkReferrerPolicy();
|
||||
if (referrerPolicy == net::RP_Unset) {
|
||||
referrerPolicy = doc->GetReferrerPolicy();
|
||||
}
|
||||
|
||||
if (isInline) {
|
||||
nsAutoString text;
|
||||
if (!nsContentUtils::GetNodeTextContent(thisContent, false, text, fallible)) {
|
||||
@@ -429,7 +439,7 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
||||
|
||||
// Parse the style sheet.
|
||||
rv = doc->CSSLoader()->
|
||||
LoadInlineStyle(thisContent, text, mLineNumber, title, media,
|
||||
LoadInlineStyle(thisContent, text, mLineNumber, title, media, referrerPolicy,
|
||||
scopeElement, aObserver, &doneLoading, &isAlternate, &isExplicitlyEnabled);
|
||||
} else {
|
||||
nsAutoString integrity;
|
||||
@@ -440,15 +450,6 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
|
||||
NS_ConvertUTF16toUTF8(integrity).get()));
|
||||
}
|
||||
|
||||
// if referrer attributes are enabled in preferences, load the link's referrer
|
||||
// attribute. If the link does not provide a referrer attribute, ignore this
|
||||
// and use the document's referrer policy
|
||||
|
||||
net::ReferrerPolicy referrerPolicy = GetLinkReferrerPolicy();
|
||||
if (referrerPolicy == net::RP_Unset) {
|
||||
referrerPolicy = doc->GetReferrerPolicy();
|
||||
}
|
||||
|
||||
// XXXbz clone the URI here to work around content policies modifying URIs.
|
||||
nsCOMPtr<nsIURI> clonedURI;
|
||||
uri->Clone(getter_AddRefs(clonedURI));
|
||||
|
||||
@@ -829,7 +829,6 @@ nsWindowMemoryReporter::KillCheckTimer()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* static */ void
|
||||
nsWindowMemoryReporter::UnlinkGhostWindows()
|
||||
{
|
||||
@@ -866,4 +865,3 @@ nsWindowMemoryReporter::UnlinkGhostWindows()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -150,13 +150,11 @@ public:
|
||||
|
||||
static void Init();
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* Unlink all known ghost windows, to enable investigating what caused them
|
||||
* to become ghost windows in the first place.
|
||||
*/
|
||||
static void UnlinkGhostWindows();
|
||||
#endif
|
||||
|
||||
static nsWindowMemoryReporter* Get();
|
||||
void ObserveDOMWindowDetached(nsGlobalWindow* aWindow);
|
||||
|
||||
@@ -26,7 +26,7 @@ function parentDocShell(docshell) {
|
||||
function isTopBrowserElement(docShell) {
|
||||
while (docShell) {
|
||||
docShell = parentDocShell(docShell);
|
||||
if (docShell && docShell.isMozBrowserOrApp) {
|
||||
if (docShell && docShell.isMozBrowser) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ var CopyPasteAssistent = {
|
||||
let targetDocShell = currentWindow
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation);
|
||||
if(targetDocShell.isMozBrowserOrApp) {
|
||||
if(targetDocShell.isMozBrowser) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,23 +54,6 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote)
|
||||
|
||||
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.
|
||||
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::name,
|
||||
aName, /* aNotify = */ false);
|
||||
|
||||
@@ -8,27 +8,6 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
|
||||
// We'll need to get the appId from the current document,
|
||||
// it's either SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID when
|
||||
// we are not running inside an app (e.g. Firefox Desktop),
|
||||
// or the appId of Mochitest app when we are running inside that app
|
||||
// (e.g. Emulator).
|
||||
var currentAppId = SpecialPowers.wrap(document).nodePrincipal.appId;
|
||||
var inApp =
|
||||
currentAppId !== SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID;
|
||||
// We will also need the manifest URL and set it on iframes.
|
||||
var currentAppManifestURL;
|
||||
|
||||
if (inApp) {
|
||||
let appsService = SpecialPowers.Cc["@mozilla.org/AppsService;1"]
|
||||
.getService(SpecialPowers.Ci.nsIAppsService);
|
||||
|
||||
currentAppManifestURL = appsService.getManifestURLByLocalId(currentAppId);
|
||||
};
|
||||
|
||||
info('appId=' + currentAppId);
|
||||
info('manifestURL=' + currentAppManifestURL);
|
||||
|
||||
function setup() {
|
||||
let appInfo = SpecialPowers.Cc['@mozilla.org/xre/app-info;1']
|
||||
.getService(SpecialPowers.Ci.nsIXULAppInfo);
|
||||
@@ -73,9 +52,6 @@ function createFrames() {
|
||||
for (let i = 0; i < 2; i++) {
|
||||
let frame = gInputMethodFrames[i] = document.createElement('iframe');
|
||||
frame.setAttribute('mozbrowser', 'true');
|
||||
if (currentAppManifestURL) {
|
||||
frame.setAttribute('mozapp', currentAppManifestURL);
|
||||
}
|
||||
frame.addEventListener('mozbrowserloadend', countLoadend);
|
||||
frame.src = 'file_empty.html#' + i;
|
||||
document.body.appendChild(frame);
|
||||
@@ -88,20 +64,10 @@ function setPermissions() {
|
||||
allow: true,
|
||||
context: {
|
||||
url: SimpleTest.getTestFileURL('/file_empty.html'),
|
||||
originAttributes: {
|
||||
appId: currentAppId,
|
||||
inIsolatedMozBrowser: true
|
||||
}
|
||||
originAttributes: {}
|
||||
}
|
||||
}];
|
||||
|
||||
if (inApp) {
|
||||
// The current document would also need to be given access for IPC to
|
||||
// recognize our permission (why)?
|
||||
permissions.push({
|
||||
type: 'input', allow: true, context: document });
|
||||
}
|
||||
|
||||
SpecialPowers.pushPermissions(permissions,
|
||||
SimpleTest.waitForFocus.bind(SimpleTest, startTest));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
// set 'remote' to true here will make the the iframe remote in _inproc_
|
||||
// test and in-process in _oop_ test.
|
||||
iframe.setAttribute('remote', 'true');
|
||||
iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
|
||||
|
||||
iframe.addEventListener('mozbrowserloadend', function(e) {
|
||||
ok("mute" in iframe, "iframe.mute exists");
|
||||
|
||||
@@ -13,7 +13,5 @@ support-files =
|
||||
|
||||
[test_Simple.html]
|
||||
[test_HighPriority.html]
|
||||
[test_Preallocated.html]
|
||||
disabled = bug 968604, bug 987164
|
||||
[test_WebGLContextLost.html]
|
||||
disabled = bug 865844
|
||||
@@ -1,71 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test that the preallocated process starts up with priority BACKGROUND.
|
||||
-->
|
||||
<head>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="../browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="application/javascript;version=1.7">
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
browserElementTestHelpers.enableProcessPriorityManager();
|
||||
|
||||
var preallocationEnabledPref = null;
|
||||
try {
|
||||
preallocationEnabledPref = SpecialPowers.getBoolPref('dom.ipc.processPrelaunch.enabled');
|
||||
}
|
||||
catch(e) {
|
||||
preallocationEnabledPref = null;
|
||||
}
|
||||
|
||||
var childID = null;
|
||||
|
||||
var cleanedUp = false;
|
||||
function cleanUp()
|
||||
{
|
||||
if (cleanedUp) {
|
||||
return;
|
||||
}
|
||||
|
||||
cleanedUp = true;
|
||||
}
|
||||
|
||||
// Even if this test times out, we still want to run cleanUp so as to set the
|
||||
// pref back.
|
||||
addEventListener('unload', cleanUp);
|
||||
|
||||
function runTest()
|
||||
{
|
||||
if (preallocationEnabledPref) {
|
||||
ok(false, "dom.ipc.processPrelaunch.enabled must be " +
|
||||
"false for this test to work.");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure that the preallocated process initially gets BACKGROUND priority.
|
||||
// That's it.
|
||||
expectProcessCreated('PREALLOC').then(function() {
|
||||
// We need to set the pref asynchoronously or the preallocated process won't
|
||||
// be shut down.
|
||||
SimpleTest.executeSoon(function(){
|
||||
cleanUp();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
// Setting this pref to true should cause us to prelaunch a process.
|
||||
addEventListener('testready', function() {
|
||||
SpecialPowers.pushPrefEnv({'set':[["dom.ipc.processPrelaunch.enabled",true]]},runTest);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+1
-4
@@ -259,7 +259,6 @@ Context::QuotaInitRunnable::OpenDirectory()
|
||||
QuotaManager::Get()->OpenDirectory(PERSISTENCE_TYPE_DEFAULT,
|
||||
mQuotaInfo.mGroup,
|
||||
mQuotaInfo.mOrigin,
|
||||
mQuotaInfo.mIsApp,
|
||||
quota::Client::DOMCACHE,
|
||||
/* aExclusive */ false,
|
||||
this);
|
||||
@@ -376,8 +375,7 @@ Context::QuotaInitRunnable::Run()
|
||||
nsresult rv = QuotaManager::GetInfoFromPrincipal(principal,
|
||||
&mQuotaInfo.mSuffix,
|
||||
&mQuotaInfo.mGroup,
|
||||
&mQuotaInfo.mOrigin,
|
||||
&mQuotaInfo.mIsApp);
|
||||
&mQuotaInfo.mOrigin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
resolver->Resolve(rv);
|
||||
break;
|
||||
@@ -436,7 +434,6 @@ Context::QuotaInitRunnable::Run()
|
||||
mQuotaInfo.mSuffix,
|
||||
mQuotaInfo.mGroup,
|
||||
mQuotaInfo.mOrigin,
|
||||
mQuotaInfo.mIsApp,
|
||||
getter_AddRefs(mQuotaInfo.mDir));
|
||||
if (NS_FAILED(rv)) {
|
||||
resolver->Resolve(rv);
|
||||
|
||||
Vendored
+4
-1
@@ -196,7 +196,10 @@ static_assert(int(ReferrerPolicy::_empty) == 0 &&
|
||||
int(ReferrerPolicy::Origin) == 3 &&
|
||||
int(ReferrerPolicy::Origin_when_cross_origin) == 4 &&
|
||||
int(ReferrerPolicy::Unsafe_url) == 5 &&
|
||||
int(ReferrerPolicy::EndGuard_) == 6,
|
||||
int(ReferrerPolicy::Same_origin) == 6 &&
|
||||
int(ReferrerPolicy::Strict_origin) == 7 &&
|
||||
int(ReferrerPolicy::Strict_origin_when_cross_origin) == 8 &&
|
||||
int(ReferrerPolicy::EndGuard_) == 9,
|
||||
"ReferrerPolicy values are as expected");
|
||||
static_assert(int(RequestMode::Same_origin) == 0 &&
|
||||
int(RequestMode::No_cors) == 1 &&
|
||||
|
||||
Vendored
+1
-2
@@ -29,8 +29,7 @@ ManagerId::Create(nsIPrincipal* aPrincipal, ManagerId** aManagerIdOut)
|
||||
nsresult rv = QuotaManager::GetInfoFromPrincipal(aPrincipal,
|
||||
nullptr, // suffix
|
||||
nullptr, // group
|
||||
"aOrigin,
|
||||
nullptr); // is app
|
||||
"aOrigin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
RefPtr<ManagerId> ref = new ManagerId(aPrincipal, quotaOrigin);
|
||||
|
||||
Vendored
-2
@@ -28,12 +28,10 @@ static const CacheId INVALID_CACHE_ID = -1;
|
||||
|
||||
struct QuotaInfo
|
||||
{
|
||||
QuotaInfo() : mIsApp(false) { }
|
||||
nsCOMPtr<nsIFile> mDir;
|
||||
nsCString mSuffix;
|
||||
nsCString mGroup;
|
||||
nsCString mOrigin;
|
||||
bool mIsApp;
|
||||
};
|
||||
|
||||
} // namespace cache
|
||||
|
||||
@@ -1824,7 +1824,9 @@ WebGLContext::UpdateContextLossStatus()
|
||||
void
|
||||
WebGLContext::ForceLoseContext(bool simulateLosing)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf_stderr("WebGL(%p)::ForceLoseContext\n", this);
|
||||
#endif
|
||||
MOZ_ASSERT(!IsContextLost());
|
||||
mContextStatus = ContextLostAwaitingEvent;
|
||||
mContextLostErrorSet = false;
|
||||
@@ -1840,7 +1842,9 @@ WebGLContext::ForceLoseContext(bool simulateLosing)
|
||||
void
|
||||
WebGLContext::ForceRestoreContext()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf_stderr("WebGL(%p)::ForceRestoreContext\n", this);
|
||||
#endif
|
||||
mContextStatus = ContextLostAwaitingRestore;
|
||||
mAllowContextRestore = true; // Hey, you did say 'force'.
|
||||
|
||||
|
||||
@@ -1279,9 +1279,9 @@ EventStateManager::IsRemoteTarget(nsIContent* target) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// <frame/iframe mozbrowser/mozapp>
|
||||
// <frame/iframe mozbrowser>
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(target);
|
||||
if (browserFrame && browserFrame->GetReallyIsBrowserOrApp()) {
|
||||
if (browserFrame && browserFrame->GetReallyIsBrowser()) {
|
||||
return !!TabParent::GetFrom(target);
|
||||
}
|
||||
|
||||
|
||||
+30
-75
@@ -33,6 +33,7 @@
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
#include "Fetch.h"
|
||||
#include "FetchUtil.h"
|
||||
#include "InternalRequest.h"
|
||||
#include "InternalResponse.h"
|
||||
|
||||
@@ -262,62 +263,30 @@ FetchDriver::HttpFetch()
|
||||
// Set the same headers.
|
||||
SetRequestHeaders(httpChan);
|
||||
|
||||
// Step 2. Set the referrer.
|
||||
nsAutoString referrer;
|
||||
mRequest->GetReferrer(referrer);
|
||||
|
||||
// The Referrer Policy in Request can be used to override a referrer policy
|
||||
// associated with an environment settings object.
|
||||
// If there's no Referrer Policy in the request, it should be inherited
|
||||
// from environment.
|
||||
ReferrerPolicy referrerPolicy = mRequest->ReferrerPolicy_();
|
||||
net::ReferrerPolicy net_referrerPolicy = mRequest->GetEnvironmentReferrerPolicy();
|
||||
switch (referrerPolicy) {
|
||||
case ReferrerPolicy::_empty:
|
||||
break;
|
||||
case ReferrerPolicy::No_referrer:
|
||||
net_referrerPolicy = net::RP_No_Referrer;
|
||||
break;
|
||||
case ReferrerPolicy::No_referrer_when_downgrade:
|
||||
net_referrerPolicy = net::RP_No_Referrer_When_Downgrade;
|
||||
break;
|
||||
case ReferrerPolicy::Origin:
|
||||
net_referrerPolicy = net::RP_Origin;
|
||||
break;
|
||||
case ReferrerPolicy::Origin_when_cross_origin:
|
||||
net_referrerPolicy = net::RP_Origin_When_Crossorigin;
|
||||
break;
|
||||
case ReferrerPolicy::Unsafe_url:
|
||||
net_referrerPolicy = net::RP_Unsafe_URL;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid ReferrerPolicy enum value?");
|
||||
break;
|
||||
// Step 6 of
|
||||
// https://fetch.spec.whatwg.org/#main-fetch
|
||||
// If request's referrer policy is the empty string and request's client is
|
||||
// non-null, then set request's referrer policy to request's client's
|
||||
// associated referrer policy.
|
||||
// Basically, "client" is not in our implementation, we use
|
||||
// EnvironmentReferrerPolicy of the worker or document context
|
||||
if (mRequest->ReferrerPolicy_() == ReferrerPolicy::_empty) {
|
||||
mRequest->SetReferrerPolicy(net_referrerPolicy);
|
||||
}
|
||||
// Step 7 of
|
||||
// https://fetch.spec.whatwg.org/#main-fetch
|
||||
// If request’s referrer policy is the empty string,
|
||||
// then set request’s referrer policy to "no-referrer-when-downgrade".
|
||||
if (mRequest->ReferrerPolicy_() == ReferrerPolicy::_empty) {
|
||||
mRequest->SetReferrerPolicy(net::RP_No_Referrer_When_Downgrade);
|
||||
}
|
||||
if (referrer.EqualsLiteral(kFETCH_CLIENT_REFERRER_STR)) {
|
||||
rv = nsContentUtils::SetFetchReferrerURIWithPolicy(mPrincipal,
|
||||
mDocument,
|
||||
httpChan,
|
||||
net_referrerPolicy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else if (referrer.IsEmpty()) {
|
||||
rv = httpChan->SetReferrerWithPolicy(nullptr, net::RP_No_Referrer);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// From "Determine request's Referrer" step 3
|
||||
// "If request's referrer is a URL, let referrerSource be request's
|
||||
// referrer."
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
rv = NS_NewURI(getter_AddRefs(referrerURI), referrer, nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv =
|
||||
httpChan->SetReferrerWithPolicy(referrerURI,
|
||||
referrerPolicy == ReferrerPolicy::_empty ?
|
||||
mRequest->GetEnvironmentReferrerPolicy() :
|
||||
net_referrerPolicy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
rv = FetchUtil::SetRequestReferrer(mPrincipal,
|
||||
mDocument,
|
||||
httpChan,
|
||||
mRequest);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Bug 1120722 - Authorization will be handled later.
|
||||
// Auth may require prompting, we don't support it yet.
|
||||
@@ -864,29 +833,15 @@ FetchDriver::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
|
||||
net::ReferrerPolicy net_referrerPolicy =
|
||||
nsContentUtils::GetReferrerPolicyFromHeader(tRPHeaderValue);
|
||||
if (net_referrerPolicy != net::RP_Unset) {
|
||||
ReferrerPolicy referrerPolicy = mRequest->ReferrerPolicy_();
|
||||
switch (net_referrerPolicy) {
|
||||
case net::RP_No_Referrer:
|
||||
referrerPolicy = ReferrerPolicy::No_referrer;
|
||||
break;
|
||||
case net::RP_No_Referrer_When_Downgrade:
|
||||
referrerPolicy = ReferrerPolicy::No_referrer_when_downgrade;
|
||||
break;
|
||||
case net::RP_Origin:
|
||||
referrerPolicy = ReferrerPolicy::Origin;
|
||||
break;
|
||||
case net::RP_Origin_When_Crossorigin:
|
||||
referrerPolicy = ReferrerPolicy::Origin_when_cross_origin;
|
||||
break;
|
||||
case net::RP_Unsafe_URL:
|
||||
referrerPolicy = ReferrerPolicy::Unsafe_url;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid ReferrerPolicy value");
|
||||
break;
|
||||
mRequest->SetReferrerPolicy(net_referrerPolicy);
|
||||
// Should update channel's referrer policy
|
||||
if (httpChannel) {
|
||||
rv = FetchUtil::SetRequestReferrer(mPrincipal,
|
||||
mDocument,
|
||||
httpChannel,
|
||||
mRequest);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
mRequest->SetReferrerPolicy(referrerPolicy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/InternalRequest.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@@ -111,5 +113,59 @@ FetchUtil::ExtractHeader(nsACString::const_iterator& aStart,
|
||||
return PushOverLine(aStart, aEnd);
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
FetchUtil::SetRequestReferrer(nsIPrincipal* aPrincipal,
|
||||
nsIDocument* aDoc,
|
||||
nsIHttpChannel* aChannel,
|
||||
InternalRequest* aRequest) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsAutoString referrer;
|
||||
aRequest->GetReferrer(referrer);
|
||||
net::ReferrerPolicy policy = aRequest->GetReferrerPolicy();
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (referrer.IsEmpty()) {
|
||||
// This is the case request’s referrer is "no-referrer"
|
||||
rv = aChannel->SetReferrerWithPolicy(nullptr, net::RP_No_Referrer);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else if (referrer.EqualsLiteral(kFETCH_CLIENT_REFERRER_STR)) {
|
||||
rv = nsContentUtils::SetFetchReferrerURIWithPolicy(aPrincipal,
|
||||
aDoc,
|
||||
aChannel,
|
||||
policy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// From "Determine request's Referrer" step 3
|
||||
// "If request's referrer is a URL, let referrerSource be request's
|
||||
// referrer."
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
rv = NS_NewURI(getter_AddRefs(referrerURI), referrer, nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aChannel->SetReferrerWithPolicy(referrerURI, policy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
aChannel->GetReferrer(getter_AddRefs(referrerURI));
|
||||
|
||||
// Step 8 https://fetch.spec.whatwg.org/#main-fetch
|
||||
// If request’s referrer is not "no-referrer", set request’s referrer to
|
||||
// the result of invoking determine request’s referrer.
|
||||
if (referrerURI) {
|
||||
nsAutoCString spec;
|
||||
rv = referrerURI->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aRequest->SetReferrer(NS_ConvertUTF8toUTF16(spec));
|
||||
} else {
|
||||
aRequest->SetReferrer(EmptyString());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
@@ -8,9 +8,15 @@
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FormData.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
class nsIDocument;
|
||||
class nsIHttpChannel;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class InternalRequest;
|
||||
|
||||
class FetchUtil final
|
||||
{
|
||||
private:
|
||||
@@ -35,6 +41,13 @@ public:
|
||||
nsCString& aHeaderName,
|
||||
nsCString& aHeaderValue,
|
||||
bool* aWasEmptyHeader);
|
||||
|
||||
static nsresult
|
||||
SetRequestReferrer(nsIPrincipal* aPrincipal,
|
||||
nsIDocument* aDoc,
|
||||
nsIHttpChannel* aChannel,
|
||||
InternalRequest* aRequest);
|
||||
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -232,6 +232,72 @@ public:
|
||||
mReferrerPolicy = aReferrerPolicy;
|
||||
}
|
||||
|
||||
void
|
||||
SetReferrerPolicy(net::ReferrerPolicy aReferrerPolicy)
|
||||
{
|
||||
switch (aReferrerPolicy) {
|
||||
case net::RP_Unset:
|
||||
mReferrerPolicy = ReferrerPolicy::_empty;
|
||||
break;
|
||||
case net::RP_No_Referrer:
|
||||
mReferrerPolicy = ReferrerPolicy::No_referrer;
|
||||
break;
|
||||
case net::RP_No_Referrer_When_Downgrade:
|
||||
mReferrerPolicy = ReferrerPolicy::No_referrer_when_downgrade;
|
||||
break;
|
||||
case net::RP_Origin:
|
||||
mReferrerPolicy = ReferrerPolicy::Origin;
|
||||
break;
|
||||
case net::RP_Origin_When_Crossorigin:
|
||||
mReferrerPolicy = ReferrerPolicy::Origin_when_cross_origin;
|
||||
break;
|
||||
case net::RP_Unsafe_URL:
|
||||
mReferrerPolicy = ReferrerPolicy::Unsafe_url;
|
||||
break;
|
||||
case net::RP_Same_Origin:
|
||||
mReferrerPolicy = ReferrerPolicy::Same_origin;
|
||||
break;
|
||||
case net::RP_Strict_Origin:
|
||||
mReferrerPolicy = ReferrerPolicy::Strict_origin;
|
||||
break;
|
||||
case net::RP_Strict_Origin_When_Cross_Origin:
|
||||
mReferrerPolicy = ReferrerPolicy::Strict_origin_when_cross_origin;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid ReferrerPolicy value");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
net::ReferrerPolicy
|
||||
GetReferrerPolicy()
|
||||
{
|
||||
switch (mReferrerPolicy) {
|
||||
case ReferrerPolicy::_empty:
|
||||
return net::RP_Unset;
|
||||
case ReferrerPolicy::No_referrer:
|
||||
return net::RP_No_Referrer;
|
||||
case ReferrerPolicy::No_referrer_when_downgrade:
|
||||
return net::RP_No_Referrer_When_Downgrade;
|
||||
case ReferrerPolicy::Origin:
|
||||
return net::RP_Origin;
|
||||
case ReferrerPolicy::Origin_when_cross_origin:
|
||||
return net::RP_Origin_When_Crossorigin;
|
||||
case ReferrerPolicy::Unsafe_url:
|
||||
return net::RP_Unsafe_URL;
|
||||
case ReferrerPolicy::Strict_origin:
|
||||
return net::RP_Strict_Origin;
|
||||
case ReferrerPolicy::Same_origin:
|
||||
return net::RP_Same_Origin;
|
||||
case ReferrerPolicy::Strict_origin_when_cross_origin:
|
||||
return net::RP_Strict_Origin_When_Cross_Origin;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid ReferrerPolicy enum value?");
|
||||
break;
|
||||
}
|
||||
return net::RP_Unset;
|
||||
}
|
||||
|
||||
net::ReferrerPolicy
|
||||
GetEnvironmentReferrerPolicy() const
|
||||
{
|
||||
|
||||
@@ -5595,8 +5595,14 @@ HTMLMediaElement::CopyInnerTo(Element* aDest)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Make sure cloned <audio> and <video> respect their "muted" attribute.
|
||||
HTMLMediaElement* dest = static_cast<HTMLMediaElement*>(aDest);
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::muted)) {
|
||||
dest->mMuted |= MUTED_BY_CONTENT;
|
||||
}
|
||||
|
||||
if (aDest->OwnerDoc()->IsStaticDocument()) {
|
||||
HTMLMediaElement* dest = static_cast<HTMLMediaElement*>(aDest);
|
||||
dest->SetMediaInfo(mMediaInfo);
|
||||
}
|
||||
return rv;
|
||||
|
||||
@@ -324,6 +324,12 @@ HTMLScriptElement::GetCORSMode() const
|
||||
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
|
||||
}
|
||||
|
||||
mozilla::net::ReferrerPolicy
|
||||
HTMLScriptElement::GetReferrerPolicy()
|
||||
{
|
||||
return GetReferrerPolicyAsEnum();
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLScriptElement::HasScriptContent()
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
virtual void GetScriptCharset(nsAString& charset) override;
|
||||
virtual void FreezeExecutionAttrs(nsIDocument* aOwnerDoc) override;
|
||||
virtual CORSMode GetCORSMode() const override;
|
||||
virtual mozilla::net::ReferrerPolicy GetReferrerPolicy() override;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
@@ -96,6 +97,14 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::integrity, aIntegrity, rv);
|
||||
}
|
||||
void SetReferrerPolicy(const nsAString& aReferrerPolicy, ErrorResult& aError)
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::referrerpolicy, aReferrerPolicy, aError);
|
||||
}
|
||||
void GetReferrerPolicy(nsAString& aReferrerPolicy)
|
||||
{
|
||||
GetEnumAttr(nsGkAtoms::referrerpolicy, EmptyCString().get(), aReferrerPolicy);
|
||||
}
|
||||
bool Async();
|
||||
void SetAsync(bool aValue, ErrorResult& rv);
|
||||
bool NoModule();
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
|
||||
#include "AudioChannelService.h"
|
||||
|
||||
#include "mozIApplication.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDOMRequest.h"
|
||||
#include "nsIDOMElement.h"
|
||||
@@ -44,13 +42,13 @@ nsBrowserElement::IsBrowserElementOrThrow(ErrorResult& aRv)
|
||||
void
|
||||
nsBrowserElement::InitBrowserElementAPI()
|
||||
{
|
||||
bool isMozBrowserOrApp;
|
||||
bool isMozBrowser;
|
||||
nsCOMPtr<nsIFrameLoader> frameLoader = GetFrameLoader();
|
||||
NS_ENSURE_TRUE_VOID(frameLoader);
|
||||
nsresult rv = frameLoader->GetOwnerIsMozBrowserOrAppFrame(&isMozBrowserOrApp);
|
||||
nsresult rv = frameLoader->GetOwnerIsMozBrowserFrame(&isMozBrowser);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
if (!isMozBrowserOrApp) {
|
||||
if (!isMozBrowser) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -495,13 +493,13 @@ nsBrowserElement::GetAllowedAudioChannels(
|
||||
return;
|
||||
}
|
||||
|
||||
bool isMozBrowserOrApp;
|
||||
aRv = frameLoader->GetOwnerIsMozBrowserOrAppFrame(&isMozBrowserOrApp);
|
||||
bool isMozBrowser;
|
||||
aRv = frameLoader->GetOwnerIsMozBrowserFrame(&isMozBrowser);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isMozBrowserOrApp) {
|
||||
if (!isMozBrowser) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,6 @@ public:
|
||||
|
||||
protected:
|
||||
NS_IMETHOD_(already_AddRefed<nsFrameLoader>) GetFrameLoader() = 0;
|
||||
NS_IMETHOD GetParentApplication(mozIApplication** aApplication) = 0;
|
||||
|
||||
void InitBrowserElementAPI();
|
||||
void DestroyBrowserElementFrameScripts();
|
||||
|
||||
@@ -11,10 +11,8 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozIApplication.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIFrame.h"
|
||||
@@ -191,31 +189,6 @@ nsGenericHTMLFrameElement::GetFrameLoader()
|
||||
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
|
||||
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
|
||||
* permissions.)
|
||||
*/
|
||||
/* [infallible] */ nsresult
|
||||
nsGenericHTMLFrameElement::GetReallyIsBrowserOrApp(bool *aOut)
|
||||
nsGenericHTMLFrameElement::GetReallyIsBrowser(bool *aOut)
|
||||
{
|
||||
*aOut = mReallyIsBrowser;
|
||||
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
|
||||
nsGenericHTMLFrameElement::DisallowCreateFrameLoader()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
|
||||
function runTests() {
|
||||
var elements = [ "iframe", "img", "a", "area", "link" ];
|
||||
var elements = [ "iframe", "img", "a", "area", "link", "script"];
|
||||
|
||||
for (var i = 0; i < elements.length; ++i) {
|
||||
reflectLimitedEnumerated({
|
||||
|
||||
@@ -74,7 +74,6 @@
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIFileURL.h"
|
||||
@@ -7394,7 +7393,6 @@ protected:
|
||||
nsCString mDatabaseId;
|
||||
nsString mDatabaseFilePath;
|
||||
State mState;
|
||||
bool mIsApp;
|
||||
bool mEnforcingQuota;
|
||||
const bool mDeleting;
|
||||
bool mBlockedDatabaseOpen;
|
||||
@@ -16904,7 +16902,6 @@ Cursor::RecvContinue(const CursorRequestParams& aParams)
|
||||
FileManager::FileManager(PersistenceType aPersistenceType,
|
||||
const nsACString& aGroup,
|
||||
const nsACString& aOrigin,
|
||||
bool aIsApp,
|
||||
const nsAString& aDatabaseName,
|
||||
bool aEnforcingQuota)
|
||||
: mPersistenceType(aPersistenceType)
|
||||
@@ -16912,7 +16909,6 @@ FileManager::FileManager(PersistenceType aPersistenceType,
|
||||
, mOrigin(aOrigin)
|
||||
, mDatabaseName(aDatabaseName)
|
||||
, mLastFileId(0)
|
||||
, mIsApp(aIsApp)
|
||||
, mEnforcingQuota(aEnforcingQuota)
|
||||
, mInvalidated(false)
|
||||
{ }
|
||||
@@ -18293,7 +18289,7 @@ Maintenance::DirectoryWork()
|
||||
|
||||
// The storage directory is structured like this:
|
||||
//
|
||||
// <profile>/storage/<persistence>/<origin>/idb/*.sqlite
|
||||
// <profile>\storage\<persistence>\<origin>\idb\*.sqlite
|
||||
//
|
||||
// We have to find all database files that match any persistence type and any
|
||||
// origin. We ignore anything out of the ordinary for now.
|
||||
@@ -18489,7 +18485,6 @@ Maintenance::DirectoryWork()
|
||||
nsCString suffix;
|
||||
nsCString group;
|
||||
nsCString origin;
|
||||
bool isApp;
|
||||
nsTArray<nsString> databasePaths;
|
||||
|
||||
while (true) {
|
||||
@@ -18555,8 +18550,7 @@ Maintenance::DirectoryWork()
|
||||
&dummyTimeStamp,
|
||||
suffix,
|
||||
group,
|
||||
origin,
|
||||
&isApp)))) {
|
||||
origin)))) {
|
||||
// Not much we can do here...
|
||||
continue;
|
||||
}
|
||||
@@ -18582,7 +18576,6 @@ Maintenance::DirectoryWork()
|
||||
suffix,
|
||||
group,
|
||||
origin,
|
||||
isApp,
|
||||
getter_AddRefs(directory));
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
@@ -19426,7 +19419,6 @@ UpgradeFileIdsFunction::Init(nsIFile* aFMDirectory,
|
||||
new FileManager(PERSISTENCE_TYPE_INVALID,
|
||||
EmptyCString(),
|
||||
EmptyCString(),
|
||||
false,
|
||||
EmptyString(),
|
||||
false);
|
||||
|
||||
@@ -20669,7 +20661,6 @@ FactoryOp::FactoryOp(Factory* aFactory,
|
||||
, mContentParent(Move(aContentParent))
|
||||
, mCommonParams(aCommonParams)
|
||||
, mState(State::Initial)
|
||||
, mIsApp(false)
|
||||
, mEnforcingQuota(true)
|
||||
, mDeleting(aDeleting)
|
||||
, mBlockedDatabaseOpen(false)
|
||||
@@ -21021,13 +21012,11 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
|
||||
}
|
||||
|
||||
if (State::Initial == mState) {
|
||||
QuotaManager::GetInfoForChrome(&mSuffix, &mGroup, &mOrigin, &mIsApp);
|
||||
QuotaManager::GetInfoForChrome(&mSuffix, &mGroup, &mOrigin);
|
||||
|
||||
MOZ_ASSERT(!QuotaManager::IsFirstPromptRequired(persistenceType, mOrigin,
|
||||
mIsApp));
|
||||
MOZ_ASSERT(QuotaManager::IsOriginInternal(mOrigin));
|
||||
|
||||
mEnforcingQuota =
|
||||
QuotaManager::IsQuotaEnforced(persistenceType, mOrigin, mIsApp);
|
||||
mEnforcingQuota = false;
|
||||
}
|
||||
|
||||
*aPermission = PermissionRequestBase::kPermissionAllowed;
|
||||
@@ -21046,22 +21035,24 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
|
||||
nsCString suffix;
|
||||
nsCString group;
|
||||
nsCString origin;
|
||||
bool isApp;
|
||||
rv = QuotaManager::GetInfoFromPrincipal(principal,
|
||||
&suffix,
|
||||
&group,
|
||||
&origin,
|
||||
&isApp);
|
||||
&origin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
PermissionRequestBase::PermissionValue permission;
|
||||
|
||||
if (QuotaManager::IsFirstPromptRequired(persistenceType, origin, isApp)) {
|
||||
rv = PermissionRequestBase::GetCurrentPermission(principal, &permission);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
if (persistenceType == PERSISTENCE_TYPE_PERSISTENT) {
|
||||
if (QuotaManager::IsOriginInternal(origin)) {
|
||||
permission = PermissionRequestBase::kPermissionAllowed;
|
||||
} else {
|
||||
rv = PermissionRequestBase::GetCurrentPermission(principal, &permission);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
permission = PermissionRequestBase::kPermissionAllowed;
|
||||
@@ -21072,10 +21063,8 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
|
||||
mSuffix = suffix;
|
||||
mGroup = group;
|
||||
mOrigin = origin;
|
||||
mIsApp = isApp;
|
||||
|
||||
mEnforcingQuota =
|
||||
QuotaManager::IsQuotaEnforced(persistenceType, mOrigin, mIsApp);
|
||||
mEnforcingQuota = persistenceType != PERSISTENCE_TYPE_PERSISTENT;
|
||||
}
|
||||
|
||||
*aPermission = permission;
|
||||
@@ -21232,7 +21221,6 @@ FactoryOp::OpenDirectory()
|
||||
quotaManager->OpenDirectory(persistenceType,
|
||||
mGroup,
|
||||
mOrigin,
|
||||
mIsApp,
|
||||
Client::IDB,
|
||||
/* aExclusive */ false,
|
||||
this);
|
||||
@@ -21497,7 +21485,6 @@ OpenDatabaseOp::DoDatabaseWork()
|
||||
mSuffix,
|
||||
mGroup,
|
||||
mOrigin,
|
||||
mIsApp,
|
||||
getter_AddRefs(dbDirectory));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
@@ -21618,7 +21605,6 @@ OpenDatabaseOp::DoDatabaseWork()
|
||||
fileManager = new FileManager(persistenceType,
|
||||
mGroup,
|
||||
mOrigin,
|
||||
mIsApp,
|
||||
databaseName,
|
||||
mEnforcingQuota);
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ class FileManager final
|
||||
// Protected by IndexedDatabaseManager::FileMutex()
|
||||
nsDataHashtable<nsUint64HashKey, FileInfo*> mFileInfos;
|
||||
|
||||
const bool mIsApp;
|
||||
const bool mEnforcingQuota;
|
||||
bool mInvalidated;
|
||||
|
||||
@@ -65,7 +64,6 @@ public:
|
||||
FileManager(PersistenceType aPersistenceType,
|
||||
const nsACString& aGroup,
|
||||
const nsACString& aOrigin,
|
||||
bool aIsApp,
|
||||
const nsAString& aDatabaseName,
|
||||
bool aEnforcingQuota);
|
||||
|
||||
@@ -87,12 +85,6 @@ public:
|
||||
return mOrigin;
|
||||
}
|
||||
|
||||
bool
|
||||
IsApp() const
|
||||
{
|
||||
return mIsApp;
|
||||
}
|
||||
|
||||
const nsAString&
|
||||
DatabaseName() const
|
||||
{
|
||||
|
||||
@@ -1074,7 +1074,7 @@ IDBDatabase::GetQuotaInfo(nsACString& aOrigin,
|
||||
MOZ_CRASH("Is this needed?!");
|
||||
|
||||
case PrincipalInfo::TSystemPrincipalInfo:
|
||||
QuotaManager::GetInfoForChrome(nullptr, nullptr, &aOrigin, nullptr);
|
||||
QuotaManager::GetInfoForChrome(nullptr, nullptr, &aOrigin);
|
||||
return NS_OK;
|
||||
|
||||
case PrincipalInfo::TContentPrincipalInfo: {
|
||||
@@ -1088,8 +1088,7 @@ IDBDatabase::GetQuotaInfo(nsACString& aOrigin,
|
||||
rv = QuotaManager::GetInfoFromPrincipal(principal,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&aOrigin,
|
||||
nullptr);
|
||||
&aOrigin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1272,7 +1272,6 @@ DeleteFilesRunnable::Open()
|
||||
quotaManager->OpenDirectory(mFileManager->Type(),
|
||||
mFileManager->Group(),
|
||||
mFileManager->Origin(),
|
||||
mFileManager->IsApp(),
|
||||
Client::IDB,
|
||||
/* aExclusive */ false,
|
||||
this);
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
foobar!
|
||||
</body>
|
||||
<script>
|
||||
var data = [
|
||||
{ id: "0", name: "foo" },
|
||||
];
|
||||
|
||||
var action = window.location.search.substring(1);
|
||||
var finished = false;
|
||||
var created = false; // We use that for 'read-no' action.
|
||||
|
||||
function finish(value) {
|
||||
value ? alert('success') : alert('failure');
|
||||
finished = true;
|
||||
}
|
||||
|
||||
var request = window.indexedDB.open('AppIsolationTest');
|
||||
|
||||
request.onupgradeneeded = function(event) {
|
||||
if (finished) {
|
||||
finish(false);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case 'read-no':
|
||||
created = true;
|
||||
break;
|
||||
case 'read-yes':
|
||||
finish(false);
|
||||
break;
|
||||
case 'write':
|
||||
created = true;
|
||||
|
||||
var db = event.target.result;
|
||||
|
||||
var objectStore = db.createObjectStore("test", { keyPath: "id" });
|
||||
for (var i in data) {
|
||||
objectStore.add(data[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
if (finished) {
|
||||
finish(false);
|
||||
return;
|
||||
}
|
||||
|
||||
var db = event.target.result;
|
||||
|
||||
// Think about close the db!
|
||||
switch (action) {
|
||||
case 'read-no':
|
||||
db.close();
|
||||
|
||||
if (created) { // That means we have created it.
|
||||
indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
|
||||
finish(true);
|
||||
};
|
||||
} else {
|
||||
finish(false);
|
||||
}
|
||||
break;
|
||||
case 'read-yes':
|
||||
db.transaction("test").objectStore("test").get("0").onsuccess = function(event) {
|
||||
var name = event.target.result.name;
|
||||
db.close();
|
||||
|
||||
indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
|
||||
finish(name == 'foo');
|
||||
};
|
||||
};
|
||||
break;
|
||||
case 'write':
|
||||
db.close();
|
||||
|
||||
// Success only if the db was actually created.
|
||||
finish(created);
|
||||
break;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</html>
|
||||
@@ -1,161 +0,0 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var fileTestOnCurrentOrigin = (location.protocol + '//' + location.host + location.pathname)
|
||||
.replace('test_', 'file_')
|
||||
.replace('_inproc', '').replace('_oop', '');
|
||||
|
||||
var previousPrefs = {
|
||||
mozBrowserFramesEnabled: undefined,
|
||||
oop_by_default: undefined,
|
||||
};
|
||||
|
||||
try {
|
||||
previousPrefs.mozBrowserFramesEnabled = SpecialPowers.getBoolPref('dom.mozBrowserFramesEnabled');
|
||||
} catch(e)
|
||||
{
|
||||
}
|
||||
|
||||
try {
|
||||
previousPrefs.oop_by_default = SpecialPowers.getBoolPref('dom.ipc.browser_frames.oop_by_default');
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
|
||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", location.pathname.indexOf('_inproc') == -1);
|
||||
|
||||
SpecialPowers.addPermission("browser", true, window.document);
|
||||
|
||||
var gData = [
|
||||
// APP 1
|
||||
{
|
||||
app: 'http://example.org/manifest.webapp',
|
||||
action: 'read-no',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
app: 'http://example.org/manifest.webapp',
|
||||
action: 'write',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
app: 'http://example.org/manifest.webapp',
|
||||
action: 'read-yes',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
// APP 2
|
||||
{
|
||||
app: 'https://example.com/manifest.webapp',
|
||||
action: 'read-no',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
app: 'https://example.com/manifest.webapp',
|
||||
action: 'write',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
app: 'https://example.com/manifest.webapp',
|
||||
action: 'read-yes',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
// Browser
|
||||
{
|
||||
browser: true,
|
||||
action: 'read-no',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
browser: true,
|
||||
action: 'write',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
{
|
||||
browser: true,
|
||||
action: 'read-yes',
|
||||
src: fileTestOnCurrentOrigin,
|
||||
},
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
for (var i in gData) {
|
||||
var iframe = document.createElement('iframe');
|
||||
var data = gData[i];
|
||||
|
||||
if (data.app) {
|
||||
iframe.setAttribute('mozbrowser', '');
|
||||
iframe.setAttribute('mozapp', data.app);
|
||||
} else if (data.browser) {
|
||||
iframe.setAttribute('mozbrowser', '');
|
||||
}
|
||||
|
||||
if (data.app || data.browser) {
|
||||
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
||||
is(e.detail.message, 'success', 'test number ' + i);
|
||||
|
||||
// document.getElementById('content').removeChild(iframe);
|
||||
|
||||
i++;
|
||||
if (i >= gData.length) {
|
||||
if (previousPrefs.mozBrowserFramesEnabled !== undefined) {
|
||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled);
|
||||
}
|
||||
if (previousPrefs.oop_by_default !== undefined) {
|
||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", previousPrefs.oop_by_default);
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("browser", window.document);
|
||||
|
||||
indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
|
||||
SimpleTest.finish();
|
||||
};
|
||||
} else {
|
||||
gTestRunner.next();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
iframe.src = data.src + '?' + data.action;
|
||||
|
||||
document.getElementById('content').appendChild(iframe);
|
||||
|
||||
yield undefined;
|
||||
}
|
||||
}
|
||||
|
||||
var gTestRunner = runTest();
|
||||
|
||||
function startTest() {
|
||||
var request = window.indexedDB.open('AppIsolationTest');
|
||||
var created = false;
|
||||
|
||||
request.onupgradeneeded = function(event) {
|
||||
created = true;
|
||||
var db = event.target.result;
|
||||
var data = [
|
||||
{ id: "0", name: "foo" },
|
||||
];
|
||||
var objectStore = db.createObjectStore("test", { keyPath: "id" });
|
||||
for (var i in data) {
|
||||
objectStore.add(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
request.onsuccess = function(event) {
|
||||
var db = event.target.result;
|
||||
is(created, true, "we should have created the db");
|
||||
|
||||
db.transaction("test").objectStore("test").get("0").onsuccess = function(event) {
|
||||
is(event.target.result.name, 'foo', 'data have been written');
|
||||
db.close();
|
||||
|
||||
gTestRunner.next();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: remove unsetting network.disable.ipc.security as part of bug 820712
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["network.disable.ipc.security", true],
|
||||
]
|
||||
}, startTest);
|
||||
@@ -11,8 +11,6 @@ support-files =
|
||||
event_propagation_iframe.html
|
||||
exceptions_in_events_iframe.html
|
||||
file.js
|
||||
file_app_isolation.html
|
||||
file_app_isolation.js
|
||||
helpers.js
|
||||
leaving_page_iframe.html
|
||||
service_worker.js
|
||||
@@ -125,12 +123,6 @@ support-files =
|
||||
[test_add_put.html]
|
||||
[test_add_twice_failure.html]
|
||||
[test_advance.html]
|
||||
[test_app_isolation_inproc.html]
|
||||
# The app isolation tests are only supposed to run in the main process.
|
||||
skip-if = e10s
|
||||
[test_app_isolation_oop.html]
|
||||
# The app isolation tests are only supposed to run in the main process.
|
||||
skip-if = e10s
|
||||
[test_autoIncrement.html]
|
||||
[test_autoIncrement_indexes.html]
|
||||
[test_bfcache.html]
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=756645
|
||||
-->
|
||||
<head>
|
||||
<title>Test for IndexedDB app isolation (unique process)</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=756645">Mozilla Bug 756645</a>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7" src="file_app_isolation.js">
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,21 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=756645
|
||||
-->
|
||||
<head>
|
||||
<title>Test for IndexedDB app isolation (unique process)</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=756645">Mozilla Bug 756645</a>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7" src="file_app_isolation.js">
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -19,10 +19,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy",
|
||||
"resource://gre/modules/SystemAppProxy.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "appsService", function() {
|
||||
return Cc["@mozilla.org/AppsService;1"].getService(Ci.nsIAppsService);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "hardwareKeyHandler", function() {
|
||||
return null;
|
||||
});
|
||||
@@ -174,8 +170,8 @@ this.Keyboard = {
|
||||
this.formMM = null;
|
||||
}
|
||||
} else {
|
||||
// Ignore notifications that aren't from a BrowserOrApp
|
||||
if (!frameLoader.ownerIsMozBrowserOrAppFrame) {
|
||||
// Ignore notifications that aren't from a Browser
|
||||
if (!frameLoader.ownerIsMozBrowserFrame) {
|
||||
return;
|
||||
}
|
||||
this.initFormsFrameScript(mm);
|
||||
@@ -554,24 +550,6 @@ InputRegistryGlue.prototype.addInput = function(msg, mm) {
|
||||
mm: mm,
|
||||
requestId: msg.data.requestId
|
||||
});
|
||||
|
||||
let manifestURL = appsService.getManifestURLByLocalId(msg.data.appId);
|
||||
|
||||
Keyboard.sendToSystem('System:InputRegistry:Add', {
|
||||
id: msgId,
|
||||
manifestURL: manifestURL,
|
||||
inputId: msg.data.inputId,
|
||||
inputManifest: msg.data.inputManifest
|
||||
});
|
||||
|
||||
// XXX: To be removed when content migrate away from mozChromeEvents.
|
||||
SystemAppProxy.dispatchEvent({
|
||||
type: 'inputregistry-add',
|
||||
id: msgId,
|
||||
manifestURL: manifestURL,
|
||||
inputId: msg.data.inputId,
|
||||
inputManifest: msg.data.inputManifest
|
||||
});
|
||||
};
|
||||
|
||||
InputRegistryGlue.prototype.removeInput = function(msg, mm) {
|
||||
@@ -580,22 +558,6 @@ InputRegistryGlue.prototype.removeInput = function(msg, mm) {
|
||||
mm: mm,
|
||||
requestId: msg.data.requestId
|
||||
});
|
||||
|
||||
let manifestURL = appsService.getManifestURLByLocalId(msg.data.appId);
|
||||
|
||||
Keyboard.sendToSystem('System:InputRegistry:Remove', {
|
||||
id: msgId,
|
||||
manifestURL: manifestURL,
|
||||
inputId: msg.data.inputId
|
||||
});
|
||||
|
||||
// XXX: To be removed when content migrate away from mozChromeEvents.
|
||||
SystemAppProxy.dispatchEvent({
|
||||
type: 'inputregistry-remove',
|
||||
id: msgId,
|
||||
manifestURL: manifestURL,
|
||||
inputId: msg.data.inputId
|
||||
});
|
||||
};
|
||||
|
||||
InputRegistryGlue.prototype.returnMessage = function(detail) {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'mozIApplication.idl',
|
||||
'mozIApplicationClearPrivateDataParams.idl',
|
||||
'nsIAppsService.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_apps'
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIPrincipal;
|
||||
|
||||
/**
|
||||
* We expose Gecko-internal helpers related to "web apps" through this
|
||||
* sub-interface.
|
||||
*/
|
||||
[scriptable, uuid(e76aa5e0-80b2-404f-bccc-1067828bb6ed)]
|
||||
interface mozIApplication: nsISupports
|
||||
{
|
||||
/* Return true if this app has |permission|. */
|
||||
boolean hasPermission(in string permission);
|
||||
|
||||
/* Application status as defined in nsIPrincipal. */
|
||||
readonly attribute unsigned short appStatus;
|
||||
|
||||
/* Returns the uuid of the app. */
|
||||
readonly attribute DOMString id;
|
||||
|
||||
/* Returns the origin of the app. */
|
||||
readonly attribute DOMString origin;
|
||||
|
||||
/* Returns the manifest url of the app. */
|
||||
readonly attribute DOMString manifestURL;
|
||||
|
||||
/* Returns the local id of the app. */
|
||||
readonly attribute unsigned long localId;
|
||||
|
||||
/* Returns the base directory for the app */
|
||||
readonly attribute DOMString basePath;
|
||||
|
||||
/* Name copied from the manifest */
|
||||
readonly attribute DOMString name;
|
||||
|
||||
/* CSP copied from the manifest */
|
||||
readonly attribute DOMString csp;
|
||||
|
||||
/* Store ID if the app is installed from a store */
|
||||
readonly attribute DOMString storeID;
|
||||
|
||||
/* Store version if the app is installed from a store */
|
||||
readonly attribute unsigned long storeVersion;
|
||||
|
||||
/* role copied from the manifest */
|
||||
readonly attribute DOMString role;
|
||||
|
||||
/* Returns the kind of the app. */
|
||||
readonly attribute DOMString kind;
|
||||
|
||||
/* Returns the app's principal */
|
||||
readonly attribute nsIPrincipal principal;
|
||||
};
|
||||
@@ -1,18 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(ba0e6c8e-8c03-4b9b-8f9b-4fb14216f56e)]
|
||||
interface mozIApplicationClearPrivateDataParams : nsISupports
|
||||
{
|
||||
readonly attribute unsigned long appId;
|
||||
readonly attribute boolean browserOnly;
|
||||
};
|
||||
|
||||
%{C++
|
||||
#define TOPIC_WEB_APP_CLEAR_DATA "webapps-clear-data"
|
||||
#define TOPIC_CLEAR_ORIGIN_DATA "clear-origin-attributes-data"
|
||||
%}
|
||||
@@ -1,75 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface mozIApplication;
|
||||
interface nsIURI;
|
||||
|
||||
%{C++
|
||||
#define APPS_SERVICE_CID { 0x05072afa, 0x92fe, 0x45bf, { 0xae, 0x22, 0x39, 0xb6, 0x9c, 0x11, 0x70, 0x58 } }
|
||||
#define APPS_SERVICE_CONTRACTID "@mozilla.org/AppsService;1"
|
||||
%}
|
||||
|
||||
/*
|
||||
* This service allows accessing some DOMApplicationRegistry methods from
|
||||
* non-javascript code.
|
||||
*/
|
||||
[scriptable, uuid(711cfab6-7b72-4aa2-a60c-17952ea05661)]
|
||||
interface nsIAppsService : nsISupports
|
||||
{
|
||||
mozIApplication getAppByManifestURL(in DOMString manifestURL);
|
||||
|
||||
/**
|
||||
* Returns a Promise for the manifest for a given manifestURL.
|
||||
* This is only supported in the parent process: the promise will be rejected
|
||||
* in content processes.
|
||||
*/
|
||||
jsval getManifestFor(in DOMString manifestURL);
|
||||
|
||||
/**
|
||||
* Returns the |localId| of the app associated with the |manifestURL| passed
|
||||
* in parameter.
|
||||
* Returns nsIScriptSecurityManager::NO_APP_ID if |manifestURL| isn't a valid
|
||||
* installed manifest URL.
|
||||
*/
|
||||
unsigned long getAppLocalIdByManifestURL(in DOMString manifestURL);
|
||||
|
||||
/**
|
||||
* Returns the application associated to this localId.
|
||||
*/
|
||||
mozIApplication getAppByLocalId(in unsigned long localId);
|
||||
|
||||
/**
|
||||
* Returns the manifest URL associated to this localId.
|
||||
*/
|
||||
DOMString getManifestURLByLocalId(in unsigned long localId);
|
||||
|
||||
/**
|
||||
* Returns the basepath for core apps
|
||||
*/
|
||||
DOMString getCoreAppsBasePath();
|
||||
|
||||
/**
|
||||
* Returns the basepath for regular packaged apps
|
||||
*/
|
||||
DOMString getWebAppsBasePath();
|
||||
|
||||
/**
|
||||
* Returns true if at least one app is in the registry.
|
||||
*/
|
||||
boolean areAnyAppsInstalled();
|
||||
|
||||
jsval getAppInfo(in DOMString appId);
|
||||
|
||||
/**
|
||||
* Returns the localId if the app was installed from a store
|
||||
*/
|
||||
DOMString getAppLocalIdByStoreId(in DOMString storeID);
|
||||
|
||||
/**
|
||||
* Returns the scope for app to use with service workers.
|
||||
*/
|
||||
DOMString getScopeByLocalId(in unsigned long localId);
|
||||
};
|
||||
@@ -12,44 +12,13 @@ interface nsITabParent;
|
||||
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
|
||||
* nsIDOMMozBrowserFrame::mozbrowser attribute must be true, and the frame
|
||||
* may have to pass various security checks.
|
||||
*/
|
||||
[infallible] readonly attribute boolean reallyIsBrowserOrApp;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
[infallible] readonly attribute boolean reallyIsBrowser;
|
||||
|
||||
/**
|
||||
* 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 uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
return PContentBridgeChild::SendPBrowserConstructor(aActor,
|
||||
@@ -85,7 +84,6 @@ ContentBridgeChild::SendPBrowserConstructor(PBrowserChild* aActor,
|
||||
aContext,
|
||||
aChromeFlags,
|
||||
aCpID,
|
||||
aIsForApp,
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
@@ -130,14 +128,12 @@ ContentBridgeChild::AllocPBrowserChild(const TabId& aTabId,
|
||||
const IPCTabContext &aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
return nsIContentChild::AllocPBrowserChild(aTabId,
|
||||
aContext,
|
||||
aChromeFlags,
|
||||
aCpID,
|
||||
aIsForApp,
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
@@ -153,7 +149,6 @@ ContentBridgeChild::RecvPBrowserConstructor(PBrowserChild* aActor,
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
return ContentChild::GetSingleton()->RecvPBrowserConstructor(aActor,
|
||||
@@ -161,7 +156,6 @@ ContentBridgeChild::RecvPBrowserConstructor(PBrowserChild* aActor,
|
||||
aContext,
|
||||
aChromeFlags,
|
||||
aCpID,
|
||||
aIsForApp,
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ public:
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
|
||||
virtual mozilla::ipc::PFileDescriptorSetChild*
|
||||
@@ -60,7 +59,6 @@ protected:
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
virtual bool DeallocPBrowserChild(PBrowserChild*) override;
|
||||
virtual bool RecvPBrowserConstructor(PBrowserChild* aCctor,
|
||||
@@ -68,7 +66,6 @@ protected:
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
|
||||
virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override;
|
||||
|
||||
@@ -102,7 +102,6 @@ ContentBridgeParent::SendPBrowserConstructor(PBrowserParent* aActor,
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
return PContentBridgeParent::SendPBrowserConstructor(aActor,
|
||||
@@ -110,7 +109,6 @@ ContentBridgeParent::SendPBrowserConstructor(PBrowserParent* aActor,
|
||||
aContext,
|
||||
aChromeFlags,
|
||||
aCpID,
|
||||
aIsForApp,
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
@@ -143,14 +141,12 @@ ContentBridgeParent::AllocPBrowserParent(const TabId& aTabId,
|
||||
const IPCTabContext &aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
return nsIContentParent::AllocPBrowserParent(aTabId,
|
||||
aContext,
|
||||
aChromeFlags,
|
||||
aCpID,
|
||||
aIsForApp,
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ public:
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
|
||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentBridgeParent)
|
||||
@@ -53,10 +52,6 @@ public:
|
||||
{
|
||||
return mChildID;
|
||||
}
|
||||
virtual bool IsForApp() const override
|
||||
{
|
||||
return mIsForApp;
|
||||
}
|
||||
virtual bool IsForBrowser() const override
|
||||
{
|
||||
return mIsForBrowser;
|
||||
@@ -75,11 +70,6 @@ protected:
|
||||
mChildID = aId;
|
||||
}
|
||||
|
||||
void SetIsForApp(bool aIsForApp)
|
||||
{
|
||||
mIsForApp = aIsForApp;
|
||||
}
|
||||
|
||||
void SetIsForBrowser(bool aIsForBrowser)
|
||||
{
|
||||
mIsForBrowser = aIsForBrowser;
|
||||
@@ -114,7 +104,6 @@ protected:
|
||||
const IPCTabContext &aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
|
||||
virtual bool DeallocPBrowserParent(PBrowserParent*) override;
|
||||
@@ -140,7 +129,6 @@ protected: // members
|
||||
RefPtr<ContentBridgeParent> mSelfRef;
|
||||
Transport* mTransport; // owned
|
||||
ContentParentId mChildID;
|
||||
bool mIsForApp;
|
||||
bool mIsForBrowser;
|
||||
|
||||
private:
|
||||
|
||||
@@ -558,8 +558,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
||||
SendBackUpXResources(FileDescriptor(xSocketFd));
|
||||
#endif
|
||||
|
||||
SendGetProcessAttributes(&mID, &mIsForApp, &mIsForBrowser);
|
||||
InitProcessAttributes();
|
||||
SendGetProcessAttributes(&mID, &mIsForBrowser);
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
// Force the creation of the nsPrintingProxy so that it's IPC counterpart,
|
||||
@@ -570,12 +569,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentChild::InitProcessAttributes()
|
||||
{
|
||||
SetProcessName(NS_LITERAL_STRING("Web Content"), true);
|
||||
}
|
||||
|
||||
void
|
||||
ContentChild::SetProcessName(const nsAString& aName, bool aDontOverride)
|
||||
{
|
||||
@@ -682,7 +675,7 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
|
||||
// We release this ref in DeallocPBrowserChild
|
||||
RefPtr<TabChild>(newChild).forget().take(),
|
||||
tabId, *ipcContext, aChromeFlags,
|
||||
GetID(), IsForApp(), IsForBrowser());
|
||||
GetID(), IsForBrowser());
|
||||
|
||||
nsString name(aName);
|
||||
nsAutoCString features(aFeatures);
|
||||
@@ -1248,15 +1241,6 @@ ContentChild::RecvBidiKeyboardNotify(const bool& aIsLangRTL,
|
||||
return true;
|
||||
}
|
||||
|
||||
static CancelableRunnable* sFirstIdleTask;
|
||||
|
||||
static void FirstIdle(void)
|
||||
{
|
||||
MOZ_ASSERT(sFirstIdleTask);
|
||||
sFirstIdleTask = nullptr;
|
||||
ContentChild::GetSingleton()->SendFirstIdle();
|
||||
}
|
||||
|
||||
mozilla::jsipc::PJavaScriptChild *
|
||||
ContentChild::AllocPJavaScriptChild()
|
||||
{
|
||||
@@ -1276,14 +1260,12 @@ ContentChild::AllocPBrowserChild(const TabId& aTabId,
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
return nsIContentChild::AllocPBrowserChild(aTabId,
|
||||
aContext,
|
||||
aChromeFlags,
|
||||
aCpID,
|
||||
aIsForApp,
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
@@ -1293,7 +1275,6 @@ ContentChild::SendPBrowserConstructor(PBrowserChild* aActor,
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
if (IsShuttingDown()) {
|
||||
@@ -1305,7 +1286,6 @@ ContentChild::SendPBrowserConstructor(PBrowserChild* aActor,
|
||||
aContext,
|
||||
aChromeFlags,
|
||||
aCpID,
|
||||
aIsForApp,
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
@@ -1315,7 +1295,6 @@ ContentChild::RecvPBrowserConstructor(PBrowserChild* aActor,
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
MOZ_ASSERT(!IsShuttingDown());
|
||||
@@ -1330,23 +1309,6 @@ ContentChild::RecvPBrowserConstructor(PBrowserChild* aActor,
|
||||
os->NotifyObservers(tc, "tab-child-created", nullptr);
|
||||
}
|
||||
|
||||
static bool hasRunOnce = false;
|
||||
if (!hasRunOnce) {
|
||||
hasRunOnce = true;
|
||||
|
||||
MOZ_ASSERT(!sFirstIdleTask);
|
||||
RefPtr<CancelableRunnable> firstIdleTask = NewCancelableRunnableFunction(FirstIdle);
|
||||
sFirstIdleTask = firstIdleTask;
|
||||
MessageLoop::current()->PostIdleTask(firstIdleTask.forget());
|
||||
|
||||
// Redo InitProcessAttributes() when the app or browser is really
|
||||
// launching so the attributes will be correct.
|
||||
mID = aCpID;
|
||||
mIsForApp = aIsForApp;
|
||||
mIsForBrowser = aIsForBrowser;
|
||||
InitProcessAttributes();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1795,9 +1757,6 @@ ContentChild::ActorDestroy(ActorDestroyReason why)
|
||||
// keep persistent state.
|
||||
ProcessChild::QuickExit();
|
||||
#else
|
||||
if (sFirstIdleTask) {
|
||||
sFirstIdleTask->Cancel();
|
||||
}
|
||||
|
||||
nsHostObjectProtocolHandler::RemoveDataEntries();
|
||||
|
||||
@@ -2091,16 +2050,6 @@ ContentChild::RecvCycleCollect()
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
PreloadSlowThings()
|
||||
{
|
||||
// This fetches and creates all the built-in stylesheets.
|
||||
nsLayoutStylesheetCache::Get()->UserContentSheet();
|
||||
|
||||
TabChild::PreloadSlowThings();
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
|
||||
const nsCString& name, const nsCString& UAName,
|
||||
@@ -2116,25 +2065,6 @@ ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvAppInit()
|
||||
{
|
||||
if (!Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we're part of the mozbrowser machinery, go ahead and start
|
||||
// preloading things. We can only do this for mozbrowser because
|
||||
// PreloadSlowThings() may set the docshell of the first TabChild
|
||||
// inactive, and we can only safely restore it to active from
|
||||
// BrowserElementChild.js.
|
||||
if (mIsForApp || mIsForBrowser) {
|
||||
PreloadSlowThings();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig)
|
||||
{
|
||||
|
||||
@@ -91,8 +91,6 @@ public:
|
||||
base::ProcessId aParentPid,
|
||||
IPC::Channel* aChannel);
|
||||
|
||||
void InitProcessAttributes();
|
||||
|
||||
void InitXPCOM();
|
||||
|
||||
void InitGraphicsDeviceData();
|
||||
@@ -175,7 +173,6 @@ public:
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
|
||||
virtual bool DeallocPBrowserChild(PBrowserChild*) override;
|
||||
@@ -381,8 +378,6 @@ public:
|
||||
const nsCString& name, const nsCString& UAName,
|
||||
const nsCString& ID, const nsCString& vendor) override;
|
||||
|
||||
virtual bool RecvAppInit() override;
|
||||
|
||||
virtual bool
|
||||
RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig) override;
|
||||
|
||||
@@ -483,7 +478,6 @@ public:
|
||||
uint32_t GetMsaaID() const { return mMsaaID; }
|
||||
#endif
|
||||
|
||||
bool IsForApp() const { return mIsForApp; }
|
||||
bool IsForBrowser() const { return mIsForBrowser; }
|
||||
|
||||
virtual PBlobChild*
|
||||
@@ -504,7 +498,6 @@ public:
|
||||
const IPCTabContext& context,
|
||||
const uint32_t& chromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
|
||||
virtual bool RecvPBrowserConstructor(PBrowserChild* aCctor,
|
||||
@@ -512,7 +505,6 @@ public:
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpID,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
|
||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentChild)
|
||||
@@ -618,7 +610,6 @@ private:
|
||||
|
||||
AppInfo mAppInfo;
|
||||
|
||||
bool mIsForApp;
|
||||
bool mIsForBrowser;
|
||||
bool mCanOverrideProcessName;
|
||||
bool mIsAlive;
|
||||
|
||||
+92
-471
@@ -27,7 +27,6 @@
|
||||
#include "HandlerServiceParent.h"
|
||||
#include "IHistory.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "mozIApplication.h"
|
||||
#if defined(XP_WIN) && defined(ACCESSIBILITY)
|
||||
#include "mozilla/a11y/AccessibleWrap.h"
|
||||
#endif
|
||||
@@ -99,7 +98,6 @@
|
||||
#include "nsFrameMessageManager.h"
|
||||
#include "nsHashPropertyBag.h"
|
||||
#include "nsIAlertsService.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
#include "nsICycleCollectorListener.h"
|
||||
@@ -147,7 +145,6 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsToolkitCompsCID.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "PreallocatedProcessManager.h"
|
||||
#include "ProcessPriorityManager.h"
|
||||
#include "SandboxHal.h"
|
||||
#include "ScreenManagerParent.h"
|
||||
@@ -457,8 +454,7 @@ ContentParentsMemoryReporter::CollectReports(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDataHashtable<nsStringHashKey, ContentParent*>* ContentParent::sAppContentParents;
|
||||
nsTArray<ContentParent*>* ContentParent::sNonAppContentParents;
|
||||
nsTArray<ContentParent*>* ContentParent::sBrowserContentParents;
|
||||
nsTArray<ContentParent*>* ContentParent::sLargeAllocationContentParents;
|
||||
nsTArray<ContentParent*>* ContentParent::sPrivateContent;
|
||||
StaticAutoPtr<LinkedList<ContentParent> > ContentParent::sContentParents;
|
||||
@@ -474,11 +470,6 @@ static bool sDisableUnsafeCPOWWarnings = false;
|
||||
// The first content child has ID 1, so the chrome process can have ID 0.
|
||||
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[] = {
|
||||
"xpcom-shutdown",
|
||||
"profile-before-change",
|
||||
@@ -497,77 +488,6 @@ static const char* sObserverTopics[] = {
|
||||
"cacheservice:empty-cache",
|
||||
};
|
||||
|
||||
// PreallocateAppProcess is called by the PreallocatedProcessManager.
|
||||
// ContentParent then takes this process back within
|
||||
// GetNewOrPreallocatedAppProcess.
|
||||
/*static*/ already_AddRefed<ContentParent>
|
||||
ContentParent::PreallocateAppProcess()
|
||||
{
|
||||
RefPtr<ContentParent> process =
|
||||
new ContentParent(/* app = */ nullptr,
|
||||
/* aOpener = */ nullptr,
|
||||
/* isForBrowserElement = */ false,
|
||||
/* isForPreallocated = */ true);
|
||||
|
||||
if (!process->LaunchSubprocess(PROCESS_PRIORITY_PREALLOC)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
process->Init();
|
||||
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
|
||||
ContentParent::StartUp()
|
||||
{
|
||||
@@ -589,9 +509,6 @@ ContentParent::StartUp()
|
||||
|
||||
BackgroundChild::Startup();
|
||||
|
||||
// Try to preallocate a process that we can transform into an app later.
|
||||
PreallocatedProcessManager::AllocateAfterDelay();
|
||||
|
||||
sDisableUnsafeCPOWWarnings = PR_GetEnv("DISABLE_UNSAFE_CPOW_WARNINGS");
|
||||
}
|
||||
|
||||
@@ -669,10 +586,10 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
|
||||
|
||||
maxContentParents = Preferences::GetInt("dom.ipc.dedicatedProcessCount", 2);
|
||||
} else {
|
||||
if (!sNonAppContentParents) {
|
||||
sNonAppContentParents = new nsTArray<ContentParent*>();
|
||||
if (!sBrowserContentParents) {
|
||||
sBrowserContentParents = new nsTArray<ContentParent*>();
|
||||
}
|
||||
contentParents = sNonAppContentParents;
|
||||
contentParents = sBrowserContentParents;
|
||||
|
||||
maxContentParents = Preferences::GetInt("dom.ipc.processCount", 1);
|
||||
}
|
||||
@@ -688,7 +605,7 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
|
||||
uint32_t currIdx = startIdx;
|
||||
do {
|
||||
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) {
|
||||
return p.forget();
|
||||
}
|
||||
@@ -696,24 +613,14 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
|
||||
} while (currIdx != startIdx);
|
||||
}
|
||||
|
||||
// Try to take and transform the preallocated process into browser.
|
||||
RefPtr<ContentParent> p = PreallocatedProcessManager::Take();
|
||||
if (p) {
|
||||
p->TransformPreallocatedIntoBrowser(aOpener);
|
||||
} else {
|
||||
// Failed in using the preallocated process: fork from the chrome process.
|
||||
p = new ContentParent(/* app = */ nullptr,
|
||||
aOpener,
|
||||
aForBrowserElement,
|
||||
/* isForPreallocated = */ false);
|
||||
RefPtr<ContentParent> p = new ContentParent(aOpener, aForBrowserElement);
|
||||
|
||||
if (!p->LaunchSubprocess(aPriority)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
p->Init();
|
||||
if (!p->LaunchSubprocess(aPriority)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
p->Init();
|
||||
|
||||
p->mLargeAllocationProcess = aLargeAllocationProcess;
|
||||
|
||||
p->ForwardKnownInfo();
|
||||
@@ -771,18 +678,11 @@ ContentParent::SendAsyncUpdate(nsIWidget* aWidget)
|
||||
ContentParent::SendAsyncUpdate(nsIWidget* aWidget) {}
|
||||
#endif
|
||||
|
||||
bool
|
||||
ContentParent::PreallocatedProcessReady()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvCreateChildProcess(const IPCTabContext& aContext,
|
||||
const hal::ProcessPriority& aPriority,
|
||||
const TabId& aOpenerTabId,
|
||||
ContentParentId* aCpId,
|
||||
bool* aIsForApp,
|
||||
bool* aIsForBrowser,
|
||||
TabId* aTabId)
|
||||
{
|
||||
@@ -800,24 +700,16 @@ ContentParent::RecvCreateChildProcess(const IPCTabContext& aContext,
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIApplication> ownApp = tc.GetTabContext().GetOwnApp();
|
||||
if (ownApp) {
|
||||
cp = GetNewOrPreallocatedAppProcess(ownApp, aPriority, this);
|
||||
}
|
||||
else {
|
||||
cp = GetNewOrUsedBrowserProcess(/* isBrowserElement = */ true,
|
||||
aPriority, this);
|
||||
}
|
||||
cp = GetNewOrUsedBrowserProcess(/* isBrowserElement = */ true,
|
||||
aPriority, this);
|
||||
|
||||
if (!cp) {
|
||||
*aCpId = 0;
|
||||
*aIsForApp = false;
|
||||
*aIsForBrowser = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
*aCpId = cp->ChildID();
|
||||
*aIsForApp = cp->IsForApp();
|
||||
*aIsForBrowser = cp->IsForBrowser();
|
||||
|
||||
ContentProcessManager *cpm = ContentProcessManager::GetSingleton();
|
||||
@@ -964,10 +856,10 @@ ContentParent::RecvFindPlugins(const uint32_t& aPluginEpoch,
|
||||
#endif
|
||||
|
||||
/*static*/ TabParent*
|
||||
ContentParent::CreateBrowserOrApp(const TabContext& aContext,
|
||||
Element* aFrameElement,
|
||||
ContentParent* aOpenerContentParent,
|
||||
bool aFreshProcess)
|
||||
ContentParent::CreateBrowser(const TabContext& aContext,
|
||||
Element* aFrameElement,
|
||||
ContentParent* aOpenerContentParent,
|
||||
bool aFreshProcess)
|
||||
{
|
||||
PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
|
||||
|
||||
@@ -990,222 +882,74 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext,
|
||||
openerTabId = TabParent::GetTabIdFrom(docShell);
|
||||
}
|
||||
|
||||
if (aContext.IsMozBrowserElement() || !aContext.HasOwnApp()) {
|
||||
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;
|
||||
|
||||
RefPtr<nsIContentParent> constructorSender;
|
||||
if (isInContentProcess) {
|
||||
parent = CreateContentBridgeParent(aContext,
|
||||
initialPriority,
|
||||
openerTabId,
|
||||
&tabId);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<mozIApplication> ownApp = aContext.GetOwnApp();
|
||||
|
||||
if (!sAppContentParents) {
|
||||
sAppContentParents =
|
||||
new nsDataHashtable<nsStringHashKey, ContentParent*>();
|
||||
MOZ_ASSERT(aContext.IsMozBrowserElement());
|
||||
constructorSender = CreateContentBridgeParent(aContext, initialPriority,
|
||||
openerTabId, &tabId);
|
||||
} else {
|
||||
constructorSender =
|
||||
GetNewOrUsedBrowserProcess(aContext.IsMozBrowserElement(),
|
||||
initialPriority, nullptr, aFreshProcess);
|
||||
if (!constructorSender) {
|
||||
return nullptr;
|
||||
}
|
||||
tabId = AllocateTabId(openerTabId,
|
||||
aContext.AsIPCTabContext(),
|
||||
constructorSender->ChildID());
|
||||
}
|
||||
|
||||
// Each app gets its own ContentParent instance unless it shares it with
|
||||
// a parent app.
|
||||
if (NS_FAILED(ownApp->GetManifestURL(manifestURL))) {
|
||||
NS_ERROR("Failed to get manifest URL");
|
||||
if (constructorSender) {
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
docShell->GetTreeOwner(getter_AddRefs(treeOwner));
|
||||
if (!treeOwner) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ContentParent> p = sAppContentParents->Get(manifestURL);
|
||||
|
||||
if (!p && Preferences::GetBool("dom.ipc.reuse_parent_app")) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIWebBrowserChrome> wbc = do_GetInterface(treeOwner);
|
||||
if (!wbc) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (p) {
|
||||
// Check that the process is still alive and set its priority.
|
||||
// Hopefully the process won't die after this point, if this call
|
||||
// succeeds.
|
||||
if (!p->SetPriorityAndCheckIsAlive(initialPriority)) {
|
||||
p = nullptr;
|
||||
}
|
||||
uint32_t chromeFlags = 0;
|
||||
wbc->GetChromeFlags(&chromeFlags);
|
||||
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell);
|
||||
if (loadContext && loadContext->UsePrivateBrowsing()) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
||||
}
|
||||
|
||||
reused = !!p;
|
||||
if (!p) {
|
||||
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 (docShell->GetAffectPrivateSessionLifetime()) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME;
|
||||
}
|
||||
|
||||
// If we took the preallocated process and it was already dead, try
|
||||
// again with a non-preallocated process. We can be sure this won't
|
||||
// loop forever, because the next time through there will be no
|
||||
// preallocated process to take.
|
||||
if (tookPreallocated) {
|
||||
return ContentParent::CreateBrowserOrApp(aContext, aFrameElement,
|
||||
aOpenerContentParent);
|
||||
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->IsForBrowser());
|
||||
|
||||
if (aFreshProcess) {
|
||||
Unused << browser->SendSetFreshProcess();
|
||||
}
|
||||
|
||||
// Otherwise just give up.
|
||||
return nullptr;
|
||||
if (browser) {
|
||||
RefPtr<TabParent> constructedTabParent = TabParent::GetFrom(browser);
|
||||
constructedTabParent->SetOwnerElement(aFrameElement);
|
||||
return constructedTabParent;
|
||||
}
|
||||
}
|
||||
|
||||
return TabParent::GetFrom(browser);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*static*/ ContentBridgeParent*
|
||||
@@ -1218,13 +962,11 @@ ContentParent::CreateContentBridgeParent(const TabContext& aContext,
|
||||
|
||||
ContentChild* child = ContentChild::GetSingleton();
|
||||
ContentParentId cpId;
|
||||
bool isForApp;
|
||||
bool isForBrowser;
|
||||
if (!child->SendCreateChildProcess(aContext.AsIPCTabContext(),
|
||||
aPriority,
|
||||
aOpenerTabId,
|
||||
&cpId,
|
||||
&isForApp,
|
||||
&isForBrowser,
|
||||
aTabId)) {
|
||||
return nullptr;
|
||||
@@ -1237,7 +979,6 @@ ContentParent::CreateContentBridgeParent(const TabContext& aContext,
|
||||
}
|
||||
ContentBridgeParent* parent = child->GetLastBridge();
|
||||
parent->SetChildID(cpId);
|
||||
parent->SetIsForApp(isForApp);
|
||||
parent->SetIsForBrowser(isForBrowser);
|
||||
return parent;
|
||||
}
|
||||
@@ -1352,51 +1093,6 @@ ContentParent::SetPriorityAndCheckIsAlive(ProcessPriority aPriority)
|
||||
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
|
||||
ContentParent::TransformPreallocatedIntoBrowser(ContentParent* aOpener)
|
||||
{
|
||||
// Reset mAppManifestURL, mIsForBrowser and mOSPrivileges for browser.
|
||||
mMetamorphosed = true;
|
||||
mOpener = aOpener;
|
||||
mAppManifestURL.Truncate();
|
||||
mIsForBrowser = true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::ShutDownProcess(ShutDownMethod aMethod)
|
||||
{
|
||||
@@ -1480,29 +1176,19 @@ ContentParent::ShutDownMessageManager()
|
||||
void
|
||||
ContentParent::MarkAsDead()
|
||||
{
|
||||
if (!mAppManifestURL.IsEmpty()) {
|
||||
if (sAppContentParents) {
|
||||
sAppContentParents->Remove(mAppManifestURL);
|
||||
if (!sAppContentParents->Count()) {
|
||||
delete sAppContentParents;
|
||||
sAppContentParents = nullptr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sNonAppContentParents) {
|
||||
sNonAppContentParents->RemoveElement(this);
|
||||
if (!sNonAppContentParents->Length()) {
|
||||
delete sNonAppContentParents;
|
||||
sNonAppContentParents = nullptr;
|
||||
}
|
||||
if (sBrowserContentParents) {
|
||||
sBrowserContentParents->RemoveElement(this);
|
||||
if (!sBrowserContentParents->Length()) {
|
||||
delete sBrowserContentParents;
|
||||
sBrowserContentParents = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (sLargeAllocationContentParents) {
|
||||
sLargeAllocationContentParents->RemoveElement(this);
|
||||
if (!sLargeAllocationContentParents->Length()) {
|
||||
delete sLargeAllocationContentParents;
|
||||
sLargeAllocationContentParents = nullptr;
|
||||
}
|
||||
if (sLargeAllocationContentParents) {
|
||||
sLargeAllocationContentParents->RemoveElement(this);
|
||||
if (!sLargeAllocationContentParents->Length()) {
|
||||
delete sLargeAllocationContentParents;
|
||||
sLargeAllocationContentParents = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1805,7 +1491,7 @@ ContentParent::NotifyTabDestroying(const TabId& aTabId,
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t numberOfParents = sNonAppContentParents ? sNonAppContentParents->Length() : 0;
|
||||
uint32_t numberOfParents = sBrowserContentParents ? sBrowserContentParents->Length() : 0;
|
||||
int32_t processesToKeepAlive = Preferences::GetInt("dom.ipc.keepProcessesAlive", 0);
|
||||
if (!cp->mLargeAllocationProcess && static_cast<int32_t>(numberOfParents) <= processesToKeepAlive) {
|
||||
return;
|
||||
@@ -1862,7 +1548,7 @@ ContentParent::NotifyTabDestroyed(const TabId& aTabId,
|
||||
|
||||
// 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.
|
||||
uint32_t numberOfParents = sNonAppContentParents ? sNonAppContentParents->Length() : 0;
|
||||
uint32_t numberOfParents = sBrowserContentParents ? sBrowserContentParents->Length() : 0;
|
||||
int32_t processesToKeepAlive = Preferences::GetInt("dom.ipc.keepProcessesAlive", 0);
|
||||
bool shouldKeepAliveAny = !mLargeAllocationProcess && processesToKeepAlive > 0;
|
||||
bool shouldKeepAliveThis = shouldKeepAliveAny && static_cast<int32_t>(numberOfParents) <= processesToKeepAlive;
|
||||
@@ -1956,10 +1642,8 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
|
||||
return true;
|
||||
}
|
||||
|
||||
ContentParent::ContentParent(mozIApplication* aApp,
|
||||
ContentParent* aOpener,
|
||||
bool aIsForBrowser,
|
||||
bool aIsForPreallocated)
|
||||
ContentParent::ContentParent(ContentParent* aOpener,
|
||||
bool aIsForBrowser)
|
||||
: nsIContentParent()
|
||||
, mOpener(aOpener)
|
||||
, mIsForBrowser(aIsForBrowser)
|
||||
@@ -1967,10 +1651,6 @@ ContentParent::ContentParent(mozIApplication* aApp,
|
||||
{
|
||||
InitializeMembers(); // Perform common initialization.
|
||||
|
||||
// No more than one of !!aApp, aIsForBrowser, aIsForPreallocated should be
|
||||
// true.
|
||||
MOZ_ASSERT(!!aApp + aIsForBrowser + aIsForPreallocated <= 1);
|
||||
|
||||
mMetamorphosed = true;
|
||||
|
||||
// Insert ourselves into the global linked list of ContentParent objects.
|
||||
@@ -1979,13 +1659,6 @@ ContentParent::ContentParent(mozIApplication* aApp,
|
||||
}
|
||||
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
|
||||
// PID along with the warning.
|
||||
nsDebugImpl::SetMultiprocessMode("Parent");
|
||||
@@ -2012,19 +1685,10 @@ ContentParent::~ContentParent()
|
||||
|
||||
// We should be removed from all these lists in ActorDestroy.
|
||||
MOZ_ASSERT(!sPrivateContent || !sPrivateContent->Contains(this));
|
||||
if (mAppManifestURL.IsEmpty()) {
|
||||
MOZ_ASSERT((!sNonAppContentParents ||
|
||||
!sNonAppContentParents->Contains(this)) &&
|
||||
(!sLargeAllocationContentParents ||
|
||||
!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);
|
||||
}
|
||||
MOZ_ASSERT((!sBrowserContentParents ||
|
||||
!sBrowserContentParents->Contains(this)) &&
|
||||
(!sLargeAllocationContentParents ||
|
||||
!sLargeAllocationContentParents->Contains(this)));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2096,11 +1760,6 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
||||
}
|
||||
}
|
||||
|
||||
if (gAppData) {
|
||||
// Sending all information to content process.
|
||||
Unused << SendAppInit();
|
||||
}
|
||||
|
||||
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||
if (sheetService) {
|
||||
// This looks like a lot of work, but in a normal browser session we just
|
||||
@@ -2160,12 +1819,6 @@ ContentParent::IsAlive() const
|
||||
return mIsAlive;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::IsForApp() const
|
||||
{
|
||||
return !mAppManifestURL.IsEmpty();
|
||||
}
|
||||
|
||||
int32_t
|
||||
ContentParent::Pid() const
|
||||
{
|
||||
@@ -2406,17 +2059,6 @@ ContentParent::RecvGetShowPasswordSetting(bool* showPassword)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvFirstIdle()
|
||||
{
|
||||
// When the ContentChild goes idle, it sends us a FirstIdle message
|
||||
// which we use as a good time to prelaunch another process. If we
|
||||
// prelaunch any sooner than this, then we'll be competing with the
|
||||
// child process and slowing it down.
|
||||
PreallocatedProcessManager::AllocateAfterDelay();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel,
|
||||
const bool& aHidden)
|
||||
@@ -2587,10 +2229,9 @@ ContentParent::AllocPProcessHangMonitorParent(Transport* aTransport,
|
||||
|
||||
bool
|
||||
ContentParent::RecvGetProcessAttributes(ContentParentId* aCpId,
|
||||
bool* aIsForApp, bool* aIsForBrowser)
|
||||
bool* aIsForBrowser)
|
||||
{
|
||||
*aCpId = mChildID;
|
||||
*aIsForApp = IsForApp();
|
||||
*aIsForBrowser = mIsForBrowser;
|
||||
|
||||
return true;
|
||||
@@ -2699,14 +2340,12 @@ ContentParent::AllocPBrowserParent(const TabId& aTabId,
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpId,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
return nsIContentParent::AllocPBrowserParent(aTabId,
|
||||
aContext,
|
||||
aChromeFlags,
|
||||
aCpId,
|
||||
aIsForApp,
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
@@ -2804,27 +2443,14 @@ ContentParent::KillHard(const char* aReason)
|
||||
otherProcessHandle, /*force=*/true));
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::IsPreallocated() const
|
||||
{
|
||||
return mAppManifestURL == MAGIC_PREALLOCATED_APP_MANIFEST_URL;
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::FriendlyName(nsAString& aName, bool aAnonymize)
|
||||
{
|
||||
aName.Truncate();
|
||||
if (IsPreallocated()) {
|
||||
aName.AssignLiteral("(Preallocated)");
|
||||
} else if (mIsForBrowser) {
|
||||
if (mIsForBrowser) {
|
||||
aName.AssignLiteral("Browser");
|
||||
} else if (aAnonymize) {
|
||||
aName.AssignLiteral("<anonymized-name>");
|
||||
} else if (!mAppName.IsEmpty()) {
|
||||
aName = mAppName;
|
||||
} else if (!mAppManifestURL.IsEmpty()) {
|
||||
aName.AssignLiteral("Unknown app: ");
|
||||
aName.Append(mAppManifestURL);
|
||||
} else {
|
||||
aName.AssignLiteral("???");
|
||||
}
|
||||
@@ -3661,7 +3287,6 @@ ContentParent::SendPBrowserConstructor(PBrowserParent* aActor,
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpId,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser)
|
||||
{
|
||||
return PContentParent::SendPBrowserConstructor(aActor,
|
||||
@@ -3669,7 +3294,6 @@ ContentParent::SendPBrowserConstructor(PBrowserParent* aActor,
|
||||
aContext,
|
||||
aChromeFlags,
|
||||
aCpId,
|
||||
aIsForApp,
|
||||
aIsForBrowser);
|
||||
}
|
||||
|
||||
@@ -3787,12 +3411,9 @@ ContentParent::RecvRecordingDeviceEvents(const nsString& aRecordingStatus,
|
||||
// recording-device-ipc-events needs to gather more information from content process
|
||||
RefPtr<nsHashPropertyBag> props = new nsHashPropertyBag();
|
||||
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("isVideo"), aIsVideo);
|
||||
|
||||
nsString requestURL = IsForApp() ? AppManifestURL() : aPageURL;
|
||||
props->SetPropertyAsAString(NS_LITERAL_STRING("requestURL"), requestURL);
|
||||
props->SetPropertyAsAString(NS_LITERAL_STRING("requestURL"), aPageURL);
|
||||
|
||||
obs->NotifyObservers((nsIPropertyBag2*) props,
|
||||
"recording-device-ipc-events",
|
||||
@@ -4247,7 +3868,7 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
|
||||
thisTabParent = TabParent::GetFrom(aThisTab);
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(thisTabParent && thisTabParent->IsMozBrowserOrApp())) {
|
||||
if (NS_WARN_IF(thisTabParent && thisTabParent->IsMozBrowser())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+9
-60
@@ -114,8 +114,6 @@ public:
|
||||
*/
|
||||
static void JoinAllSubprocesses();
|
||||
|
||||
static bool PreallocatedProcessReady();
|
||||
|
||||
/**
|
||||
* Get or create a content process for:
|
||||
* 1. browser iframe
|
||||
@@ -129,21 +127,16 @@ public:
|
||||
ContentParent* aOpener = nullptr,
|
||||
bool aLargeAllocationProcess = false);
|
||||
|
||||
/**
|
||||
* Create a subprocess suitable for use as a preallocated app process.
|
||||
*/
|
||||
static already_AddRefed<ContentParent> PreallocateAppProcess();
|
||||
|
||||
/**
|
||||
* Get or create a content process for the given TabContext. aFrameElement
|
||||
* should be the frame/iframe element with which this process will
|
||||
* associated.
|
||||
*/
|
||||
static TabParent*
|
||||
CreateBrowserOrApp(const TabContext& aContext,
|
||||
Element* aFrameElement,
|
||||
ContentParent* aOpenerContentParent,
|
||||
bool aFreshProcess = false);
|
||||
CreateBrowser(const TabContext& aContext,
|
||||
Element* aFrameElement,
|
||||
ContentParent* aOpenerContentParent,
|
||||
bool aFreshProcess = false);
|
||||
|
||||
static void GetAll(nsTArray<ContentParent*>& aArray);
|
||||
|
||||
@@ -231,7 +224,6 @@ public:
|
||||
const hal::ProcessPriority& aPriority,
|
||||
const TabId& aOpenerTabId,
|
||||
ContentParentId* aCpId,
|
||||
bool* aIsForApp,
|
||||
bool* aIsForBrowser,
|
||||
TabId* aTabId) override;
|
||||
|
||||
@@ -323,8 +315,6 @@ public:
|
||||
|
||||
bool IsAlive() const;
|
||||
|
||||
virtual bool IsForApp() const override;
|
||||
|
||||
virtual bool IsForBrowser() const override
|
||||
{
|
||||
return mIsForBrowser;
|
||||
@@ -357,10 +347,6 @@ public:
|
||||
|
||||
ContentParentId ChildID() const override { return mChildID; }
|
||||
|
||||
const nsString& AppManifestURL() const { return mAppManifestURL; }
|
||||
|
||||
bool IsPreallocated() const;
|
||||
|
||||
/**
|
||||
* Get a user-friendly name for this ContentParent. We make no guarantees
|
||||
* about this name: It might not be unique, apps can spoof special names,
|
||||
@@ -546,8 +532,7 @@ protected:
|
||||
void OnCompositorUnexpectedShutdown() override;
|
||||
|
||||
private:
|
||||
static nsDataHashtable<nsStringHashKey, ContentParent*> *sAppContentParents;
|
||||
static nsTArray<ContentParent*>* sNonAppContentParents;
|
||||
static nsTArray<ContentParent*>* sBrowserContentParents;
|
||||
static nsTArray<ContentParent*>* sLargeAllocationContentParents;
|
||||
static nsTArray<ContentParent*>* sPrivateContent;
|
||||
static StaticAutoPtr<LinkedList<ContentParent> > sContentParents;
|
||||
@@ -555,15 +540,6 @@ private:
|
||||
static void JoinProcessesIOThread(const nsTArray<ContentParent*>* aProcesses,
|
||||
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 ContentBridgeParent* CreateContentBridgeParent(const TabContext& aContext,
|
||||
@@ -579,18 +555,13 @@ private:
|
||||
const IPCTabContext& context,
|
||||
const uint32_t& chromeFlags,
|
||||
const ContentParentId& aCpId,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
using PContentParent::SendPTestShellConstructor;
|
||||
|
||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
|
||||
|
||||
// No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated may be
|
||||
// true.
|
||||
ContentParent(mozIApplication* aApp,
|
||||
ContentParent* aOpener,
|
||||
bool aIsForBrowser,
|
||||
bool aIsForPreallocated);
|
||||
ContentParent(ContentParent* aOpener,
|
||||
bool aIsForBrowser);
|
||||
|
||||
// The common initialization for the constructors.
|
||||
void InitializeMembers();
|
||||
@@ -610,7 +581,7 @@ private:
|
||||
|
||||
// Some information could be sent to content very early, it
|
||||
// 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();
|
||||
|
||||
// Set the child process's priority and then check whether the child is
|
||||
@@ -619,15 +590,6 @@ private:
|
||||
// unlikely that the process will be killed after this point.
|
||||
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
|
||||
// returns false, the child process has died.
|
||||
void TransformPreallocatedIntoBrowser(ContentParent* aOpener);
|
||||
|
||||
/**
|
||||
* Mark this ContentParent as dead for the purposes of Get*().
|
||||
* This method is idempotent.
|
||||
@@ -688,7 +650,6 @@ private:
|
||||
ProcessId aOtherProcess) override;
|
||||
|
||||
virtual bool RecvGetProcessAttributes(ContentParentId* aCpId,
|
||||
bool* aIsForApp,
|
||||
bool* aIsForBrowser) override;
|
||||
|
||||
virtual bool
|
||||
@@ -713,7 +674,6 @@ private:
|
||||
const IPCTabContext& aContext,
|
||||
const uint32_t& aChromeFlags,
|
||||
const ContentParentId& aCpId,
|
||||
const bool& aIsForApp,
|
||||
const bool& aIsForBrowser) override;
|
||||
|
||||
virtual bool DeallocPBrowserParent(PBrowserParent* frame) override;
|
||||
@@ -912,8 +872,6 @@ private:
|
||||
|
||||
virtual bool RecvPrivateDocShellsExist(const bool& aExist) override;
|
||||
|
||||
virtual bool RecvFirstIdle() override;
|
||||
|
||||
virtual bool RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel,
|
||||
const bool& aHidden) override;
|
||||
|
||||
@@ -1049,17 +1007,8 @@ private:
|
||||
ContentParentId mChildID;
|
||||
int32_t mGeolocationWatchID;
|
||||
|
||||
nsString mAppManifestURL;
|
||||
|
||||
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
|
||||
// that even content processes that are 100% blocked (say from
|
||||
// SIGSTOP), are still killed eventually. This task enforces that
|
||||
@@ -1075,7 +1024,7 @@ private:
|
||||
// through.
|
||||
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.
|
||||
bool mMetamorphosed;
|
||||
|
||||
|
||||
@@ -353,19 +353,5 @@ ContentProcessManager::GetTabParentsByProcessId(const ContentParentId& aChildCpI
|
||||
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 mozilla
|
||||
@@ -142,15 +142,6 @@ public:
|
||||
GetTopLevelTabParentByProcessAndTabId(const ContentParentId& aChildCpId,
|
||||
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:
|
||||
static StaticAutoPtr<ContentProcessManager> sSingleton;
|
||||
TabId mUniqueId;
|
||||
|
||||
Loaded 100 of 770 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user