Merge latest green inbound changeset and mozilla-central; a=merge

This commit is contained in:
Ed Morley 2014-08-01 16:11:12 +01:00
Родитель fe8ca9f5e0 b73b34bdda
Коммит f50c0faa02
44 изменённых файлов: 437 добавлений и 384 удалений

Просмотреть файл

@ -802,7 +802,8 @@ var WebappsHelper = {
if (!aManifest)
return;
let manifest = new ManifestHelper(aManifest, json.origin);
let manifest = new ManifestHelper(aManifest, json.origin,
json.manifestURL);
let payload = {
timestamp: json.timestamp,
url: manifest.fullLaunchPath(json.startPoint),

Просмотреть файл

@ -167,7 +167,8 @@ let AlertsHelper = {
this._listeners[uid] = listener;
appsService.getManifestFor(listener.manifestURL).then((manifest) => {
let helper = new ManifestHelper(manifest, listener.manifestURL);
let app = appsService.getAppByManifestURL(listener.manifestURL);
let helper = new ManifestHelper(manifest, app.origin, app.manifestURL);
let getNotificationURLFor = function(messages) {
if (!messages) {
return null;
@ -179,8 +180,7 @@ let AlertsHelper = {
return helper.fullLaunchPath();
} else if (typeof message === "object" &&
kNotificationSystemMessageName in message) {
return helper.resolveFromOrigin(
message[kNotificationSystemMessageName]);
return helper.resolveURL(message[kNotificationSystemMessageName]);
}
}
@ -220,7 +220,8 @@ let AlertsHelper = {
// If we have a manifest URL, get the icon and title from the manifest
// to prevent spoofing.
appsService.getManifestFor(manifestURL).then((manifest) => {
let helper = new ManifestHelper(manifest, manifestURL);
let app = appsService.getAppByManifestURL(manifestURL);
let helper = new ManifestHelper(manifest, app.origin, manifestURL);
send(helper.name, helper.iconURLForSize(kNotificationIconSize));
});
},

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04ea7e1a4034a50d4a7a4f5b95a04a2ed8313908"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9689218473b6fc4dd927ad6aa7b06c05f0843824"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="04ea7e1a4034a50d4a7a4f5b95a04a2ed8313908"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9689218473b6fc4dd927ad6aa7b06c05f0843824"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="999e945b85c578c503ad445c2285940f16aacdae">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="04ea7e1a4034a50d4a7a4f5b95a04a2ed8313908"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9689218473b6fc4dd927ad6aa7b06c05f0843824"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04ea7e1a4034a50d4a7a4f5b95a04a2ed8313908"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9689218473b6fc4dd927ad6aa7b06c05f0843824"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="04ea7e1a4034a50d4a7a4f5b95a04a2ed8313908"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9689218473b6fc4dd927ad6aa7b06c05f0843824"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>

Просмотреть файл

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "9f3b6b772b7b8b45634f9911c873f59a8036e9a9",
"revision": "3842156466e71f41748f86777a1b8fbd379441c0",
"repo_path": "/integration/gaia-central"
}

Просмотреть файл

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04ea7e1a4034a50d4a7a4f5b95a04a2ed8313908"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9689218473b6fc4dd927ad6aa7b06c05f0843824"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

Просмотреть файл

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04ea7e1a4034a50d4a7a4f5b95a04a2ed8313908"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9689218473b6fc4dd927ad6aa7b06c05f0843824"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="04ea7e1a4034a50d4a7a4f5b95a04a2ed8313908"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9689218473b6fc4dd927ad6aa7b06c05f0843824"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>

Просмотреть файл

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="04ea7e1a4034a50d4a7a4f5b95a04a2ed8313908"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9689218473b6fc4dd927ad6aa7b06c05f0843824"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

Просмотреть файл

@ -66,7 +66,9 @@ this.WebappManager = {
}
} else if (aMessage.name == "Webapps:Install:Return:OK" &&
!data.isPackage) {
let manifest = new ManifestHelper(data.app.manifest, data.app.origin);
let manifest = new ManifestHelper(data.app.manifest,
data.app.origin,
data.app.manifestURL);
if (!manifest.appcache_path) {
this.installations[manifestURL].resolve();
}
@ -172,7 +174,8 @@ this.WebappManager = {
};
let requestingURI = chromeWin.makeURI(aData.from);
let manifest = new ManifestHelper(jsonManifest, aData.app.origin);
let app = aData.app;
let manifest = new ManifestHelper(jsonManifest, app.origin, app.manifestURL);
let host;
try {

Просмотреть файл

@ -294,7 +294,10 @@ let Activities = {
let results = [];
aManifests.forEach((aManifest, i) => {
let manifestURL = aResults.options[i].manifest;
let helper = new ManifestHelper(aManifest.manifest, manifestURL);
// Not passing the origin is fine here since we only need
// helper.name which doesn't rely on url resolution.
let helper =
new ManifestHelper(aManifest.manifest, manifestURL, manifestURL);
results.push({
manifestURL: manifestURL,
iconURL: aResults.options[i].icon,

Просмотреть файл

@ -24,7 +24,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
// Shared code for AppsServiceChild.jsm, Webapps.jsm and Webapps.js
this.EXPORTED_SYMBOLS = ["AppsUtils", "ManifestHelper", "isAbsoluteURI", "mozIApplication"];
this.EXPORTED_SYMBOLS =
["AppsUtils", "ManifestHelper", "isAbsoluteURI", "mozIApplication"];
function debug(s) {
//dump("-*- AppsUtils.jsm: " + s + "\n");
@ -373,7 +374,8 @@ this.AppsUtils = {
// Nor through localized names
if ('locales' in aNewManifest) {
let defaultName = new ManifestHelper(aOldManifest, aApp.origin).name;
let defaultName =
new ManifestHelper(aOldManifest, aApp.origin, aApp.manifestURL).name;
for (let locale in aNewManifest.locales) {
let entry = aNewManifest.locales[locale];
if (!entry.name) {
@ -593,11 +595,25 @@ this.AppsUtils = {
/**
* Helper object to access manifest information with locale support
*/
this.ManifestHelper = function(aManifest, aOrigin) {
this._origin = Services.io.newURI(aOrigin, null, null);
this.ManifestHelper = function(aManifest, aOrigin, aManifestURL) {
// If the app is packaged, we resolve uris against the origin.
// If it's not, against the manifest url.
if (!aOrigin || !aManifestURL) {
throw Error("ManifestHelper needs both origin and manifestURL");
}
this._baseURI = Services.io.newURI(
aOrigin.startsWith("app://") ? aOrigin : aManifestURL, null, null);
// We keep the manifest url in all cases since we need it to
// resolve the package path for packaged apps.
this._manifestURL = Services.io.newURI(aManifestURL, null, null);
this._manifest = aManifest;
let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry)
.QueryInterface(Ci.nsIToolkitChromeRegistry);
let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry)
.QueryInterface(Ci.nsIToolkitChromeRegistry);
let locale = chrome.getSelectedLocale("global").toLowerCase();
this._localeRoot = this._manifest;
@ -686,7 +702,7 @@ ManifestHelper.prototype = {
iconSizes.sort((a, b) => a - b);
let biggestIconSize = iconSizes.pop();
let biggestIcon = icons[biggestIconSize];
let biggestIconURL = this._origin.resolve(biggestIcon);
let biggestIconURL = this._baseURI.resolve(biggestIcon);
return biggestIconURL;
},
@ -700,7 +716,7 @@ ManifestHelper.prototype = {
for (let size in icons) {
let iSize = parseInt(size);
if (Math.abs(iSize - aSize) < dist) {
icon = this._origin.resolve(icons[size]);
icon = this._baseURI.resolve(icons[size]);
dist = Math.abs(iSize - aSize);
}
}
@ -711,7 +727,7 @@ ManifestHelper.prototype = {
// If no start point is specified, we use the root launch path.
// In all error cases, we just return null.
if ((aStartPoint || "") === "") {
return this._origin.resolve(this._localeProp("launch_path") || "");
return this._baseURI.resolve(this._localeProp("launch_path") || "/");
}
// Search for the l10n entry_points property.
@ -721,28 +737,28 @@ ManifestHelper.prototype = {
}
if (entryPoints[aStartPoint]) {
return this._origin.resolve(entryPoints[aStartPoint].launch_path || "");
return this._baseURI.resolve(entryPoints[aStartPoint].launch_path || "/");
}
return null;
},
resolveFromOrigin: function(aURI) {
resolveURL: function(aURI) {
// This should be enforced higher up, but check it here just in case.
if (isAbsoluteURI(aURI)) {
throw new Error("Webapps.jsm: non-relative URI passed to resolveFromOrigin");
throw new Error("Webapps.jsm: non-relative URI passed to resolve");
}
return this._origin.resolve(aURI);
return this._baseURI.resolve(aURI);
},
fullAppcachePath: function() {
let appcachePath = this._localeProp("appcache_path");
return this._origin.resolve(appcachePath ? appcachePath : "");
return this._baseURI.resolve(appcachePath ? appcachePath : "/");
},
fullPackagePath: function() {
let packagePath = this._localeProp("package_path");
return this._origin.resolve(packagePath ? packagePath : "");
return this._manifestURL.resolve(packagePath ? packagePath : "/");
},
get role() {

Просмотреть файл

@ -59,7 +59,8 @@ this.PermissionsInstaller = {
installPermissions: function installPermissions(aApp, aIsReinstall, aOnError,
aIsSystemUpdate) {
try {
let newManifest = new ManifestHelper(aApp.manifest, aApp.origin);
let newManifest =
new ManifestHelper(aApp.manifest, aApp.origin, aApp.manifestURL);
if (!newManifest.permissions && !aIsReinstall) {
return;
}

Просмотреть файл

@ -389,7 +389,8 @@ this.DOMApplicationRegistry = {
updateOfflineCacheForApp: function(aId) {
let app = this.webapps[aId];
this._readManifests([{ id: aId }]).then((aResult) => {
let manifest = new ManifestHelper(aResult[0].manifest, app.origin);
let manifest =
new ManifestHelper(aResult[0].manifest, app.origin, app.manifestURL);
OfflineCacheInstaller.installCache({
cachePath: app.cachePath,
appId: aId,
@ -675,7 +676,7 @@ this.DOMApplicationRegistry = {
return;
}
let manifest = new ManifestHelper(aManifest, aApp.origin);
let manifest = new ManifestHelper(aManifest, aApp.origin, aApp.manifestURL);
let launchPathURI = Services.io.newURI(manifest.fullLaunchPath(aEntryPoint), null, null);
let manifestURI = Services.io.newURI(aApp.manifestURL, null, null);
root.messages.forEach(function registerPages(aMessage) {
@ -689,7 +690,7 @@ this.DOMApplicationRegistry = {
let fullHandlerPath;
try {
if (handlerPath && handlerPath.trim()) {
fullHandlerPath = manifest.resolveFromOrigin(handlerPath);
fullHandlerPath = manifest.resolveURL(handlerPath);
} else {
throw new Error("Empty or blank handler path.");
}
@ -705,7 +706,7 @@ this.DOMApplicationRegistry = {
if (SystemMessagePermissionsChecker
.isSystemMessagePermittedToRegister(messageName,
aApp.origin,
aApp.manifestURL,
aManifest)) {
msgmgr.registerPage(messageName, handlerPageURI, manifestURI);
}
@ -733,7 +734,7 @@ this.DOMApplicationRegistry = {
return;
}
let manifest = new ManifestHelper(aManifest, aApp.origin);
let manifest = new ManifestHelper(aManifest, aApp.origin, aApp.manifestURL);
let launchPathURI = Services.io.newURI(manifest.fullLaunchPath(aEntryPoint),
null, null);
let manifestURI = Services.io.newURI(aApp.manifestURL, null, null);
@ -747,7 +748,7 @@ this.DOMApplicationRegistry = {
let handlerPath = connection.handler_path;
if (handlerPath) {
try {
fullHandlerPath = manifest.resolveFromOrigin(handlerPath);
fullHandlerPath = manifest.resolveURL(handlerPath);
} catch(e) {
debug("Connection's handler path is invalid. Skipping: keyword: " +
keyword + " handler_path: " + handlerPath);
@ -760,7 +761,7 @@ this.DOMApplicationRegistry = {
if (SystemMessagePermissionsChecker
.isSystemMessagePermittedToRegister("connection",
aApp.origin,
aApp.manifestURL,
aManifest)) {
msgmgr.registerPage("connection", handlerPageURI, manifestURI);
}
@ -812,7 +813,7 @@ this.DOMApplicationRegistry = {
return activitiesToRegister;
}
let manifest = new ManifestHelper(aManifest, aApp.origin);
let manifest = new ManifestHelper(aManifest, aApp.origin, aApp.manifestURL);
for (let activity in root.activities) {
let description = root.activities[activity];
let href = description.href;
@ -821,7 +822,7 @@ this.DOMApplicationRegistry = {
}
try {
href = manifest.resolveFromOrigin(href);
href = manifest.resolveURL(href);
} catch (e) {
debug("Activity href (" + href + ") is invalid, skipping. " +
"Error is: " + e);
@ -851,7 +852,7 @@ this.DOMApplicationRegistry = {
if (SystemMessagePermissionsChecker
.isSystemMessagePermittedToRegister("activity",
aApp.origin,
aApp.manifestURL,
aManifest)) {
msgmgr.registerPage("activity", launchPathURI, manifestURI);
}
@ -961,7 +962,8 @@ this.DOMApplicationRegistry = {
return;
}
let localeManifest = new ManifestHelper(manifest, app.origin);
let localeManifest =
new ManifestHelper(manifest, app.origin, app.manifestURL);
app.name = manifest.name;
app.csp = manifest.csp || "";
@ -1463,7 +1465,8 @@ this.DOMApplicationRegistry = {
let results = yield this._readManifests([{ id: id }]);
let jsonManifest = results[0].manifest;
let manifest = new ManifestHelper(jsonManifest, app.origin);
let manifest =
new ManifestHelper(jsonManifest, app.origin, app.manifestURL);
if (manifest.appcache_path) {
debug("appcache found");
@ -1497,7 +1500,7 @@ this.DOMApplicationRegistry = {
throw new Error("MISSING_UPDATE_MANIFEST");
}
let manifest = new ManifestHelper(json, app.manifestURL);
let manifest = new ManifestHelper(json, app.origin, app.manifestURL);
let newApp = {
manifestURL: aManifestURL,
origin: app.origin,
@ -1808,7 +1811,8 @@ this.DOMApplicationRegistry = {
}
}
};
let helper = new ManifestHelper(manifest, aData.manifestURL);
let helper =
new ManifestHelper(manifest, aData.origin, aData.manifestURL);
debug("onlyCheckAppCache - launch updateSvc.checkForUpdate for " +
helper.fullAppcachePath());
updateSvc.checkForUpdate(Services.io.newURI(helper.fullAppcachePath(), null, null),
@ -1990,7 +1994,8 @@ this.DOMApplicationRegistry = {
let manFile = OS.Path.join(dir, "staged-update.webapp");
yield this._writeFile(manFile, JSON.stringify(aNewManifest));
let manifest = new ManifestHelper(aNewManifest, aApp.manifestURL);
let manifest =
new ManifestHelper(aNewManifest, aApp.origin, aApp.manifestURL);
// A package is available: set downloadAvailable to fire the matching
// event.
aApp.downloadAvailable = true;
@ -2036,7 +2041,8 @@ this.DOMApplicationRegistry = {
let manFile = OS.Path.join(dir, "manifest.webapp");
yield this._writeFile(manFile, JSON.stringify(aNewManifest));
manifest = new ManifestHelper(aNewManifest, aApp.origin);
manifest =
new ManifestHelper(aNewManifest, aApp.origin, aApp.manifestURL);
if (supportUseCurrentProfile()) {
// Update the permissions for this app.
@ -2055,7 +2061,8 @@ this.DOMApplicationRegistry = {
aApp.role = manifest.role || "";
aApp.updateTime = Date.now();
} else {
manifest = new ManifestHelper(aOldManifest, aApp.origin);
manifest =
new ManifestHelper(aOldManifest, aApp.origin, aApp.manifestURL);
}
// Update the registry.
@ -2564,7 +2571,8 @@ this.DOMApplicationRegistry = {
yield this._writeManifestFile(id, aData.isPackage, jsonManifest);
debug("app.origin: " + app.origin);
let manifest = new ManifestHelper(jsonManifest, app.origin);
let manifest =
new ManifestHelper(jsonManifest, app.origin, app.manifestURL);
let appObject = this._cloneApp(aData, app, manifest, jsonManifest, id, localId);
@ -2618,7 +2626,7 @@ this.DOMApplicationRegistry = {
// origin for install apps is meaningless here, since it's app:// and this
// can't be used to resolve package paths.
manifest = new ManifestHelper(jsonManifest, app.manifestURL);
manifest = new ManifestHelper(jsonManifest, app.origin, app.manifestURL);
this.queuedPackageDownload[app.manifestURL] = {
manifest: manifest,

Просмотреть файл

@ -7,6 +7,7 @@ support-files =
[test_apps_service.xul]
[test_bug_945152.html]
run-if = os == 'linux'
[test_manifest_helper.xul]
[test_operator_app_install.js]
[test_operator_app_install.xul]
# bug 928262

Просмотреть файл

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1042881
-->
<window title="Mozilla Bug 1042881"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1042881"
target="_blank">Mozilla Bug 1042881</a>
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 1042881 **/
Components.utils.import("resource://gre/modules/AppsUtils.jsm");
// Test that we get the right launch path from manifests similar to
// twitter's one.
var manifest = {
"version":"1.0",
"name":"Twitter",
"installs_allowed_from":["*"],
"developer":{
"name":"Twitter",
"url":"http://twitter.com"
},
"icons":{
"30":"/images/larrybird-30.png",
"60":"/images/larrybird-60.png",
"128":"/images/larrybird-128.png"
}
}
var helper = new ManifestHelper(manifest, "https://mobile.twitter.com",
"https://mobile.twitter.com/cache/twitter.webapp");
SimpleTest.is(helper.fullLaunchPath(), "https://mobile.twitter.com/");
SimpleTest.is(helper.iconURLForSize(60),
"https://mobile.twitter.com/images/larrybird-60.png");
]]>
</script>
</window>

Просмотреть файл

@ -1383,19 +1383,18 @@ BluetoothServiceBluedroid::UpdateSdpRecords(
class CreateBondResultHandler MOZ_FINAL : public BluetoothResultHandler
{
public:
CreateBondResultHandler(size_t aRunnableIndex)
: mRunnableIndex(aRunnableIndex)
CreateBondResultHandler(BluetoothReplyRunnable* aRunnable)
: mRunnable(aRunnable)
{ }
void OnError(int aStatus) MOZ_OVERRIDE
{
BluetoothReplyRunnable* runnable = sBondingRunnableArray[mRunnableIndex];
sBondingRunnableArray[mRunnableIndex] = nullptr;
ReplyStatusError(runnable, aStatus, NS_LITERAL_STRING("CreatedPairedDevice"));
sBondingRunnableArray.RemoveElement(mRunnable);
ReplyStatusError(mRunnable, aStatus, NS_LITERAL_STRING("CreatedPairedDevice"));
}
private:
PRUint32 mRunnableIndex;
BluetoothReplyRunnable* mRunnable;
};
nsresult
@ -1410,10 +1409,10 @@ BluetoothServiceBluedroid::CreatePairedDeviceInternal(
bt_bdaddr_t remoteAddress;
StringToBdAddressType(aDeviceAddress, &remoteAddress);
PRUint32 i = sBondingRunnableArray.Length();
sBondingRunnableArray.AppendElement(aRunnable);
sBtInterface->CreateBond(&remoteAddress, new CreateBondResultHandler(i));
sBtInterface->CreateBond(&remoteAddress,
new CreateBondResultHandler(aRunnable));
return NS_OK;
}
@ -1421,19 +1420,18 @@ BluetoothServiceBluedroid::CreatePairedDeviceInternal(
class RemoveBondResultHandler MOZ_FINAL : public BluetoothResultHandler
{
public:
RemoveBondResultHandler(size_t aRunnableIndex)
: mRunnableIndex(aRunnableIndex)
RemoveBondResultHandler(BluetoothReplyRunnable* aRunnable)
: mRunnable(aRunnable)
{ }
void OnError(int aStatus) MOZ_OVERRIDE
{
BluetoothReplyRunnable* runnable = sUnbondingRunnableArray[mRunnableIndex];
sUnbondingRunnableArray[mRunnableIndex] = nullptr;
ReplyStatusError(runnable, aStatus, NS_LITERAL_STRING("RemoveDevice"));
sUnbondingRunnableArray.RemoveElement(mRunnable);
ReplyStatusError(mRunnable, aStatus, NS_LITERAL_STRING("RemoveDevice"));
}
private:
PRUint32 mRunnableIndex;
BluetoothReplyRunnable* mRunnable;
};
nsresult
@ -1450,7 +1448,8 @@ BluetoothServiceBluedroid::RemoveDeviceInternal(
PRUint32 i = sUnbondingRunnableArray.Length();
sUnbondingRunnableArray.AppendElement(aRunnable);
sBtInterface->RemoveBond(&remoteAddress, new RemoveBondResultHandler(i));
sBtInterface->RemoveBond(&remoteAddress,
new RemoveBondResultHandler(aRunnable));
return NS_OK;
}

Просмотреть файл

@ -170,18 +170,20 @@ this.SystemMessagePermissionsChecker = {
* app at start-up based on the permissions claimed in the app's manifest.
* @param string aSysMsgName
* The system messsage name.
* @param string aOrigin
* The app's origin.
* @param string aManifestURL
* The app's manifest URL.
* @param object aManifest
* The app's manifest.
* @returns bool
* Is permitted or not.
**/
isSystemMessagePermittedToRegister:
function isSystemMessagePermittedToRegister(aSysMsgName, aOrigin, aManifest) {
function isSystemMessagePermittedToRegister(aSysMsgName,
aManifestURL,
aManifest) {
debug("isSystemMessagePermittedToRegister(): " +
"aSysMsgName: " + aSysMsgName + ", " +
"aOrigin: " + aOrigin + ", " +
"aManifestURL: " + aManifestURL + ", " +
"aManifest: " + JSON.stringify(aManifest));
let permNames = this.getSystemMessagePermissions(aSysMsgName);
@ -207,20 +209,22 @@ this.SystemMessagePermissionsChecker = {
break;
}
let newManifest = new ManifestHelper(aManifest, aOrigin);
// It's ok here to not pass the origin to ManifestHelper since we only
// need the permission property and that doesn't depend on uri resolution.
let newManifest = new ManifestHelper(aManifest, aManifestURL, aManifestURL);
for (let permName in permNames) {
// The app doesn't claim valid permissions for this sytem message.
if (!newManifest.permissions || !newManifest.permissions[permName]) {
debug("'" + aSysMsgName + "' isn't permitted by '" + permName + "'. " +
"Please add the permission for app: '" + aOrigin + "'.");
"Please add the permission for app: '" + aManifestURL + "'.");
return false;
}
let permValue = PermissionsTable[permName][appStatus];
if (permValue != Ci.nsIPermissionManager.PROMPT_ACTION &&
permValue != Ci.nsIPermissionManager.ALLOW_ACTION) {
debug("'" + aSysMsgName + "' isn't permitted by '" + permName + "'. " +
"Please add the permission for app: '" + aOrigin + "'.");
"Please add the permission for app: '" + aManifestURL + "'.");
return false;
}

Просмотреть файл

@ -691,7 +691,7 @@ this.NetworkStatsService = {
*/
networkStatsAvailable: function networkStatsAvailable(aCallback, aNetId,
aResult, aRxBytes,
aTxBytes, aDate) {
aTxBytes, aTimestamp) {
if (!aResult) {
if (aCallback) {
aCallback(false, "Netd IPC error");
@ -703,7 +703,7 @@ this.NetworkStatsService = {
serviceType: "",
networkId: this._networks[aNetId].network.id,
networkType: this._networks[aNetId].network.type,
date: aDate,
date: new Date(aTimestamp),
rxBytes: aTxBytes,
txBytes: aRxBytes,
isAccumulative: true };

Просмотреть файл

@ -47,7 +47,7 @@ add_test(function test_networkStatsAvailable_ok() {
NetworkStatsService.networkStatsAvailable(function (success, msg) {
do_check_eq(success, true);
run_next_test();
}, netId, true, 1234, 4321, new Date());
}, netId, true, 1234, 4321, Date.now());
});
});
@ -58,7 +58,7 @@ add_test(function test_networkStatsAvailable_failure() {
NetworkStatsService.networkStatsAvailable(function (success, msg) {
do_check_eq(success, false);
run_next_test();
}, netId, false, 1234, 4321, new Date());
}, netId, false, 1234, 4321, Date.now());
});
});

Просмотреть файл

@ -98,6 +98,7 @@ function MozNFCPeer() {
MozNFCPeer.prototype = {
_nfcContentHelper: null,
_window: null,
_isLost: false,
initialize: function(aWindow, aSessionToken) {
this._window = aWindow;
@ -106,11 +107,19 @@ MozNFCPeer.prototype = {
// NFCPeer interface:
sendNDEF: function sendNDEF(records) {
if (this._isLost) {
throw new this._window.DOMError("InvalidStateError", "NFCPeer object is invalid");
}
// Just forward sendNDEF to writeNDEF
return this._nfcContentHelper.writeNDEF(this._window, records, this.session);
},
sendFile: function sendFile(blob) {
if (this._isLost) {
throw new this._window.DOMError("InvalidStateError", "NFCPeer object is invalid");
}
let data = {
"blob": blob
};
@ -119,6 +128,10 @@ MozNFCPeer.prototype = {
this.session);
},
invalidate: function invalidate() {
this._isLost = true;
},
classID: Components.ID("{c1b2bcf0-35eb-11e3-aa6e-0800200c9a66}"),
contractID: "@mozilla.org/nfc/NFCPeer;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
@ -136,10 +149,14 @@ function mozNfc() {
} catch(e) {
debug("No NFC support.")
}
this._nfcContentHelper.registerPeerEventListener(this);
}
mozNfc.prototype = {
_nfcContentHelper: null,
_window: null,
nfcObject: null,
_wrap: function _wrap(obj) {
return Cu.cloneInto(obj, this._window);
},
@ -192,13 +209,19 @@ mozNfc.prototype = {
},
getNFCPeer: function getNFCPeer(sessionToken) {
let obj = new MozNFCPeer();
obj.initialize(this._window, sessionToken);
if (this._nfcContentHelper.setSessionToken(sessionToken)) {
return this._window.MozNFCPeer._create(this._window, obj);
if (!sessionToken || !this._nfcContentHelper.setSessionToken(sessionToken)) {
throw new Error("Unable to create NFCPeer object, Reason: Bad SessionToken " +
sessionToken);
}
throw new Error("Unable to create NFCPeer object, Reason: Bad SessionToken " +
sessionToken);
if (!this.nfcObject) {
let obj = new MozNFCPeer();
obj.initialize(this._window, sessionToken);
this.nfcObject = obj;
this.nfcObject.contentObject = this._window.MozNFCPeer._create(this._window, obj);
}
return this.nfcObject.contentObject;
},
// get/set onpeerready
@ -221,32 +244,61 @@ mozNfc.prototype = {
eventListenerWasAdded: function(evt) {
let eventType = this.getEventType(evt);
if (eventType == -1)
if (eventType != NFC_PEER_EVENT_READY) {
return;
this.registerTarget(eventType);
}
let appId = this._window.document.nodePrincipal.appId;
this._nfcContentHelper.registerTargetForPeerReady(this._window, appId);
},
eventListenerWasRemoved: function(evt) {
let eventType = this.getEventType(evt);
if (eventType == -1)
if (eventType != NFC_PEER_EVENT_READY) {
return;
this.unregisterTarget(eventType);
}
let appId = this._window.document.nodePrincipal.appId;
this._nfcContentHelper.unregisterTargetForPeerReady(this._window, appId);
},
registerTarget: function registerTarget(event) {
let self = this;
let appId = this._window.document.nodePrincipal.appId;
this._nfcContentHelper.registerTargetForPeerEvent(this._window, appId,
event, function(evt, sessionToken) {
self.session = sessionToken;
self.firePeerEvent(evt, sessionToken);
});
notifyPeerReady: function notifyPeerReady(sessionToken) {
if (this.hasDeadWrapper()) {
dump("this._window or this.__DOM_IMPL__ is a dead wrapper.");
return;
}
this.session = sessionToken;
debug("fire onpeerready sessionToken : " + sessionToken);
let detail = {
"detail":sessionToken
};
let event = new this._window.CustomEvent("peerready", this._wrap(detail));
this.__DOM_IMPL__.dispatchEvent(event);
},
unregisterTarget: function unregisterTarget(event) {
let appId = this._window.document.nodePrincipal.appId;
this._nfcContentHelper.unregisterTargetForPeerEvent(this._window,
appId, event);
notifyPeerLost: function notifyPeerLost(sessionToken) {
if (this.hasDeadWrapper()) {
dump("this._window or this.__DOM_IMPL__ is a dead wrapper.");
return;
}
if (sessionToken != this.session) {
dump("Unpaired session for notifyPeerLost." + sessionToken);
return;
}
if (this.nfcObject && (this.nfcObject.session == sessionToken)) {
this.nfcObject.invalidate();
this.nfcObject = null;
}
this.session = null;
debug("fire onpeerlost");
let event = new this._window.Event("peerlost");
this.__DOM_IMPL__.dispatchEvent(event);
},
getEventType: function getEventType(evt) {
@ -268,24 +320,11 @@ mozNfc.prototype = {
return Cu.isDeadWrapper(this._window) || Cu.isDeadWrapper(this.__DOM_IMPL__);
},
firePeerEvent: function firePeerEvent(evt, sessionToken) {
if (this.hasDeadWrapper()) {
dump("this._window or this.__DOM_IMPL__ is a dead wrapper.");
return;
}
let peerEvent = (NFC_PEER_EVENT_READY === evt) ? "peerready" : "peerlost";
let detail = {
"detail":sessionToken
};
let event = new this._window.CustomEvent(peerEvent, this._wrap(detail));
this.__DOM_IMPL__.dispatchEvent(event);
},
classID: Components.ID("{6ff2b290-2573-11e3-8224-0800200c9a66}"),
contractID: "@mozilla.org/navigatorNfc;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
Ci.nsIDOMGlobalPropertyInitializer]),
Ci.nsIDOMGlobalPropertyInitializer,
Ci.nsINfcPeerEventListener]),
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MozNFCTag, MozNFCPeer, mozNfc]);

Просмотреть файл

@ -10,16 +10,20 @@ let INCORRECT_MANIFEST_URL = "app://xyz.gaiamobile.org/manifest.webapp";
function peerReadyCb(evt) {
log("peerReadyCb called");
let peer = nfc.getNFCPeer(evt.detail);
let peer1 = nfc.getNFCPeer(evt.detail);
ok(peer == peer1, "Should get the same NFCPeer object.");
ok(peer instanceof MozNFCPeer, "Should get a NFCPeer object.");
// reset callback.
nfc.onpeerready = null;
NCI.deactivate();
}
function peerLostCb() {
function peerLostCb(evt) {
log("peerLostCb called");
ok(evt.detail === undefined, "evt.detail should be undefined");
ok(true);
// reset callback.
nfc.onpeerready = null;
nfc.onpeerlost = null;
toggleNFC(false).then(runNextTest);
}
@ -93,10 +97,66 @@ function testCheckNfcPeerObjForInvalidToken() {
toggleNFC(false).then(runNextTest);
}
function testPeerLostShouldNotBeCalled() {
nfc.onpeerlost = function () {
ok(false, "onpeerlost shouldn't be called");
};
toggleNFC(true)
.then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
.then(NCI.deactivate)
.then(() => toggleNFC(false));
nfc.onpeerlost = null;
runNextTest();
}
function testPeerShouldThrow() {
let peer;
let tnf = NDEF.TNF_WELL_KNOWN;
let type = new Uint8Array(NfcUtils.fromUTF8("U"));
let id = new Uint8Array(NfcUtils.fromUTF8(""));
let payload = new Uint8Array(NfcUtils.fromUTF8(url));
let ndef = [new MozNDEFRecord(tnf, type, id, payload)];
nfc.onpeerready = function (evt) {
peer = nfc.getNFCPeer(evt.detail);
};
let request = nfc.checkP2PRegistration(MANIFEST_URL);
request.onsuccess = function (evt) {
is(request.result, true, "check for P2P registration result");
nfc.notifyUserAcceptedP2P(MANIFEST_URL);
}
toggleNFC(true)
.then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0))
.then(NCI.deactivate);
try {
peer.sendNDEF(ndef);
ok(false, "sendNDEF should throw error");
} catch (e) {
ok(true, "Exception expected");
}
try {
peer.sendFile(new Blob());
ok(false, "sendfile should throw error");
} catch (e) {
ok(true, "Exception expected");
}
nfc.onpeerready = null;
toggleNFC(false).then(runNextTest);
}
let tests = [
testPeerReady,
testCheckP2PRegFailure,
testCheckNfcPeerObjForInvalidToken
testCheckNfcPeerObjForInvalidToken,
testPeerLostShouldNotBeCalled,
testPeerShouldThrow
];
SpecialPowers.pushPermissions(

Просмотреть файл

@ -7,6 +7,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
const Ci = Components.interfaces;
const Cc = Components.classes;
const Cu = Components.utils;
const POSITION_UNAVAILABLE = Ci.nsIDOMGeoPositionError.POSITION_UNAVAILABLE;
const SETTINGS_DEBUG_ENABLED = "geolocation.debugging.enabled";

Просмотреть файл

@ -124,41 +124,35 @@ NetworkService.prototype = {
getNetworkInterfaceStats: function(networkName, callback) {
if(DEBUG) debug("getNetworkInterfaceStats for " + networkName);
if (this.shutdown) {
return;
}
let file = new FileUtils.File("/proc/net/dev");
if (!file) {
callback.networkStatsAvailable(false, -1, -1, new Date());
callback.networkStatsAvailable(false, 0, 0, Date.now());
return;
}
NetUtil.asyncFetch(file, function(inputStream, status) {
let result = {
success: true, // netd always return success even interface doesn't exist.
rxBytes: 0,
txBytes: 0
};
result.date = new Date();
let rxBytes = 0,
txBytes = 0,
now = Date.now();
if (Components.isSuccessCode(status)) {
// Find record for corresponding interface.
let statExpr = /(\S+): +(\d+) +\d+ +\d+ +\d+ +\d+ +\d+ +\d+ +\d+ +(\d+) +\d+ +\d+ +\d+ +\d+ +\d+ +\d+ +\d+/;
let data = NetUtil.readInputStreamToString(inputStream,
inputStream.available()).split("\n");
let data =
NetUtil.readInputStreamToString(inputStream, inputStream.available())
.split("\n");
for (let i = 2; i < data.length; i++) {
let parseResult = statExpr.exec(data[i]);
if (parseResult && parseResult[1] === networkName) {
result.rxBytes = parseInt(parseResult[2], 10);
result.txBytes = parseInt(parseResult[3], 10);
rxBytes = parseInt(parseResult[2], 10);
txBytes = parseInt(parseResult[3], 10);
break;
}
}
}
callback.networkStatsAvailable(result.success, result.rxBytes,
result.txBytes, result.date);
// netd always return success even interface doesn't exist.
callback.networkStatsAvailable(true, rxBytes, txBytes, now);
});
},

Просмотреть файл

@ -213,12 +213,6 @@ CommandFunc NetworkUtils::sStopDhcpServerChain[] = {
NetworkUtils::setDhcpServerSuccess
};
CommandFunc NetworkUtils::sNetworkInterfaceStatsChain[] = {
NetworkUtils::getRxBytes,
NetworkUtils::getTxBytes,
NetworkUtils::networkInterfaceStatsSuccess
};
CommandFunc NetworkUtils::sNetworkInterfaceEnableAlarmChain[] = {
NetworkUtils::enableAlarm,
NetworkUtils::setQuota,
@ -619,29 +613,6 @@ void NetworkUtils::clearWifiTetherParms(CommandChain* aChain,
next(aChain, false, aResult);
}
void NetworkUtils::getRxBytes(CommandChain* aChain,
CommandCallback aCallback,
NetworkResultOptions& aResult)
{
char command[MAX_COMMAND_SIZE];
snprintf(command, MAX_COMMAND_SIZE - 1, "interface readrxcounter %s", GET_CHAR(mIfname));
doCommand(command, aChain, aCallback);
}
void NetworkUtils::getTxBytes(CommandChain* aChain,
CommandCallback aCallback,
NetworkResultOptions& aResult)
{
NetworkParams& options = aChain->getParams();
options.mRxBytes = atof(NS_ConvertUTF16toUTF8(aResult.mResultReason).get());
char command[MAX_COMMAND_SIZE];
snprintf(command, MAX_COMMAND_SIZE - 1, "interface readtxcounter %s", GET_CHAR(mIfname));
doCommand(command, aChain, aCallback);
}
void NetworkUtils::enableAlarm(CommandChain* aChain,
CommandCallback aCallback,
NetworkResultOptions& aResult)
@ -994,20 +965,6 @@ void NetworkUtils::usbTetheringSuccess(CommandChain* aChain,
postMessage(aChain->getParams(), aResult);
}
void NetworkUtils::networkInterfaceStatsFail(NetworkParams& aOptions, NetworkResultOptions& aResult)
{
postMessage(aOptions, aResult);
}
void NetworkUtils::networkInterfaceStatsSuccess(CommandChain* aChain,
CommandCallback aCallback,
NetworkResultOptions& aResult)
{
ASSIGN_FIELD(mRxBytes)
ASSIGN_FIELD_VALUE(mTxBytes, atof(NS_ConvertUTF16toUTF8(aResult.mResultReason).get()))
postMessage(aChain->getParams(), aResult);
}
void NetworkUtils::networkInterfaceAlarmFail(NetworkParams& aOptions, NetworkResultOptions& aResult)
{
postMessage(aOptions, aResult);
@ -1109,7 +1066,6 @@ void NetworkUtils::ExecuteCommand(NetworkParams aOptions)
BUILD_ENTRY(removeHostRoutes),
BUILD_ENTRY(addSecondaryRoute),
BUILD_ENTRY(removeSecondaryRoute),
BUILD_ENTRY(getNetworkInterfaceStats),
BUILD_ENTRY(setNetworkInterfaceAlarm),
BUILD_ENTRY(enableNetworkInterfaceAlarm),
BUILD_ENTRY(disableNetworkInterfaceAlarm),
@ -1517,16 +1473,6 @@ bool NetworkUtils::removeSecondaryRoute(NetworkParams& aOptions)
return true;
}
bool NetworkUtils::getNetworkInterfaceStats(NetworkParams& aOptions)
{
DEBUG("getNetworkInterfaceStats: %s", GET_CHAR(mIfname));
aOptions.mRxBytes = -1;
aOptions.mTxBytes = -1;
RUN_CHAIN(aOptions, sNetworkInterfaceStatsChain, networkInterfaceStatsFail);
return true;
}
bool NetworkUtils::setNetworkInterfaceAlarm(NetworkParams& aOptions)
{
DEBUG("setNetworkInterfaceAlarms: %s", GET_CHAR(mIfname));

Просмотреть файл

@ -60,9 +60,6 @@ public:
mDns1 = aOther.mDns1;
mDns2 = aOther.mDns2;
mDnses = aOther.mDnses;
mRxBytes = aOther.mRxBytes;
mTxBytes = aOther.mTxBytes;
mDate = aOther.mDate;
mStartIp = aOther.mStartIp;
mEndIp = aOther.mEndIp;
mServerIp = aOther.mServerIp;
@ -136,9 +133,6 @@ public:
COPY_OPT_STRING_FIELD(mDns1, EmptyString())
COPY_OPT_STRING_FIELD(mDns2, EmptyString())
COPY_SEQUENCE_FIELD(mDnses, nsString)
COPY_OPT_FIELD(mRxBytes, -1)
COPY_OPT_FIELD(mTxBytes, -1)
COPY_OPT_STRING_FIELD(mDate, EmptyString())
COPY_OPT_STRING_FIELD(mStartIp, EmptyString())
COPY_OPT_STRING_FIELD(mEndIp, EmptyString())
COPY_OPT_STRING_FIELD(mServerIp, EmptyString())
@ -186,9 +180,6 @@ public:
nsString mDns1;
nsString mDns2;
nsTArray<nsString> mDnses;
float mRxBytes;
float mTxBytes;
nsString mDate;
nsString mStartIp;
nsString mEndIp;
nsString mServerIp;
@ -271,7 +262,6 @@ private:
bool removeNetworkRoute(NetworkParams& aOptions);
bool addSecondaryRoute(NetworkParams& aOptions);
bool removeSecondaryRoute(NetworkParams& aOptions);
bool getNetworkInterfaceStats(NetworkParams& aOptions);
bool setNetworkInterfaceAlarm(NetworkParams& aOptions);
bool enableNetworkInterfaceAlarm(NetworkParams& aOptions);
bool disableNetworkInterfaceAlarm(NetworkParams& aOptions);
@ -297,7 +287,6 @@ private:
static CommandFunc sUpdateUpStreamChain[];
static CommandFunc sStartDhcpServerChain[];
static CommandFunc sStopDhcpServerChain[];
static CommandFunc sNetworkInterfaceStatsChain[];
static CommandFunc sNetworkInterfaceEnableAlarmChain[];
static CommandFunc sNetworkInterfaceDisableAlarmChain[];
static CommandFunc sNetworkInterfaceSetAlarmChain[];
@ -317,8 +306,6 @@ private:
static void startSoftAP(PARAMS);
static void stopSoftAP(PARAMS);
static void clearWifiTetherParms(PARAMS);
static void getRxBytes(PARAMS);
static void getTxBytes(PARAMS);
static void enableAlarm(PARAMS);
static void disableAlarm(PARAMS);
static void setQuota(PARAMS);
@ -340,7 +327,6 @@ private:
static void setInterfaceDns(PARAMS);
static void wifiTetheringSuccess(PARAMS);
static void usbTetheringSuccess(PARAMS);
static void networkInterfaceStatsSuccess(PARAMS);
static void networkInterfaceAlarmSuccess(PARAMS);
static void updateUpStreamSuccess(PARAMS);
static void setDhcpServerSuccess(PARAMS);
@ -357,7 +343,6 @@ private:
static void usbTetheringFail(PARAMS);
static void updateUpStreamFail(PARAMS);
static void setDhcpServerFail(PARAMS);
static void networkInterfaceStatsFail(PARAMS);
static void networkInterfaceAlarmFail(PARAMS);
static void setDnsFail(PARAMS);
#undef PARAMS

Просмотреть файл

@ -45,9 +45,6 @@ public:
COPY_FIELD(mResultCode)
COPY_FIELD(mResultReason)
COPY_FIELD(mError)
COPY_FIELD(mRxBytes)
COPY_FIELD(mTxBytes)
COPY_FIELD(mDate)
COPY_FIELD(mEnable)
COPY_FIELD(mResult)
COPY_FIELD(mSuccess)

Просмотреть файл

@ -62,8 +62,8 @@ const NFC_IPC_WRITE_PERM_MSG_NAMES = [
"NFC:WriteNDEF",
"NFC:MakeReadOnlyNDEF",
"NFC:SendFile",
"NFC:RegisterPeerTarget",
"NFC:UnregisterPeerTarget"
"NFC:RegisterPeerReadyTarget",
"NFC:UnregisterPeerReadyTarget"
];
const NFC_IPC_MANAGER_PERM_MSG_NAMES = [
@ -224,52 +224,28 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
}
},
registerPeerTarget: function registerPeerTarget(msg) {
registerPeerReadyTarget: function registerPeerReadyTarget(msg) {
let appInfo = msg.json;
// Sanity check on PeerEvent
if (!this.isValidPeerEvent(appInfo.event)) {
return;
}
let targets = this.peerTargetsMap;
let targetInfo = targets[appInfo.appId];
// If the application Id is already registered
if (targetInfo) {
// If the event is not registered
if (targetInfo.event !== appInfo.event) {
// Update the event field ONLY
targetInfo.event |= appInfo.event;
}
// Otherwise event is already registered, return!
return;
}
// Target not registered yet! Add to the target map
// Registered targetInfo target consists of 2 fields (values)
// target : Target to notify the right content for peer notifications
// event : NFC_PEER_EVENT_READY (0x01) Or NFC_PEER_EVENT_LOST (0x02)
// Target not registered yet! Add to the target map
let newTargetInfo = { target : msg.target,
event : appInfo.event };
isPeerReadyCalled: false };
targets[appInfo.appId] = newTargetInfo;
},
unregisterPeerTarget: function unregisterPeerTarget(msg) {
unregisterPeerReadyTarget: function unregisterPeerReadyTarget(msg) {
let appInfo = msg.json;
// Sanity check on PeerEvent
if (!this.isValidPeerEvent(appInfo.event)) {
return;
}
let targets = this.peerTargetsMap;
let targetInfo = targets[appInfo.appId];
if (targetInfo) {
// Application Id registered and the event exactly matches.
if (targetInfo.event === appInfo.event) {
// Remove the target from the list of registered targets
delete targets[appInfo.appId]
}
else {
// Otherwise, update the event field ONLY, by removing the event flag
targetInfo.event &= ~appInfo.event;
}
// Remove the target from the list of registered targets
delete targets[appInfo.appId]
}
},
@ -284,39 +260,29 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
});
},
isRegisteredP2PTarget: function isRegisteredP2PTarget(appId, event) {
isPeerReadyTarget: function isPeerReadyTarget(appId) {
let targetInfo = this.peerTargetsMap[appId];
// Check if it is a registered target for the 'event'
return ((targetInfo != null) && ((targetInfo.event & event) !== 0));
return (targetInfo != null);
},
isPeerReadyCalled: function isPeerReadyCalled(appId) {
let targetInfo = this.peerTargetsMap[appId];
return targetInfo.IsPeerReadyCalled;
},
notifyPeerEvent: function notifyPeerEvent(appId, event) {
let targetInfo = this.peerTargetsMap[appId];
// Check if the application id is a registeredP2PTarget
if (this.isRegisteredP2PTarget(appId, event)) {
targetInfo.target.sendAsyncMessage("NFC:PeerEvent", {
event: event,
sessionToken: this.nfc.sessionTokenMap[this.nfc._currentSessionId]
});
return;
}
debug("Application ID : " + appId + " is not a registered target" +
"for the event " + event + " notification");
},
isValidPeerEvent: function isValidPeerEvent(event) {
// Valid values : 0x01, 0x02 Or 0x03
return ((event === NFC.NFC_PEER_EVENT_READY) ||
(event === NFC.NFC_PEER_EVENT_LOST) ||
(event === (NFC.NFC_PEER_EVENT_READY | NFC.NFC_PEER_EVENT_LOST)));
targetInfo.target.sendAsyncMessage("NFC:PeerEvent", {
event: event,
sessionToken: this.nfc.sessionTokenMap[this.nfc._currentSessionId]
});
},
checkP2PRegistration: function checkP2PRegistration(msg) {
// Check if the session and application id yeild a valid registered
// target. It should have registered for NFC_PEER_EVENT_READY
let isValid = !!this.nfc.sessionTokenMap[this.nfc._currentSessionId] &&
this.isRegisteredP2PTarget(msg.json.appId,
NFC.NFC_PEER_EVENT_READY);
this.isPeerReadyTarget(msg.json.appId);
// Remember the current AppId if registered.
this.currentPeerAppId = (isValid) ? msg.json.appId : null;
@ -378,17 +344,24 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
debug("Registering target for this SessionToken : " +
this.nfc.sessionTokenMap[this.nfc._currentSessionId]);
return NFC.NFC_SUCCESS;
case "NFC:RegisterPeerTarget":
this.registerPeerTarget(msg);
case "NFC:RegisterPeerReadyTarget":
this.registerPeerReadyTarget(msg);
return null;
case "NFC:UnregisterPeerTarget":
this.unregisterPeerTarget(msg);
case "NFC:UnregisterPeerReadyTarget":
this.unregisterPeerReadyTarget(msg);
return null;
case "NFC:CheckP2PRegistration":
this.checkP2PRegistration(msg);
return null;
case "NFC:NotifyUserAcceptedP2P":
// Notify the 'NFC_PEER_EVENT_READY' since user has acknowledged
if (!this.isPeerReadyTarget(msg.json.appId)) {
debug("Application ID : " + appId + " is not a registered PeerReadytarget");
return null;
}
let targetInfo = this.peerTargetsMap[msg.json.appId];
targetInfo.IsPeerReadyCalled = true;
this.notifyPeerEvent(msg.json.appId, NFC.NFC_PEER_EVENT_READY);
return null;
case "NFC:NotifySendFileStatus":
@ -530,8 +503,15 @@ Nfc.prototype = {
delete message.sessionId;
gSystemMessenger.broadcastMessage("nfc-manager-tech-lost", message);
// Notify 'PeerLost' to appropriate registered target, if any
gMessageManager.notifyPeerEvent(gMessageManager.currentPeerAppId, NFC.NFC_PEER_EVENT_LOST);
let appId = gMessageManager.currentPeerAppId;
// For peerlost, the message is delievered to the target which
// registered onpeerready and onpeerready has been called before.
if (gMessageManager.isPeerReadyTarget(appId) && gMessageManager.isPeerReadyCalled(appId)) {
gMessageManager.notifyPeerEvent(appId, NFC.NFC_PEER_EVENT_LOST);
}
delete this.sessionTokenMap[this._currentSessionId];
this._currentSessionId = null;
this.currentPeerAppId = null;

Просмотреть файл

@ -80,10 +80,6 @@ function NfcContentHelper() {
Services.obs.addObserver(this, "xpcom-shutdown", false);
this._requestMap = [];
// Maintains an array of PeerEvent related callbacks, mainly
// one for 'peerReady' and another for 'peerLost'.
this.peerEventsCallbackMap = {};
}
NfcContentHelper.prototype = {
@ -100,7 +96,7 @@ NfcContentHelper.prototype = {
}),
_requestMap: null,
peerEventsCallbackMap: null,
peerEventListener: null,
encodeNDEFRecords: function encodeNDEFRecords(records) {
let encodedRecords = [];
@ -261,34 +257,26 @@ NfcContentHelper.prototype = {
});
},
registerTargetForPeerEvent: function registerTargetForPeerEvent(window,
appId, event, callback) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
}
this.peerEventsCallbackMap[event] = callback;
cpmm.sendAsyncMessage("NFC:RegisterPeerTarget", {
appId: appId,
event: event
});
registerPeerEventListener: function registerPeerEventListener(listener) {
this.peerEventListener = listener;
},
unregisterTargetForPeerEvent: function unregisterTargetForPeerEvent(window,
appId, event) {
registerTargetForPeerReady: function registerTargetForPeerReady(window, appId) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
}
let callback = this.peerEventsCallbackMap[event];
if (callback != null) {
delete this.peerEventsCallbackMap[event];
cpmm.sendAsyncMessage("NFC:RegisterPeerReadyTarget", { appId: appId });
},
unregisterTargetForPeerReady: function unregisterTargetForPeerReady(window, appId) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
}
cpmm.sendAsyncMessage("NFC:UnregisterPeerTarget", {
appId: appId,
event: event
});
cpmm.sendAsyncMessage("NFC:UnregisterPeerReadyTarget", { appId: appId });
},
checkP2PRegistration: function checkP2PRegistration(window, appId) {
@ -427,12 +415,13 @@ NfcContentHelper.prototype = {
}
break;
case "NFC:PeerEvent":
let callback = this.peerEventsCallbackMap[result.event];
if (callback) {
callback.peerNotification(result.event, result.sessionToken);
} else {
debug("PeerEvent: No valid callback registered for the event " +
result.event);
switch (result.event) {
case NFC.NFC_PEER_EVENT_READY:
this.peerEventListener.notifyPeerReady(result.sessionToken);
break;
case NFC.NFC_PEER_EVENT_LOST:
this.peerEventListener.notifyPeerLost(result.sessionToken);
break;
}
break;
}

Просмотреть файл

@ -19,13 +19,13 @@ interface nsIWifiTetheringCallback : nsISupports
void wifiTetheringEnabledChange(in jsval error);
};
[scriptable, function, uuid(e079aa2a-ec0a-4bbd-b1a4-d81a9faae464)]
[scriptable, function, uuid(9c128e68-5e4b-4626-bb88-84ec54cce5d8)]
interface nsINetworkStatsCallback : nsISupports
{
void networkStatsAvailable(in boolean success,
in unsigned long rxBytes,
in unsigned long txBytes,
in jsval date);
in unsigned long long timestamp);
};
[scriptable, function, uuid(0706bfa2-ac2d-11e2-9a8d-7b6d988d4767)]

Просмотреть файл

@ -7,24 +7,27 @@
interface nsIVariant;
[scriptable, function, uuid(26673d1a-4af4-470a-ba96-f1f54b1f2052)]
interface nsINfcPeerCallback : nsISupports
[scriptable, uuid(57fc2998-1058-4fd5-8dd9-0e303218d5fd)]
interface nsINfcPeerEventListener : nsISupports
{
/**
* Callback function used to notify NFC peer events.
*
* @param event
* An event indicating 'PeerReady' or 'PeerLost'
* One of NFC_EVENT_PEER_XXXX
* Callback function used to notify peerready.
*
* @param sessionToken
* SessionToken received from Chrome process
*/
void peerNotification(in unsigned long event,
in DOMString sessionToken);
void notifyPeerReady(in DOMString sessionToken);
/**
* Callback function used to notify peerlost.
*
* @param sessionToken
* SessionToken received from Chrome process
*/
void notifyPeerLost(in DOMString sessionToken);
};
[scriptable, uuid(26e8123f-ba00-4708-ac77-d1902457168c)]
[scriptable, uuid(5bea28d3-67ee-4916-8c8e-4f35e3666e61)]
interface nsINfcContentHelper : nsISupports
{
const long NFC_EVENT_PEER_READY = 0x01;
@ -61,6 +64,13 @@ interface nsINfcContentHelper : nsISupports
in jsval blob,
in DOMString sessionToken);
/**
* Register the peer event listener.
*
* @param listener An instance of the nsINfcPeerEventListener.
*/
void registerPeerEventListener(in nsINfcPeerEventListener listener);
/**
* Register the given application id with Chrome process
*
@ -69,17 +79,10 @@ interface nsINfcContentHelper : nsISupports
*
* @param appId
* Application ID to be registered
*
* @param event
* Event to be registered. Either NFC_EVENT_PEER_READY or NFC_EVENT_PEER_LOST
*
* @param callback
* Callback that is used to notify upper layers whenever PeerEvents happen.
*/
void registerTargetForPeerEvent(in nsIDOMWindow window,
in unsigned long appId,
in octet event,
in nsINfcPeerCallback callback);
void registerTargetForPeerReady(in nsIDOMWindow window,
in unsigned long appId);
/**
* Unregister the given application id with Chrome process
*
@ -88,13 +91,10 @@ interface nsINfcContentHelper : nsISupports
*
* @param appId
* Application ID to be registered
*
* @param event
* Event to be unregistered. Either NFC_EVENT_PEER_READY or NFC_EVENT_PEER_LOST
*/
void unregisterTargetForPeerEvent(in nsIDOMWindow window,
in unsigned long appId,
in octet event);
void unregisterTargetForPeerReady(in nsIDOMWindow window,
in unsigned long appId);
/**
* Checks if the given application's id is a registered peer target (with the Chrome process)
*

Просмотреть файл

@ -10,7 +10,9 @@
[JSImplementation="@mozilla.org/nfc/NFCPeer;1"]
interface MozNFCPeer {
[Throws]
DOMRequest sendNDEF(sequence<MozNDEFRecord> records);
[Throws]
DOMRequest sendFile(Blob blob);
};

Просмотреть файл

@ -42,9 +42,6 @@ dictionary NetworkCommandOptions
DOMString usbEndIp; // for "setWifiTethering".
DOMString dns1; // for "setWifiTethering".
DOMString dns2; // for "setWifiTethering".
float rxBytes; // for "getNetworkInterfaceStats".
float txBytes; // for "getNetworkInterfaceStats".
DOMString date; // for "getNetworkInterfaceStats".
long threshold; // for "setNetworkInterfaceAlarm",
// "enableNetworkInterfaceAlarm".
DOMString startIp; // for "setDhcpServer".
@ -72,9 +69,6 @@ dictionary NetworkResultOptions
DOMString resultReason = ""; // for all commands.
boolean error = false; // for all commands.
float rxBytes = -1; // for "getNetworkInterfaceStats".
float txBytes = -1; // for "getNetworkInterfaceStats".
DOMString date = ""; // for "getNetworkInterfaceStats".
boolean enable = false; // for "setWifiTethering", "setUSBTethering"
// "enableUsbRndis".
boolean result = false; // for "enableUsbRndis".

Просмотреть файл

@ -83,7 +83,7 @@ let WebappRT = {
let apps = request.result;
for (let i = 0; i < apps.length; i++) {
let app = apps[i];
let manifest = new ManifestHelper(app.manifest, app.origin);
let manifest = new ManifestHelper(app.manifest, app.origin, app.manifestURL);
// if this is a path to the manifest, or the launch path, then we have a hit.
if (app.manifestURL == aUrl || manifest.fullLaunchPath() == aUrl) {

Просмотреть файл

@ -105,7 +105,7 @@ function updateList() {
function addApplication(aApp) {
let list = document.getElementById("appgrid");
let manifest = new ManifestHelper(aApp.manifest, aApp.origin);
let manifest = new ManifestHelper(aApp.manifest, aApp.origin, aApp.manifestURL);
let container = document.createElement("div");
container.className = "app list-item";

Просмотреть файл

@ -179,12 +179,13 @@ this.WebappManager = {
DOMApplicationRegistry.registryReady.then(() => {
DOMApplicationRegistry.confirmInstall(aData, file, (function(aApp, aManifest) {
this._postInstall(aData.profilePath, aManifest, aData.app.origin, aData.app.apkPackageName);
this._postInstall(aData.profilePath, aManifest, aData.app.origin,
aData.app.apkPackageName, aData.app.manifestURL);
}).bind(this));
});
},
_postInstall: function(aProfilePath, aNewManifest, aOrigin, aApkPackageName) {
_postInstall: function(aProfilePath, aNewManifest, aOrigin, aApkPackageName, aManifestURL) {
// aOrigin may now point to the app: url that hosts this app.
sendMessageToJava({
type: "Webapps:Postinstall",
@ -194,7 +195,7 @@ this.WebappManager = {
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
file.initWithPath(aProfilePath);
let localeManifest = new ManifestHelper(aNewManifest, aOrigin);
let localeManifest = new ManifestHelper(aNewManifest, aOrigin, aManifestUrl);
this.writeDefaultPrefs(file, localeManifest);
},
@ -333,7 +334,7 @@ this.WebappManager = {
yield this._autoUpdatePackagedApp(aData, aOldApp);
}
this._postInstall(aData.profilePath, aData.manifest, aOldApp.origin, aOldApp.apkPackageName);
this._postInstall(aData.profilePath, aData.manifest, aOldApp.origin, aOldApp.apkPackageName, aOldApp.manifestURL);
}).bind(this)); },
_autoUpdatePackagedApp: Task.async(function*(aData, aOldApp) {

Просмотреть файл

@ -140,21 +140,7 @@ struct thread_info : public mozilla::LinkedListElement<thread_info> {
TLSInfoList tlsInfo;
/**
* We must ensure that the recreated thread has entered pthread_cond_wait() or
* similar functions before proceeding to recreate the next one. Otherwise, if
* the next thread depends on the same mutex, it may be used in an incorrect
* state. To do this, the main thread must unconditionally acquire the mutex.
* The mutex is unconditionally released when the recreated thread enters
* pthread_cond_wait(). The recreated thread may have locked the mutex itself
* (if the pthread_mutex_trylock succeeded) or another thread may have already
* held the lock. If the recreated thread did lock the mutex we must balance
* that with another unlock on the main thread, which is signaled by
* condMutexNeedsBalancing.
*/
pthread_mutex_t *condMutex;
bool condMutexNeedsBalancing;
pthread_mutex_t *reacquireMutex;
void *stk;
pid_t origNativeThreadID;
@ -515,8 +501,7 @@ thread_info_new(void) {
tinfo->recrArg = nullptr;
tinfo->recreatedThreadID = 0;
tinfo->recreatedNativeThreadID = 0;
tinfo->condMutex = nullptr;
tinfo->condMutexNeedsBalancing = false;
tinfo->reacquireMutex = nullptr;
tinfo->stk = MozTaggedAnonymousMmap(nullptr,
NUWA_STACK_SIZE + getPageSize(),
PROT_READ | PROT_WRITE,
@ -1031,16 +1016,13 @@ __wrap_pthread_cond_wait(pthread_cond_t *cond,
return rv;
}
if (recreated && mtx) {
if (!freezePoint1) {
tinfo->condMutex = mtx;
if (!freezePoint1 && pthread_mutex_trylock(mtx)) {
// The thread was frozen in pthread_cond_wait() after releasing mtx in the
// Nuwa process. In recreating this thread, We failed to reacquire mtx
// with the pthread_mutex_trylock() call, that is, mtx was acquired by
// another thread. Because of this, we need the main thread's help to
// reacquire mtx so that it will be in a valid state.
if (!pthread_mutex_trylock(mtx)) {
tinfo->condMutexNeedsBalancing = true;
}
tinfo->reacquireMutex = mtx;
}
RECREATE_CONTINUE();
RECREATE_PASS_VIP();
@ -1070,11 +1052,8 @@ __wrap_pthread_cond_timedwait(pthread_cond_t *cond,
return rv;
}
if (recreated && mtx) {
if (!freezePoint1) {
tinfo->condMutex = mtx;
if (!pthread_mutex_trylock(mtx)) {
tinfo->condMutexNeedsBalancing = true;
}
if (!freezePoint1 && pthread_mutex_trylock(mtx)) {
tinfo->reacquireMutex = mtx;
}
RECREATE_CONTINUE();
RECREATE_PASS_VIP();
@ -1108,11 +1087,8 @@ __wrap___pthread_cond_timedwait(pthread_cond_t *cond,
return rv;
}
if (recreated && mtx) {
if (!freezePoint1) {
tinfo->condMutex = mtx;
if (!pthread_mutex_trylock(mtx)) {
tinfo->condMutexNeedsBalancing = true;
}
if (!freezePoint1 && pthread_mutex_trylock(mtx)) {
tinfo->reacquireMutex = mtx;
}
RECREATE_CONTINUE();
RECREATE_PASS_VIP();
@ -1427,12 +1403,8 @@ RecreateThreads() {
RECREATE_BEFORE(tinfo);
thread_recreate(tinfo);
RECREATE_WAIT();
if (tinfo->condMutex) {
// Synchronize with the recreated thread in pthread_cond_wait().
REAL(pthread_mutex_lock)(tinfo->condMutex);
if (tinfo->condMutexNeedsBalancing) {
pthread_mutex_unlock(tinfo->condMutex);
}
if (tinfo->reacquireMutex) {
REAL(pthread_mutex_lock)(tinfo->reacquireMutex);
}
} else if(!(tinfo->flags & TINFO_FLAG_NUWA_SKIP)) {
// An unmarked thread is found other than the main thread.

Просмотреть файл

@ -283,7 +283,8 @@ WebappsActor.prototype = {
// We can't have appcache for packaged apps.
if (!aApp.origin.startsWith("app://")) {
reg.startOfflineCacheDownload(new ManifestHelper(manifest, aApp.origin));
reg.startOfflineCacheDownload(
new ManifestHelper(manifest, aApp.origin, aApp.manifestURL));
}
});
// Cleanup by removing the temporary directory.
@ -747,7 +748,7 @@ WebappsActor.prototype = {
let deferred = promise.defer();
this._findManifestByURL(manifestURL).then(jsonManifest => {
let manifest = new ManifestHelper(jsonManifest, app.origin);
let manifest = new ManifestHelper(jsonManifest, app.origin, manifestURL);
let iconURL = manifest.iconURLForSize(aRequest.size || 128);
if (!iconURL) {
deferred.resolve({

Просмотреть файл

@ -57,7 +57,8 @@ function CommonNativeApp(aApp, aManifest, aCategories, aRegistryDir) {
aApp.name = aManifest.name;
this.uniqueName = WebappOSUtils.getUniqueName(aApp);
let localeManifest = new ManifestHelper(aManifest, aApp.origin);
let localeManifest =
new ManifestHelper(aManifest, aApp.origin, aApp.manifestURL);
this.appLocalizedName = localeManifest.name;
this.appNameAsFilename = stripStringForFilename(aApp.name);
@ -99,7 +100,7 @@ CommonNativeApp.prototype = {
*
*/
_setData: function(aApp, aManifest) {
let manifest = new ManifestHelper(aManifest, aApp.origin);
let manifest = new ManifestHelper(aManifest, aApp.origin, aApp.manifestURL);
let origin = Services.io.newURI(aApp.origin, null, null);
this.iconURI = Services.io.newURI(manifest.biggestIconURL || DEFAULT_ICON_URL,

Просмотреть файл

@ -47,7 +47,8 @@ this.WebappManager = {
doInstall: function(data, window) {
let jsonManifest = data.isPackage ? data.app.updateManifest : data.app.manifest;
let manifest = new ManifestHelper(jsonManifest, data.app.origin);
let manifest =
new ManifestHelper(jsonManifest, data.app.origin, data.app.manifestURL);
let name = manifest.name;
let bundle = Services.strings.createBundle("chrome://webapprt/locale/webapp.properties");

Просмотреть файл

@ -48,7 +48,8 @@ this.WebappRT = {
get localeManifest() {
return new ManifestHelper(this.config.app.manifest,
this.config.app.origin);
this.config.app.origin,
this.config.app.manifestURL);
},
get appID() {