зеркало из https://github.com/mozilla/gecko-dev.git
merge b2g-inbound to mozilla-central
This commit is contained in:
Коммит
98e77c9ad6
|
@ -816,7 +816,7 @@ var AlertsHelper = {
|
|||
this._listeners[uid] = listener;
|
||||
|
||||
let app = DOMApplicationRegistry.getAppByManifestURL(listener.manifestURL);
|
||||
DOMApplicationRegistry.getManifestFor(app.manifestURL, function(manifest) {
|
||||
DOMApplicationRegistry.getManifestFor(app.manifestURL).then((manifest) => {
|
||||
let helper = new ManifestHelper(manifest, app.origin);
|
||||
let getNotificationURLFor = function(messages) {
|
||||
if (!messages)
|
||||
|
@ -873,7 +873,7 @@ var AlertsHelper = {
|
|||
// If we have a manifest URL, get the icon and title from the manifest
|
||||
// to prevent spoofing.
|
||||
let app = DOMApplicationRegistry.getAppByManifestURL(manifestUrl);
|
||||
DOMApplicationRegistry.getManifestFor(manifestUrl, function(aManifest) {
|
||||
DOMApplicationRegistry.getManifestFor(manifestUrl).then((aManifest) => {
|
||||
let helper = new ManifestHelper(aManifest, app.origin);
|
||||
send(helper.name, helper.iconURLForSize(128));
|
||||
});
|
||||
|
@ -972,7 +972,7 @@ var WebappsHelper = {
|
|||
|
||||
switch(topic) {
|
||||
case "webapps-launch":
|
||||
DOMApplicationRegistry.getManifestFor(json.manifestURL, function(aManifest) {
|
||||
DOMApplicationRegistry.getManifestFor(json.manifestURL).then((aManifest) => {
|
||||
if (!aManifest)
|
||||
return;
|
||||
|
||||
|
|
|
@ -12,7 +12,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="a0ea8c6bfd844bc958a1512c257ba539f96db222"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
|
||||
|
|
|
@ -11,7 +11,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="0d2e5af4b78dc68c36a6e1419d67b5da803b7d3a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
|
||||
|
|
|
@ -12,7 +12,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="a0ea8c6bfd844bc958a1512c257ba539f96db222"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"revision": "6ee0334bda22b4848d99e3a44e29eab3de815f52",
|
||||
"revision": "18bd82325a82f5b9a3a4b976e213515cd3e5866b",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -11,7 +11,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="a0ea8c6bfd844bc958a1512c257ba539f96db222"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
|
|
@ -10,7 +10,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="a0ea8c6bfd844bc958a1512c257ba539f96db222"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
|
|
@ -12,7 +12,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="a0ea8c6bfd844bc958a1512c257ba539f96db222"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
|
|
@ -11,7 +11,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="a0ea8c6bfd844bc958a1512c257ba539f96db222"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
|
|
@ -11,7 +11,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="0d2e5af4b78dc68c36a6e1419d67b5da803b7d3a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
|
||||
|
|
|
@ -11,7 +11,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="a0ea8c6bfd844bc958a1512c257ba539f96db222"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
|
|
@ -508,6 +508,49 @@ WebappsApplication.prototype = {
|
|||
}.bind(this));
|
||||
},
|
||||
|
||||
addReceipt: function(receipt) {
|
||||
let request = this.createRequest();
|
||||
|
||||
this.addMessageListeners(["Webapps:AddReceipt:Return:OK",
|
||||
"Webapps:AddReceipt:Return:KO"]);
|
||||
|
||||
cpmm.sendAsyncMessage("Webapps:AddReceipt", { manifestURL: this.manifestURL,
|
||||
receipt: receipt,
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) });
|
||||
|
||||
return request;
|
||||
},
|
||||
|
||||
removeReceipt: function(receipt) {
|
||||
let request = this.createRequest();
|
||||
|
||||
this.addMessageListeners(["Webapps:RemoveReceipt:Return:OK",
|
||||
"Webapps:RemoveReceipt:Return:KO"]);
|
||||
|
||||
cpmm.sendAsyncMessage("Webapps:RemoveReceipt", { manifestURL: this.manifestURL,
|
||||
receipt: receipt,
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) });
|
||||
|
||||
return request;
|
||||
},
|
||||
|
||||
replaceReceipt: function(oldReceipt, newReceipt) {
|
||||
let request = this.createRequest();
|
||||
|
||||
this.addMessageListeners(["Webapps:ReplaceReceipt:Return:OK",
|
||||
"Webapps:ReplaceReceipt:Return:KO"]);
|
||||
|
||||
cpmm.sendAsyncMessage("Webapps:ReplaceReceipt", { manifestURL: this.manifestURL,
|
||||
newReceipt: newReceipt,
|
||||
oldReceipt: oldReceipt,
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) });
|
||||
|
||||
return request;
|
||||
},
|
||||
|
||||
uninit: function() {
|
||||
this._onprogress = null;
|
||||
cpmm.sendAsyncMessage("Webapps:UnregisterForMessages", [
|
||||
|
@ -638,6 +681,39 @@ WebappsApplication.prototype = {
|
|||
});
|
||||
req.resolve(connections);
|
||||
break;
|
||||
case "Webapps:AddReceipt:Return:OK":
|
||||
this.removeMessageListeners(["Webapps:AddReceipt:Return:OK",
|
||||
"Webapps:AddReceipt:Return:KO"]);
|
||||
this.receipts = msg.receipts;
|
||||
Services.DOMRequest.fireSuccess(req, null);
|
||||
break;
|
||||
case "Webapps:AddReceipt:Return:KO":
|
||||
this.removeMessageListeners(["Webapps:AddReceipt:Return:OK",
|
||||
"Webapps:AddReceipt:Return:KO"]);
|
||||
Services.DOMRequest.fireError(req, msg.error);
|
||||
break;
|
||||
case "Webapps:RemoveReceipt:Return:OK":
|
||||
this.removeMessageListeners(["Webapps:RemoveReceipt:Return:OK",
|
||||
"Webapps:RemoveReceipt:Return:KO"]);
|
||||
this.receipts = msg.receipts;
|
||||
Services.DOMRequest.fireSuccess(req, null);
|
||||
break;
|
||||
case "Webapps:RemoveReceipt:Return:KO":
|
||||
this.removeMessageListeners(["Webapps:RemoveReceipt:Return:OK",
|
||||
"Webapps:RemoveReceipt:Return:KO"]);
|
||||
Services.DOMRequest.fireError(req, msg.error);
|
||||
break;
|
||||
case "Webapps:ReplaceReceipt:Return:OK":
|
||||
this.removeMessageListeners(["Webapps:ReplaceReceipt:Return:OK",
|
||||
"Webapps:ReplaceReceipt:Return:KO"]);
|
||||
this.receipts = msg.receipts;
|
||||
Services.DOMRequest.fireSuccess(req, null);
|
||||
break;
|
||||
case "Webapps:ReplaceReceipt:Return:KO":
|
||||
this.removeMessageListeners(["Webapps:ReplaceReceipt:Return:OK",
|
||||
"Webapps:ReplaceReceipt:Return:KO"]);
|
||||
Services.DOMRequest.fireError(req, msg.error);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -15,3 +15,4 @@ support-files =
|
|||
[test_packaged_app_install.html]
|
||||
[test_packaged_app_update.html]
|
||||
[test_uninstall_errors.html]
|
||||
[test_receipt_operations.html]
|
||||
|
|
|
@ -0,0 +1,250 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id={757226}
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug {757226} Implement mozApps app.replaceReceipt</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id={757226}">Mozilla Bug {757226}</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript;version=1.7">
|
||||
|
||||
var gManifestURL = "http://test/tests/dom/apps/tests/file_app.sjs?apptype=hosted&getmanifest=true";
|
||||
var gGenerator = runTest();
|
||||
|
||||
function debug(aMsg) {
|
||||
//dump("== Tests debug == " + aMsg + "\n");
|
||||
}
|
||||
|
||||
function go() {
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ "type": "webapps-manage", "allow": 1, "context": document }],
|
||||
function() { gGenerator.next() });
|
||||
}
|
||||
|
||||
function continueTest() {
|
||||
try {
|
||||
gGenerator.next();
|
||||
} catch (e) {
|
||||
dump("Got exception: " + e + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
function finish() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function cbError(aError) {
|
||||
ok(false, "Error callback invoked " + aError);
|
||||
finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTest() {
|
||||
launchableValue = SpecialPowers.setAllAppsLaunchable(true);
|
||||
|
||||
SpecialPowers.autoConfirmAppInstall(continueTest);
|
||||
yield undefined;
|
||||
|
||||
var request = navigator.mozApps.install(gManifestURL);
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
yield undefined;
|
||||
|
||||
var app = request.result;
|
||||
ok(app, "App is non-null");
|
||||
ok(app.receipts.length == 0, "No receipts");
|
||||
|
||||
let receipt1 = 'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJwcm9kdWN0IjogeyJ1cmwiOiAiaHR0cHM6Ly93d3cubW96aWxsYS5vcmciLCAic3RvcmVkYXRhIjogIjUxNjkzMTQzNTY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idmFsdWUiOiAiMTkzMzI2LTVjMTUzNmQ1LWUxMDQtNDAzYy04NDBlLTQ5YjMyMmQ5Yjg4NSJ9LCAiZXhwIjogMTQwMTgyNTEyOCwgImlhdCI6IDEzODYxMDAzMjgsICJ0eXAiOiAicHVyY2hhc2UtcmVjZWlwdCIsICJuYmYiOiAxMzg2MTAwMzI4fQ.r2DVUpouRDJYqZe61LJBcIwmeF2mI8FmbGMRlfNFcinKAIs8nMVVNX8xSWJ6jXXgZ62VfHJCLHapADX8rCg6NgxFV_FdP7j2H_2Ufo0E0TREifTN6V4v1dCnzDulNhZmO8G-nQJUVOAtNfNC95PY7tVa8WC7dYXnKZsD6NhIxxVEtBGuiiySpWArI-g3pcl41rXNHHpJbRfrOD4QgVNrsV83TWILYRr6PWr3aqOM2XT_x2SzEfhBNvdG8AJmR0MKQytvfcgz3Vt1hMak88nFrzTLiKkuuPAXpwB5q83LZIl4EYG3UAnte4-XWlLb-NJ78vgXa64myy-3fPr7EO6LaQ';
|
||||
|
||||
// Test removeReceipt or replaceReceipt when there the app doesn't have any receipt
|
||||
request = app.replaceReceipt(receipt1, receipt3);
|
||||
request.onsuccess = function() {
|
||||
ok(false, "replaceReceipt should fail if the app doesn't have any receipt");
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "NO_SUCH_RECEIPT",
|
||||
"Request failed because there isn't any receipt");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
request = app.removeReceipt(receipt1);
|
||||
request.onsuccess = function() {
|
||||
ok(false, "removeReceipt should fail if the app doesn't have any receipt");
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "NO_SUCH_RECEIPT",
|
||||
"Request failed because there isn't any receipt");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
// Test addReceipt
|
||||
request = app.addReceipt(null);
|
||||
request.onsuccess = function() {
|
||||
ok(false, "Call with missing parameter should've failed");
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "INVALID_PARAMETERS",
|
||||
"Request failed because of a missing parameter");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
request = app.addReceipt(receipt1);
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = function() {
|
||||
ok(app.receipts.length == 1, "One receipt");
|
||||
ok(app.receipts[0] == receipt1, "Receipt correctly added");
|
||||
continueTest();
|
||||
};
|
||||
yield undefined;
|
||||
|
||||
request = app.addReceipt(receipt1);
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "RECEIPT_ALREADY_EXISTS",
|
||||
"Request failed because the receipt already exists");
|
||||
continueTest();
|
||||
};
|
||||
request.onsuccess = function() {
|
||||
ok(false, "addReceipt should fail if the receipt already exists");
|
||||
};
|
||||
yield undefined;
|
||||
|
||||
request = app.addReceipt(receipt2);
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = function() {
|
||||
ok(app.receipts.length == 2, "Two receipts");
|
||||
ok(app.receipts[0] == receipt1, "First receipt is still there");
|
||||
ok(app.receipts[1] == receipt2, "Second receipt correctly added");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
// Test replace receipts
|
||||
request = app.replaceReceipt(null, null);
|
||||
request.onsuccess = function() {
|
||||
ok(false, "Call with missing parameters should've failed");
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "INVALID_PARAMETERS",
|
||||
"Request failed because of missing parameters");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
request = app.replaceReceipt(null, receipt1);
|
||||
request.onsuccess = function() {
|
||||
ok(false, "Call with missing parameter should've failed");
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "INVALID_PARAMETERS",
|
||||
"Request failed because of a missing parameter");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
request = app.replaceReceipt(receipt1, null);
|
||||
request.onsuccess = function() {
|
||||
ok(false, "Call with missing parameter should've failed");
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "INVALID_PARAMETERS",
|
||||
"Request failed because of a missing parameter");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
request = app.replaceReceipt(receipt3, receipt1);
|
||||
request.onsuccess = function() {
|
||||
ok(false, "Call with non-existent receipt should've failed");
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "NO_SUCH_RECEIPT",
|
||||
"Exception thrown because of a non-existent receipt");
|
||||
ok(app.receipts.length == 2, "Two receipts");
|
||||
ok(app.receipts[0] == receipt1 && app.receipts[1] == receipt2,
|
||||
"No receipt was replaced");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
request = app.replaceReceipt(receipt1, receipt3);
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = function() {
|
||||
ok(app.receipts.length == 2, "Two receipts");
|
||||
ok(app.receipts[0] == receipt3, "First receipt was replaced");
|
||||
ok(app.receipts[1] == receipt2, "Second receipt wasn't replaced");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
// Test remove receipt
|
||||
request = app.removeReceipt(null);
|
||||
request.onsuccess = function() {
|
||||
ok(false, "Call with missing parameter should've failed");
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "INVALID_PARAMETERS",
|
||||
"Request failed because of a missing parameter");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
request = app.removeReceipt(receipt1);
|
||||
request.onsuccess = function() {
|
||||
ok(false, "Call with non-existent receipt should've failed");
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(this.error.name == "NO_SUCH_RECEIPT",
|
||||
"Exception thrown because of a non-existent receipt");
|
||||
ok(app.receipts.length == 2, "Two receipts");
|
||||
ok(app.receipts[0] == receipt3 && app.receipts[1] == receipt2,
|
||||
"No receipt was removed");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
request = app.removeReceipt(receipt3);
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = function() {
|
||||
ok(app.receipts.length == 1, "One receipt");
|
||||
ok(app.receipts[0] == receipt2, "The receipt is still alive");
|
||||
continueTest();
|
||||
}
|
||||
yield undefined;
|
||||
|
||||
// Uninstall the app.
|
||||
request = navigator.mozApps.mgmt.uninstall(app);
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
yield undefined;
|
||||
ok(true, "App uninstalled");
|
||||
|
||||
// All done.
|
||||
ok(true, "All done");
|
||||
finish();
|
||||
}
|
||||
|
||||
addLoadEvent(go);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -894,6 +894,16 @@ DeviceStorageFile::AppendRelativePath(const nsAString& aPath) {
|
|||
if (!mFile) {
|
||||
return;
|
||||
}
|
||||
if (!IsSafePath(aPath)) {
|
||||
// All of the APIs (in the child) do checks to verify that the path is
|
||||
// valid and return PERMISSION_DENIED if a non-safe path is entered.
|
||||
// This check is done in the parent and prevents a compromised
|
||||
// child from bypassing the check. It shouldn't be possible for this
|
||||
// code path to be taken with a non-compromised child.
|
||||
NS_WARNING("Unsafe path detected - ignoring");
|
||||
NS_WARNING(NS_LossyConvertUTF16toASCII(aPath).get());
|
||||
return;
|
||||
}
|
||||
#if defined(XP_WIN)
|
||||
// replace forward slashes with backslashes,
|
||||
// since nsLocalFileWin chokes on them
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
interface nsIDOMDOMRequest;
|
||||
|
||||
[scriptable, uuid(4081390c-08cf-11e3-9200-b3c0a8744b20)]
|
||||
[scriptable, uuid(f8cb08ed-588e-465f-b2b3-a4b0afde711a)]
|
||||
interface mozIDOMApplication : nsISupports
|
||||
{
|
||||
readonly attribute jsval manifest;
|
||||
|
@ -100,6 +100,11 @@ interface mozIDOMApplication : nsISupports
|
|||
[optional] in jsval rules); // nsISupports is a Promise.
|
||||
|
||||
nsISupports getConnections(); // nsISupports is a Promise.
|
||||
|
||||
/* Receipts handling functions */
|
||||
nsIDOMDOMRequest addReceipt(in DOMString receipt);
|
||||
nsIDOMDOMRequest removeReceipt(in DOMString receipt);
|
||||
nsIDOMDOMRequest replaceReceipt(in DOMString oldReceipt, in DOMString newReceipt);
|
||||
};
|
||||
|
||||
[scriptable, uuid(cf742022-5ba3-11e2-868f-03310341b006)]
|
||||
|
|
|
@ -165,12 +165,12 @@ WebappsActor.prototype = {
|
|||
reg.webapps[aId] = aApp;
|
||||
reg.updatePermissionsForApp(aId);
|
||||
|
||||
reg._readManifests([{ id: aId }], function(aResult) {
|
||||
reg._readManifests([{ id: aId }]).then((aResult) => {
|
||||
let manifest = aResult[0].manifest;
|
||||
aApp.name = manifest.name;
|
||||
reg.updateAppHandlers(null, manifest, aApp);
|
||||
|
||||
reg._saveApps(function() {
|
||||
reg._saveApps().then(() => {
|
||||
aApp.manifest = manifest;
|
||||
|
||||
// Needed to evict manifest cache on content side
|
||||
|
@ -264,17 +264,8 @@ WebappsActor.prototype = {
|
|||
if (aManifest) {
|
||||
return promise.resolve(aManifest);
|
||||
} else {
|
||||
let deferred = promise.defer();
|
||||
let manFile = aDir.clone();
|
||||
manFile.append("manifest.webapp");
|
||||
DOMApplicationRegistry._loadJSONAsync(manFile, function(aManifest) {
|
||||
if (!aManifest) {
|
||||
deferred.reject("Error parsing manifest.webapp.");
|
||||
} else {
|
||||
deferred.resolve(aManifest);
|
||||
}
|
||||
});
|
||||
return deferred.promise;
|
||||
let manFile = OS.Path.join(aDir.path, "manifest.webapp");
|
||||
return AppsUtils.loadJSONAsync(manFile);
|
||||
}
|
||||
}
|
||||
function checkSideloading(aManifest) {
|
||||
|
@ -285,13 +276,10 @@ WebappsActor.prototype = {
|
|||
// The destination directory for this app.
|
||||
let installDir = DOMApplicationRegistry._getAppDir(aId);
|
||||
if (aManifest) {
|
||||
let deferred = promise.defer();
|
||||
let manFile = installDir.clone();
|
||||
manFile.append("manifest.webapp");
|
||||
DOMApplicationRegistry._writeFile(manFile, JSON.stringify(aManifest), function () {
|
||||
deferred.resolve(aAppType);
|
||||
let manFile = OS.Path.join(installDir.path, "manifest.webapp");
|
||||
return DOMApplicationRegistry._writeFile(manFile, JSON.stringify(aManifest)).then(() => {
|
||||
return aAppType;
|
||||
});
|
||||
return deferred.promise;
|
||||
} else {
|
||||
let manFile = aDir.clone();
|
||||
manFile.append("manifest.webapp");
|
||||
|
@ -304,21 +292,16 @@ WebappsActor.prototype = {
|
|||
return { metadata: aMetadata, appType: aAppType };
|
||||
}
|
||||
// Read the origin and manifest url from metadata.json
|
||||
let deferred = promise.defer();
|
||||
let metaFile = aDir.clone();
|
||||
metaFile.append("metadata.json");
|
||||
DOMApplicationRegistry._loadJSONAsync(metaFile, function(aMetadata) {
|
||||
let metaFile = OS.Path.join(aDir.path, "metadata.json");
|
||||
return AppsUtils.loadJSONAsync(metaFile).then((aMetadata) => {
|
||||
if (!aMetadata) {
|
||||
deferred.reject("Error parsing metadata.json.");
|
||||
return;
|
||||
throw("Error parsing metadata.json.");
|
||||
}
|
||||
if (!aMetadata.origin) {
|
||||
deferred.reject("Missing 'origin' property in metadata.json");
|
||||
return;
|
||||
throw("Missing 'origin' property in metadata.json");
|
||||
}
|
||||
deferred.resolve({ metadata: aMetadata, appType: aAppType });
|
||||
return { metadata: aMetadata, appType: aAppType };
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
let runnable = {
|
||||
run: function run() {
|
||||
|
@ -645,7 +628,7 @@ WebappsActor.prototype = {
|
|||
let reg = DOMApplicationRegistry;
|
||||
let id = reg._appIdForManifestURL(aManifestURL);
|
||||
|
||||
reg._readManifests([{ id: id }], function (aResults) {
|
||||
reg._readManifests([{ id: id }]).then((aResults) => {
|
||||
deferred.resolve(aResults[0].manifest);
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче