зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1307456 - Remove dom/newapps r=baku
MozReview-Commit-ID: BjT3IB9AK0E --HG-- extra : rebase_source : 7d7c8e4ec4a68f52b5c9325d964c25d2d2c7f265
This commit is contained in:
Родитель
104c2f19a6
Коммит
b70924b271
|
@ -149,7 +149,6 @@
|
|||
@RESPATH@/components/dom.xpt
|
||||
@RESPATH@/components/dom_activities.xpt
|
||||
@RESPATH@/components/dom_apps.xpt
|
||||
@RESPATH@/components/dom_newapps.xpt
|
||||
@RESPATH@/components/dom_audiochannel.xpt
|
||||
@RESPATH@/components/dom_base.xpt
|
||||
@RESPATH@/components/dom_system.xpt
|
||||
|
@ -614,10 +613,6 @@
|
|||
@RESPATH@/components/SecurityReporter.manifest
|
||||
@RESPATH@/components/SecurityReporter.js
|
||||
|
||||
; Signed Packaged Content
|
||||
@RESPATH@/components/InstallPackagedWebapp.manifest
|
||||
@RESPATH@/components/InstallPackagedWebapp.js
|
||||
|
||||
; ANGLE on Win32
|
||||
#ifdef XP_WIN32
|
||||
#ifndef HAVE_64BIT_BUILD
|
||||
|
|
|
@ -182,7 +182,6 @@
|
|||
@RESPATH@/components/docshell.xpt
|
||||
@RESPATH@/components/dom.xpt
|
||||
@RESPATH@/components/dom_apps.xpt
|
||||
@RESPATH@/components/dom_newapps.xpt
|
||||
@RESPATH@/components/dom_base.xpt
|
||||
@RESPATH@/components/dom_system.xpt
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
@ -589,10 +588,6 @@
|
|||
@RESPATH@/components/SecurityReporter.manifest
|
||||
@RESPATH@/components/SecurityReporter.js
|
||||
|
||||
; Signed Packaged Content
|
||||
@RESPATH@/components/InstallPackagedWebapp.manifest
|
||||
@RESPATH@/components/InstallPackagedWebapp.js
|
||||
|
||||
; ANGLE GLES-on-D3D rendering library
|
||||
#ifdef MOZ_ANGLE_RENDERER
|
||||
@BINPATH@/libEGL.dll
|
||||
|
|
|
@ -102,7 +102,6 @@ DIRS += [
|
|||
'xul',
|
||||
'manifest',
|
||||
'vr',
|
||||
'newapps',
|
||||
'u2f',
|
||||
'console',
|
||||
'performance',
|
||||
|
|
|
@ -1,63 +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/. */
|
||||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr, Constructor: CC } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PermissionsInstaller",
|
||||
"resource://gre/modules/PermissionsInstaller.jsm");
|
||||
|
||||
function debug(aMsg) {
|
||||
dump("-*-*- InstallPackagedWebapps.js : " + aMsg + "\n");
|
||||
}
|
||||
|
||||
function InstallPackagedWebapp() {
|
||||
}
|
||||
|
||||
InstallPackagedWebapp.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIInstallPackagedWebapp]),
|
||||
classID: Components.ID("{5cc6554a-5421-4a5e-b8c2-c62e8b7f4f3f}"),
|
||||
|
||||
/**
|
||||
* Install permissions for signed packaged web content
|
||||
* @param string manifestContent
|
||||
* The manifest content of the cached package.
|
||||
* @param string aOrigin
|
||||
* The package origin.
|
||||
* @param string aManifestURL
|
||||
* The manifest URL of the package.
|
||||
* @returns boolean
|
||||
**/
|
||||
|
||||
installPackagedWebapp: function(aManifestContent, aOrigin, aManifestURL) {
|
||||
|
||||
try {
|
||||
let isSuccess = true;
|
||||
let manifest = JSON.parse(aManifestContent);
|
||||
|
||||
PermissionsInstaller.installPermissions({
|
||||
manifest: manifest,
|
||||
manifestURL: aManifestURL,
|
||||
origin: aOrigin,
|
||||
isPreinstalled: false,
|
||||
isCachedPackage: true
|
||||
}, false, function() {
|
||||
Cu.reportError(ex);
|
||||
});
|
||||
|
||||
// TODO Bug 1206058 - Register app handlers (system msg) on navigation
|
||||
// to signed packages.
|
||||
|
||||
return isSuccess;
|
||||
}
|
||||
catch(ex) {
|
||||
Cu.reportError(ex);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([InstallPackagedWebapp]);
|
|
@ -1,2 +0,0 @@
|
|||
component {5cc6554a-5421-4a5e-b8c2-c62e8b7f4f3f} InstallPackagedWebapp.js
|
||||
contract @mozilla.org/newapps/installpackagedwebapp;1 {5cc6554a-5421-4a5e-b8c2-c62e8b7f4f3f}
|
|
@ -1,11 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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 += [
|
||||
'nsIInstallPackagedWebapp.idl'
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_newapps'
|
|
@ -1,13 +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 "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(3b4b69a0-56dc-11e5-a837-0800200c9a66)]
|
||||
interface nsIInstallPackagedWebapp : nsISupports
|
||||
{
|
||||
boolean installPackagedWebapp(in string aManifestContent,
|
||||
in string aOrigin,
|
||||
in string aManifestURL);
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
DIRS += ['interfaces']
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'InstallPackagedWebapp.js',
|
||||
'InstallPackagedWebapp.manifest',
|
||||
]
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
|
|
@ -1,123 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
'use strict';
|
||||
|
||||
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import("resource://gre/modules/PermissionSettings.jsm");
|
||||
Cu.import("resource://gre/modules/PermissionsTable.jsm");
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
|
||||
const mod = Cc['@mozilla.org/newapps/installpackagedwebapp;1']
|
||||
.getService(Ci.nsIInstallPackagedWebapp);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this,
|
||||
"appsService",
|
||||
"@mozilla.org/AppsService;1",
|
||||
"nsIAppsService");
|
||||
|
||||
function run_test() {
|
||||
|
||||
do_get_profile();
|
||||
|
||||
let manifestWithPerms = {
|
||||
name: "Test App",
|
||||
launch_path: "/index.html",
|
||||
type: "privileged",
|
||||
permissions: {
|
||||
"alarms": { },
|
||||
"wifi-manage": { },
|
||||
"tcp-socket": { },
|
||||
"desktop-notification": { },
|
||||
"geolocation": { },
|
||||
},
|
||||
};
|
||||
|
||||
let manifestNoPerms = {
|
||||
name: "Test App",
|
||||
launch_path: "/index.html",
|
||||
type: "privileged",
|
||||
};
|
||||
|
||||
let appStatus = "privileged";
|
||||
|
||||
// Triggering error due to bad manifest
|
||||
let origin = "";
|
||||
let manifestURL = "";
|
||||
let manifestString = "boum";
|
||||
|
||||
let res = mod.installPackagedWebapp(manifestString, origin, manifestURL);
|
||||
equal(res, false);
|
||||
|
||||
// Install a package with permissions
|
||||
origin = "http://test.com^appId=1019&inBrowser=1";
|
||||
manifestURL = "http://test.com/manifest.json";
|
||||
manifestString = JSON.stringify(manifestWithPerms);
|
||||
let manifestHelper = new ManifestHelper(manifestWithPerms, origin, manifestURL);
|
||||
|
||||
cleanDB(manifestHelper, origin, manifestURL);
|
||||
|
||||
res = mod.installPackagedWebapp(manifestString, origin, manifestURL);
|
||||
equal(res, true);
|
||||
checkPermissions(manifestHelper, origin, manifestURL, appStatus);
|
||||
|
||||
// Install a package with permissions
|
||||
origin = "http://test.com";
|
||||
manifestHelper = new ManifestHelper(manifestWithPerms, origin, manifestURL);
|
||||
|
||||
cleanDB(manifestHelper, origin, manifestURL);
|
||||
|
||||
res = mod.installPackagedWebapp(manifestString, origin, manifestURL);
|
||||
equal(res, true);
|
||||
checkPermissions(manifestHelper, origin, manifestURL, appStatus);
|
||||
|
||||
|
||||
// Install a package with no permission
|
||||
origin = "http://bar.com^appId=1337&inBrowser=1";
|
||||
manifestURL = "http://bar.com/manifest.json";
|
||||
manifestString = JSON.stringify(manifestNoPerms);
|
||||
manifestHelper = new ManifestHelper(manifestNoPerms, origin, manifestURL);
|
||||
|
||||
cleanDB(manifestHelper, origin, manifestURL);
|
||||
|
||||
res = mod.installPackagedWebapp(manifestString, origin, manifestURL);
|
||||
equal(res, true);
|
||||
checkPermissions(manifestHelper, origin, manifestURL, appStatus);
|
||||
}
|
||||
|
||||
// Cleaning permissions database before running a test
|
||||
function cleanDB(manifestHelper, origin, manifestURL) {
|
||||
for (let permName in manifestHelper.permissions) {
|
||||
PermissionSettingsModule.removePermission(permName, manifestURL, origin, "", true);
|
||||
}
|
||||
}
|
||||
|
||||
// Check permissions are correctly set in the database
|
||||
function checkPermissions(manifestHelper, origin, manifestURL, appStatus) {
|
||||
let perm;
|
||||
for (let permName in manifestHelper.permissions) {
|
||||
let permValue = PermissionSettingsModule.getPermission(
|
||||
permName, manifestURL, origin, "", true);
|
||||
switch (PermissionsTable[permName][appStatus]) {
|
||||
case Ci.nsIPermissionManager.UNKNOWN_ACTION:
|
||||
perm = "unknown";
|
||||
break;
|
||||
case Ci.nsIPermissionManager.ALLOW_ACTION:
|
||||
perm = "allow";
|
||||
break;
|
||||
case Ci.nsIPermissionManager.DENY_ACTION:
|
||||
perm = "deny";
|
||||
break;
|
||||
case Ci.nsIPermissionManager.PROMPT_ACTION:
|
||||
perm = "prompt";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
equal(permValue, perm);
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
[DEFAULT]
|
||||
head =
|
||||
tail =
|
||||
|
||||
[test_install.js]
|
|
@ -115,7 +115,6 @@
|
|||
@BINPATH@/components/docshell.xpt
|
||||
@BINPATH@/components/dom.xpt
|
||||
@BINPATH@/components/dom_apps.xpt
|
||||
@BINPATH@/components/dom_newapps.xpt
|
||||
@BINPATH@/components/dom_base.xpt
|
||||
@BINPATH@/components/dom_canvas.xpt
|
||||
@BINPATH@/components/dom_core.xpt
|
||||
|
@ -374,9 +373,6 @@
|
|||
@BINPATH@/components/SystemMessageCache.js
|
||||
@BINPATH@/components/SystemMessageManager.manifest
|
||||
|
||||
@BINPATH@/components/InstallPackagedWebapp.manifest
|
||||
@BINPATH@/components/InstallPackagedWebapp.js
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
@BINPATH@/components/PeerConnection.js
|
||||
@BINPATH@/components/PeerConnection.manifest
|
||||
|
|
Загрузка…
Ссылка в новой задаче