1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00

Issue #1787 - Remove nsIAppsService, mozIApplication and mozapp data cleanup.

This commit is contained in:
Moonchild
2024-11-20 20:18:19 +01:00
committed by roytam1
parent ef5f052d97
commit ff89fee91d
43 changed files with 5 additions and 1032 deletions
+2 -7
View File
@@ -624,13 +624,8 @@ BasePrincipal::GetOriginSuffix(nsACString& aOriginAttributes)
NS_IMETHODIMP NS_IMETHODIMP
BasePrincipal::GetAppStatus(uint16_t* aAppStatus) BasePrincipal::GetAppStatus(uint16_t* aAppStatus)
{ {
if (AppId() == nsIScriptSecurityManager::UNKNOWN_APP_ID) { // TODO: Remove GetAppStatus.
NS_WARNING("Asking for app status on a principal with an unknown app id"); *aAppStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
*aAppStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
return NS_OK;
}
*aAppStatus = nsScriptSecurityManager::AppStatusForPrincipal(this);
return NS_OK; return NS_OK;
} }
-2
View File
@@ -31,8 +31,6 @@
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/HashFunctions.h" #include "mozilla/HashFunctions.h"
#include "nsIAppsService.h"
using namespace mozilla; using namespace mozilla;
static bool gCodeBasePrincipalSupport = false; static bool gCodeBasePrincipalSupport = false;
-8
View File
@@ -9,7 +9,6 @@
#include "xpcpublic.h" #include "xpcpublic.h"
#include "XPCWrapper.h" #include "XPCWrapper.h"
#include "nsIAppsService.h"
#include "nsIInputStreamChannel.h" #include "nsIInputStreamChannel.h"
#include "nsILoadContext.h" #include "nsILoadContext.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
@@ -55,7 +54,6 @@
#include "nsIChromeRegistry.h" #include "nsIChromeRegistry.h"
#include "nsIContentSecurityPolicy.h" #include "nsIContentSecurityPolicy.h"
#include "nsIAsyncVerifyRedirectCallback.h" #include "nsIAsyncVerifyRedirectCallback.h"
#include "mozIApplication.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/ContentParent.h" #include "mozilla/dom/ContentParent.h"
@@ -240,12 +238,6 @@ nsScriptSecurityManager::SecurityHashURI(nsIURI* aURI)
return NS_SecurityHashURI(aURI); return NS_SecurityHashURI(aURI);
} }
uint16_t
nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
{
return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
}
/* /*
* GetChannelResultPrincipal will return the principal that the resource * GetChannelResultPrincipal will return the principal that the resource
* returned by this channel will use. For example, if the resource is in * returned by this channel will use. For example, if the resource is in
-1
View File
@@ -193,7 +193,6 @@
#include "nsSandboxFlags.h" #include "nsSandboxFlags.h"
#include "nsXULAppAPI.h" #include "nsXULAppAPI.h"
#include "nsDOMNavigationTiming.h" #include "nsDOMNavigationTiming.h"
#include "nsIAppsService.h"
#include "nsDSURIContentListener.h" #include "nsDSURIContentListener.h"
#include "nsDocShellLoadTypes.h" #include "nsDocShellLoadTypes.h"
#include "nsDocShellTransferableHooks.h" #include "nsDocShellTransferableHooks.h"
-114
View File
@@ -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])
-2
View File
@@ -1,2 +0,0 @@
component {05072afa-92fe-45bf-ae22-39b69c117058} AppsService.js
contract @mozilla.org/AppsService;1 {05072afa-92fe-45bf-ae22-39b69c117058}
-408
View File
@@ -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
View File
@@ -19,14 +19,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm"); "resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "appsService", // Shared code for Webapps.jsm and Webapps.js
"@mozilla.org/AppsService;1",
"nsIAppsService");
// Shared code for AppsServiceChild.jsm, Webapps.jsm and Webapps.js
this.EXPORTED_SYMBOLS = this.EXPORTED_SYMBOLS =
["AppsUtils", "ManifestHelper", "isAbsoluteURI", "mozIApplication"]; ["AppsUtils", "ManifestHelper", "isAbsoluteURI"];
function debug(s) { function debug(s) {
//dump("-*- AppsUtils.jsm: " + s + "\n"); //dump("-*- AppsUtils.jsm: " + s + "\n");
@@ -39,46 +35,6 @@ this.isAbsoluteURI = function(aURI) {
Services.io.newURI(aURI, null, bar).prePath != bar.prePath; 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) { function _setAppProperties(aObj, aApp) {
aObj.name = aApp.name; aObj.name = aApp.name;
aObj.csp = aApp.csp; aObj.csp = aApp.csp;
@@ -217,21 +173,6 @@ this.AppsUtils = {
return aPagePath.substr(pathPos, pathLen); 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) { getManifestFor: function getManifestFor(aManifestURL) {
debug("getManifestFor(" + aManifestURL + ")"); debug("getManifestFor(" + aManifestURL + ")");
return DOMApplicationRegistry.getManifestFor(aManifestURL); return DOMApplicationRegistry.getManifestFor(aManifestURL);
@@ -259,18 +200,6 @@ this.AppsUtils = {
return Ci.nsIScriptSecurityManager.NO_APP_ID; 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) { getManifestURLByLocalId: function getManifestURLByLocalId(aApps, aLocalId) {
debug("getManifestURLByLocalId " + aLocalId); debug("getManifestURLByLocalId " + aLocalId);
for (let id in aApps) { for (let id in aApps) {
@@ -697,14 +626,6 @@ this.AppsUtils = {
return this.computeHash(JSON.stringify(aObject)); 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);
},
} }
/** /**
-6
View File
@@ -5,13 +5,7 @@
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
EXTRA_COMPONENTS += [
'AppsService.js',
'AppsService.manifest',
]
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
'AppsServiceChild.jsm',
'AppsUtils.jsm', 'AppsUtils.jsm',
'PermissionsInstaller.jsm', 'PermissionsInstaller.jsm',
'PermissionsTable.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();
}
-1
View File
@@ -2,4 +2,3 @@
[test_manifestSanitizer.js] [test_manifestSanitizer.js]
[test_manifestHelper.js] [test_manifestHelper.js]
[test_moziapplication.js]
-1
View File
@@ -62,7 +62,6 @@
#include "nsIHttpChannelInternal.h" #include "nsIHttpChannelInternal.h"
#include "TimeManager.h" #include "TimeManager.h"
#include "nsStreamUtils.h" #include "nsStreamUtils.h"
#include "nsIAppsService.h"
#include "WidgetUtils.h" #include "WidgetUtils.h"
#include "mozilla/dom/MediaDevices.h" #include "mozilla/dom/MediaDevices.h"
#include "MediaManager.h" #include "MediaManager.h"
-1
View File
@@ -13,7 +13,6 @@
#include "prenv.h" #include "prenv.h"
#include "nsDocShell.h" #include "nsDocShell.h"
#include "nsIAppsService.h"
#include "nsIDOMHTMLIFrameElement.h" #include "nsIDOMHTMLIFrameElement.h"
#include "nsIDOMHTMLFrameElement.h" #include "nsIDOMHTMLFrameElement.h"
#include "nsIDOMMozBrowserFrame.h" #include "nsIDOMMozBrowserFrame.h"
-1
View File
@@ -18,7 +18,6 @@
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsFrameLoader.h" #include "nsFrameLoader.h"
#include "nsIAppsService.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMDOMRequest.h" #include "nsIDOMDOMRequest.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
-1
View File
@@ -74,7 +74,6 @@
#include "nsHashKeys.h" #include "nsHashKeys.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsISimpleEnumerator.h" #include "nsISimpleEnumerator.h"
#include "nsIAppsService.h"
#include "nsIEventTarget.h" #include "nsIEventTarget.h"
#include "nsIFile.h" #include "nsIFile.h"
#include "nsIFileURL.h" #include "nsIFileURL.h"
-38
View File
@@ -19,10 +19,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy", XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy",
"resource://gre/modules/SystemAppProxy.jsm"); "resource://gre/modules/SystemAppProxy.jsm");
XPCOMUtils.defineLazyGetter(this, "appsService", function() {
return Cc["@mozilla.org/AppsService;1"].getService(Ci.nsIAppsService);
});
XPCOMUtils.defineLazyGetter(this, "hardwareKeyHandler", function() { XPCOMUtils.defineLazyGetter(this, "hardwareKeyHandler", function() {
return null; return null;
}); });
@@ -554,24 +550,6 @@ InputRegistryGlue.prototype.addInput = function(msg, mm) {
mm: mm, mm: mm,
requestId: msg.data.requestId 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) { InputRegistryGlue.prototype.removeInput = function(msg, mm) {
@@ -580,22 +558,6 @@ InputRegistryGlue.prototype.removeInput = function(msg, mm) {
mm: mm, mm: mm,
requestId: msg.data.requestId 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) { InputRegistryGlue.prototype.returnMessage = function(detail) {
-13
View File
@@ -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'
-58
View File
@@ -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"
%}
-75
View File
@@ -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);
};
-1
View File
@@ -96,7 +96,6 @@
#include "nsFrameMessageManager.h" #include "nsFrameMessageManager.h"
#include "nsHashPropertyBag.h" #include "nsHashPropertyBag.h"
#include "nsIAlertsService.h" #include "nsIAlertsService.h"
#include "nsIAppsService.h"
#include "nsIClipboard.h" #include "nsIClipboard.h"
#include "nsContentPermissionHelper.h" #include "nsContentPermissionHelper.h"
#include "nsICycleCollectorListener.h" #include "nsICycleCollectorListener.h"
-2
View File
@@ -44,7 +44,6 @@
#include "mozilla/TextEvents.h" #include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h" #include "mozilla/TouchEvents.h"
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
#include "mozIApplication.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsCSSFrameConstructor.h" #include "nsCSSFrameConstructor.h"
#include "nsDocShell.h" #include "nsDocShell.h"
@@ -98,7 +97,6 @@
#include "nsColorPickerProxy.h" #include "nsColorPickerProxy.h"
#include "nsContentPermissionHelper.h" #include "nsContentPermissionHelper.h"
#include "nsPresShell.h" #include "nsPresShell.h"
#include "nsIAppsService.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsIPermissionManager.h" #include "nsIPermissionManager.h"
#include "nsIURILoader.h" #include "nsIURILoader.h"
-1
View File
@@ -29,7 +29,6 @@ interfaces = [
'permission', 'permission',
'svg', 'svg',
'smil', 'smil',
'apps',
'push', 'push',
] ]
-1
View File
@@ -32,7 +32,6 @@
#include "nsTArrayForwardDeclare.h" #include "nsTArrayForwardDeclare.h"
#include "nsTObserverArray.h" #include "nsTObserverArray.h"
class mozIApplicationClearPrivateDataParams;
class nsIConsoleReportCollector; class nsIConsoleReportCollector;
namespace mozilla { namespace mozilla {
@@ -29,7 +29,6 @@
#include "nsIPrincipal.h" #include "nsIPrincipal.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
#include "nsIAppsService.h"
#include "nsIEffectiveTLDService.h" #include "nsIEffectiveTLDService.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsIDocument.h" #include "nsIDocument.h"
-1
View File
@@ -40,7 +40,6 @@
#include "mozilla/layout/VsyncParent.h" #include "mozilla/layout/VsyncParent.h"
#include "mozilla/dom/network/UDPSocketParent.h" #include "mozilla/dom/network/UDPSocketParent.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsIAppsService.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
#include "nsProxyRelease.h" #include "nsProxyRelease.h"
-1
View File
@@ -79,7 +79,6 @@
#include "DOMStorageManager.h" #include "DOMStorageManager.h"
#include "nsJSON.h" #include "nsJSON.h"
#include "nsZipArchive.h" #include "nsZipArchive.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/dom/DOMException.h" #include "mozilla/dom/DOMException.h"
#include "mozilla/dom/DOMRequest.h" #include "mozilla/dom/DOMRequest.h"
-2
View File
@@ -282,8 +282,6 @@ nsLayoutStatics::Initialize()
#ifdef MOZ_PERMISSIONS #ifdef MOZ_PERMISSIONS
nsPermissionManager::ClearOriginDataObserverInit(); nsPermissionManager::ClearOriginDataObserverInit();
#endif #endif
nsCookieService::AppClearDataObserverInit();
nsApplicationCacheService::AppClearDataObserverInit();
HTMLVideoElement::Init(); HTMLVideoElement::Init();
-34
View File
@@ -12,7 +12,6 @@
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsNetUtilInlines.h" #include "nsNetUtilInlines.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include "nsCategoryCache.h" #include "nsCategoryCache.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsHashKeys.h" #include "nsHashKeys.h"
@@ -1324,39 +1323,6 @@ NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport)
return NS_FAILED(loadingPrincipal->CheckMayLoad(uri, aReport, dataInherits)); return NS_FAILED(loadingPrincipal->CheckMayLoad(uri, aReport, dataInherits));
} }
nsresult
NS_GetAppInfoFromClearDataNotification(nsISupports *aSubject,
uint32_t *aAppID,
bool *aBrowserOnly)
{
nsresult rv;
nsCOMPtr<mozIApplicationClearPrivateDataParams>
clearParams(do_QueryInterface(aSubject));
MOZ_ASSERT(clearParams);
if (!clearParams) {
return NS_ERROR_UNEXPECTED;
}
uint32_t appId;
rv = clearParams->GetAppId(&appId);
MOZ_ASSERT(NS_SUCCEEDED(rv));
MOZ_ASSERT(appId != NECKO_UNKNOWN_APP_ID);
NS_ENSURE_SUCCESS(rv, rv);
if (appId == NECKO_UNKNOWN_APP_ID) {
return NS_ERROR_UNEXPECTED;
}
bool browserOnly = false;
rv = clearParams->GetBrowserOnly(&browserOnly);
MOZ_ASSERT(NS_SUCCEEDED(rv));
NS_ENSURE_SUCCESS(rv, rv);
*aAppID = appId;
*aBrowserOnly = browserOnly;
return NS_OK;
}
bool bool
NS_ShouldCheckAppCache(nsIURI *aURI, bool usePrivateBrowsing) NS_ShouldCheckAppCache(nsIURI *aURI, bool usePrivateBrowsing)
{ {
-9
View File
@@ -682,15 +682,6 @@ bool NS_GetAppInfo(nsIChannel *aChannel,
uint32_t *aAppID, uint32_t *aAppID,
bool *aIsInIsolatedMozBrowserElement); bool *aIsInIsolatedMozBrowserElement);
/**
* Gets appId and browserOnly parameters from the TOPIC_WEB_APP_CLEAR_DATA
* nsIObserverService notification. Used when clearing user data or
* uninstalling web apps.
*/
nsresult NS_GetAppInfoFromClearDataNotification(nsISupports *aSubject,
uint32_t *aAppID,
bool *aBrowserOnly);
/** /**
* Determines whether appcache should be checked for a given URI. * Determines whether appcache should be checked for a given URI.
*/ */
-12
View File
@@ -7,7 +7,6 @@
#include "nsCacheService.h" #include "nsCacheService.h"
#include "nsApplicationCacheService.h" #include "nsApplicationCacheService.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include "nsNetCID.h" #include "nsNetCID.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
@@ -253,14 +252,3 @@ private:
NS_IMPL_ISUPPORTS(AppCacheClearDataObserver, nsIObserver) NS_IMPL_ISUPPORTS(AppCacheClearDataObserver, nsIObserver)
} // namespace } // namespace
// Instantiates and registers AppCacheClearDataObserver for notifications
void
nsApplicationCacheService::AppClearDataObserverInit()
{
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
if (observerService) {
RefPtr<AppCacheClearDataObserver> obs = new AppCacheClearDataObserver();
observerService->AddObserver(obs, "clear-origin-attributes-data", /*ownsWeak=*/ false);
}
}
-2
View File
@@ -18,8 +18,6 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIAPPLICATIONCACHESERVICE NS_DECL_NSIAPPLICATIONCACHESERVICE
static void AppClearDataObserverInit();
private: private:
~nsApplicationCacheService(); ~nsApplicationCacheService();
RefPtr<nsCacheService> mCacheService; RefPtr<nsCacheService> mCacheService;
-11
View File
@@ -48,8 +48,6 @@
#include "mozilla/storage.h" #include "mozilla/storage.h"
#include "mozilla/AutoRestore.h" #include "mozilla/AutoRestore.h"
#include "mozilla/FileUtils.h" #include "mozilla/FileUtils.h"
#include "nsIAppsService.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include "nsIConsoleService.h" #include "nsIConsoleService.h"
#include "nsVariant.h" #include "nsVariant.h"
@@ -674,15 +672,6 @@ nsCookieService::GetSingleton()
return gCookieService; return gCookieService;
} }
/* static */ void
nsCookieService::AppClearDataObserverInit()
{
nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
nsCOMPtr<nsIObserver> obs = new AppClearDataObserver();
observerService->AddObserver(obs, TOPIC_CLEAR_ORIGIN_DATA,
/* ownsWeak= */ false);
}
/****************************************************************************** /******************************************************************************
* nsCookieService impl: * nsCookieService impl:
* public methods * public methods
-8
View File
@@ -260,14 +260,6 @@ class nsCookieService final : public nsICookieService
static nsICookieService* GetXPCOMSingleton(); static nsICookieService* GetXPCOMSingleton();
nsresult Init(); nsresult Init();
/**
* Start watching the observer service for messages indicating that an app has
* been uninstalled. When an app is uninstalled, we get the cookie service
* (thus instantiating it, if necessary) and clear all the cookies for that
* app.
*/
static void AppClearDataObserverInit();
protected: protected:
virtual ~nsCookieService(); virtual ~nsCookieService();
-1
View File
@@ -34,7 +34,6 @@
#include "mozilla/AppProcessChecker.h" #include "mozilla/AppProcessChecker.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "nsHTMLDNSPrefetch.h" #include "nsHTMLDNSPrefetch.h"
#include "nsIAppsService.h"
#include "nsEscape.h" #include "nsEscape.h"
#include "SerializedLoadContext.h" #include "SerializedLoadContext.h"
#include "nsAuthInformationHolder.h" #include "nsAuthInformationHolder.h"
@@ -13,7 +13,6 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "nsString.h" #include "nsString.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
-6
View File
@@ -33,7 +33,6 @@
#include "nsSocketTransportService2.h" #include "nsSocketTransportService2.h"
#include "nsAlgorithm.h" #include "nsAlgorithm.h"
#include "ASpdySession.h" #include "ASpdySession.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include "EventTokenBucket.h" #include "EventTokenBucket.h"
#include "Tickler.h" #include "Tickler.h"
#include "nsIXULAppInfo.h" #include "nsIXULAppInfo.h"
@@ -388,7 +387,6 @@ nsHttpHandler::Init()
obsService->AddObserver(this, "net:prune-all-connections", true); obsService->AddObserver(this, "net:prune-all-connections", true);
obsService->AddObserver(this, "net:failed-to-process-uri-content", true); obsService->AddObserver(this, "net:failed-to-process-uri-content", true);
obsService->AddObserver(this, "last-pb-context-exited", true); obsService->AddObserver(this, "last-pb-context-exited", true);
obsService->AddObserver(this, "webapps-clear-data", true);
obsService->AddObserver(this, "browser:purge-session-history", true); obsService->AddObserver(this, "browser:purge-session-history", true);
obsService->AddObserver(this, NS_NETWORK_LINK_TOPIC, true); obsService->AddObserver(this, NS_NETWORK_LINK_TOPIC, true);
obsService->AddObserver(this, "application-background", true); obsService->AddObserver(this, "application-background", true);
@@ -2173,10 +2171,6 @@ nsHttpHandler::Observe(nsISupports *subject,
if (mConnMgr) { if (mConnMgr) {
mConnMgr->ClearAltServiceMappings(); mConnMgr->ClearAltServiceMappings();
} }
} else if (!strcmp(topic, "webapps-clear-data")) {
if (mConnMgr) {
mConnMgr->ClearAltServiceMappings();
}
} else if (!strcmp(topic, "browser:purge-session-history")) { } else if (!strcmp(topic, "browser:purge-session-history")) {
if (mConnMgr) { if (mConnMgr) {
if (gSocketTransportService) { if (gSocketTransportService) {
@@ -11,7 +11,6 @@
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "plstr.h" #include "plstr.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include "nsIURI.h" #include "nsIURI.h"
#include "mozilla/net/NeckoChild.h" #include "mozilla/net/NeckoChild.h"
@@ -87,7 +87,6 @@ SpecialPowersObserver.prototype._loadFrameScript = function()
this._messageManager.addMessageListener("SPUnloadExtension", this); this._messageManager.addMessageListener("SPUnloadExtension", this);
this._messageManager.addMessageListener("SPExtensionMessage", this); this._messageManager.addMessageListener("SPExtensionMessage", this);
this._messageManager.addMessageListener("SPCleanUpSTSData", this); this._messageManager.addMessageListener("SPCleanUpSTSData", this);
this._messageManager.addMessageListener("SPClearAppPrivateData", this);
this._messageManager.loadFrameScript(CHILD_LOGGER_SCRIPT, true); this._messageManager.loadFrameScript(CHILD_LOGGER_SCRIPT, true);
this._messageManager.loadFrameScript(CHILD_SCRIPT_API, true); this._messageManager.loadFrameScript(CHILD_SCRIPT_API, true);
@@ -159,7 +158,6 @@ SpecialPowersObserver.prototype.uninit = function()
this._messageManager.removeMessageListener("SPUnloadExtension", this); this._messageManager.removeMessageListener("SPUnloadExtension", this);
this._messageManager.removeMessageListener("SPExtensionMessage", this); this._messageManager.removeMessageListener("SPExtensionMessage", this);
this._messageManager.removeMessageListener("SPCleanUpSTSData", this); this._messageManager.removeMessageListener("SPCleanUpSTSData", this);
this._messageManager.removeMessageListener("SPClearAppPrivateData", this);
this._messageManager.removeDelayedFrameScript(CHILD_LOGGER_SCRIPT); this._messageManager.removeDelayedFrameScript(CHILD_LOGGER_SCRIPT);
this._messageManager.removeDelayedFrameScript(CHILD_SCRIPT_API); this._messageManager.removeDelayedFrameScript(CHILD_SCRIPT_API);
@@ -601,28 +601,6 @@ SpecialPowersObserverAPI.prototype = {
return undefined; return undefined;
} }
case "SPClearAppPrivateData": {
let appId = aMessage.data.appId;
let browserOnly = aMessage.data.browserOnly;
let attributes = { appId: appId };
if (browserOnly) {
attributes.inIsolatedMozBrowser = true;
}
this._notifyCategoryAndObservers(null,
"clear-origin-attributes-data",
JSON.stringify(attributes));
let subject = {
appId: appId,
browserOnly: browserOnly,
QueryInterface: XPCOMUtils.generateQI([Ci.mozIApplicationClearPrivateDataParams])
};
this._notifyCategoryAndObservers(subject, "webapps-clear-data", null);
return undefined;
}
default: default:
throw new SpecialPowersError("Unrecognized Special Powers API"); throw new SpecialPowersError("Unrecognized Special Powers API");
} }
@@ -44,8 +44,7 @@ function SpecialPowers(window) {
"SPLoadExtension", "SPLoadExtension",
"SPStartupExtension", "SPStartupExtension",
"SPUnloadExtension", "SPUnloadExtension",
"SPExtensionMessage", "SPExtensionMessage"];
"SPClearAppPrivateData"];
addMessageListener("SPPingService", this._messageListener); addMessageListener("SPPingService", this._messageListener);
addMessageListener("SpecialPowers.FilesCreated", this._messageListener); addMessageListener("SpecialPowers.FilesCreated", this._messageListener);
addMessageListener("SpecialPowers.FilesError", this._messageListener); addMessageListener("SpecialPowers.FilesError", this._messageListener);
@@ -1766,16 +1766,6 @@ SpecialPowersAPI.prototype = {
// It's an URL. // It's an URL.
let uri = Services.io.newURI(arg, null, null); let uri = Services.io.newURI(arg, null, null);
principal = secMan.createCodebasePrincipal(uri, {}); principal = secMan.createCodebasePrincipal(uri, {});
} else if (arg.manifestURL) {
// It's a thing representing an app.
let appsSvc = Cc["@mozilla.org/AppsService;1"]
.getService(Ci.nsIAppsService)
let app = appsSvc.getAppByManifestURL(arg.manifestURL);
if (!app) {
throw "No app for this manifest!";
}
principal = app.principal;
} else if (arg.nodePrincipal) { } else if (arg.nodePrincipal) {
// It's a document. // It's a document.
// In some tests the arg is a wrapped DOM element, so we unwrap it first. // In some tests the arg is a wrapped DOM element, so we unwrap it first.
-1
View File
@@ -11,7 +11,6 @@
"AlertsHelper.jsm": [], "AlertsHelper.jsm": [],
"AppData.jsm": ["makeFakeAppDir"], "AppData.jsm": ["makeFakeAppDir"],
"AppInfo.jsm": ["newAppInfo", "getAppInfo", "updateAppInfo"], "AppInfo.jsm": ["newAppInfo", "getAppInfo", "updateAppInfo"],
"AppsServiceChild.jsm": ["DOMApplicationRegistry", "WrappedManifestCache"],
"arrays.js": ["inArray", "getSet", "indexOf", "remove", "rindexOf", "compare"], "arrays.js": ["inArray", "getSet", "indexOf", "remove", "rindexOf", "compare"],
"assertions.js": ["Assert", "Expect"], "assertions.js": ["Assert", "Expect"],
"async.js": ["Async"], "async.js": ["Async"],