mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
c4d71010c8
- Bug 1200445 - Expose android native apps trough the navigator.mozApps api r=snorp,ferjm (5f2e5df93a)
- Bug 1199844 - limit webapp debug logging to webapp tests; r=fabrice (59bf73deb2)
- Bug 1199295 - Pass right loadingPrincipal to uriloader/prefetch - dom/apps (r=fabrice) (8bdab29703)
- Bug 1213170 - followup r=bustage on a CLOSED TREE (9ac5f0a677)
- Bug 1194243 - Keep the message manager alive in doUninstall() to be able to signal the result back; r=myk (3093189372)
- Bug 1154864 - Fix getScopeByLocalId use in PushService.jsm r=nsm (0f67e9de60)
- Bug 1196963 - Make extensions work without being in developer mode r=jduell (e120108628)
- Bug 1200851 - DataStoreService should update its permission map when the homescreen changes, r=fabrice (1582ac0320)
- Bug 1200851 - DataStoreService should update its permission map when the homescreen changes, r=fabrice (7949555b43)
- Bug 1186805 - Replace nsBaseHashtable::EnumerateRead() calls in dom/datastore/ with iterators, r=njn (0c6f234576)
- Bug 1208355 - Fix -Wshadow warnings in dom/datastore. r=baku (8b617685d4)
- Bug 1214092 - Part 1 of 1: Exposed WebSpeech API SpeechRecognition Interface to privileged apps. r=smaug (e33c92d4e8)
- Bug 1218337 - Part 1 of 1: Introduced permission 'speech-recognition' and used it in place of the app-check. r=smaug (1cdf67a55f)
- Bug 1051604 - Adapt VAD strategy on SpeechRecognition to be less strict on some devices with poor mics. r=smaug (911258b56e)
- Bug 1111135 - Part 1: Add audio-capture:3gpp perimission. r=fabrice (c98bee92a6)
- bit of 1196988 (a334242521)
- Bug 1193183 - Correctly implement SpeechRecognitionAlternative::confidence using ps_get_prob(). r=anatal (14a881b44f)
- Bug 1197455 - Call ps_set_search() only after successful grammar compilation. r=anatal (55d37ea0fb)
- Bug 1156560 - Prefer old CDMs on update if they are in use - r=cpearce (b763f1044a)
- Bug 1228215 - Add helper to do dir enumeration in GMPServiceParent. r=jwwang (1d3bc1eef0)
- Bug 1228215 - Store each GMP's storage and nodeId salt in separate directories. r=jwwang (20fb2b7a18)
- Bug 1172396 - Update GMP trial creation pref from chrome process - r=cpearce (123d97d03a)
- Bug 1228215 - Add a 'gmpName' parameter to GMPService::GetNodeId(), so each GMP can see a different nodeId for the same origin. r=jwwang (fceaef0c11)
- fixes for no EME (b70879a799)
- Bug 1228215 - Migrate existing GMP storage from post-42 pre-45 location to 45 location. r=jwwang (9da581744d)
- missing crash stuff (b537d416b3)
- Bug 1187193 - Use UserData() instead of Data() in ConstIter loops that used to be EnumerateRead's. r=njn (2a4c297f36)
- Bug 1211337 - Added crash report annotations tracking sync shutdown (60b3004394)
- Bug 1173195 - Don't assert success until successful in GMPSharedMemManager. r=edwin (3844ba6e20)
- Bug 1208289 - Log outstanding frames in GMP DrainComplete() and detect dropped ResetComplete. r=jwwang (eccf4dbecc)
- Bug 1224442: null-check GMP Parent Shmem messages from the Child to handle messages after shutdown r=cpearce (d12b9c57c2)
- add some defines (3c4fc2d5b9)
- Bug 1220929 - RemotePageManager should let us get all ports for a browser. r=Mossop (402fc2a536)
- Bug 1220929 - RemotePageManager should use documentURI and allow special URLs with query params. r=Mossop (9fc73b228e)
- Bug 1144422 - fix lightweight theme code to deal with invalid CSS so we don't mistakenly keep text colors, r=jaws (8b47394d6c)
- Bug 1229519: Fix download managers to pass eslint checks. r=mak (e4a684db58)
- Bug 1180113 - Introducing g2p algorithm inside pocketsphinx to allow out of dictionary words to be added to grammars. r=smaug (b3a23daf56)
- Bug 1202989 - Added check for 0 length phones string in addition to NULL. r=andrenatal (387faeb88c)
- Bug 1171082 - Now _WIN32_WINNT is defined to 0x0400 only if it is not defined, 0x0400 is the minimal version. Also modified update.sh to do this. r=smaug (bb7dd37c00)
- bits of Bug 1165518 - Part 2: Replace prlog.h with Logging.h. (fc0ca3ca20)
- Bug 1188970: Fix usage of forward slash in constructing webrtc trace file path. r=rjesup (8518b84be1)
- Bug 1225682 - Don't use nsAuto{,C}String as class member variables in docshell/. r=bz (839a57580e)
- Bug 1220916 - Remove "WARNING: TimelineConsumers could not be initialized" when running gtests, r=fitzgen (c89330afcc)
- Bug 1217836 - Add a readme file to our timeline backend, r=jsantell (df0ea6b198)
- enable shadow (dcad5bdb7a)
345 lines
11 KiB
HTML
345 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id={900533}
|
|
-->
|
|
<head>
|
|
<title>Test for Bug {900533} Packaged app update tests</title>
|
|
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="common.js"></script>
|
|
<script type="text/javascript" src="test_packaged_app_common.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={900533}">Mozilla Bug {900533}</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
"use strict";
|
|
|
|
function debug(aMsg) {
|
|
//dump("== Tests debug == " + aMsg + "\n");
|
|
}
|
|
|
|
var miniManifestURL;
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
SimpleTest.requestFlakyTimeout("untriaged");
|
|
|
|
function checkForUpdate(aExpected, aOnSuccess, aOnApplied, aOnDownloadError,
|
|
aLaunchDownload, aOnRequestError) {
|
|
var lApp = PackagedTestHelper.gApp;
|
|
|
|
lApp.ondownloadsuccess = aOnSuccess || null;
|
|
lApp.ondownloadapplied = aOnApplied || null;
|
|
lApp.ondownloaderror = aOnDownloadError || null;
|
|
|
|
var request = lApp.checkForUpdate();
|
|
request.onerror = aOnRequestError ? aOnRequestError.bind(undefined, request) :
|
|
PackagedTestHelper.mozAppsError;
|
|
request.onsuccess = function(event) {
|
|
var expectingDownload = aExpected ? "": "not ";
|
|
ok(lApp.downloadAvailable === aExpected,
|
|
"Download should " + expectingDownload + "be available");
|
|
if (aLaunchDownload) {
|
|
lApp.download();
|
|
} else {
|
|
PackagedTestHelper.next();
|
|
}
|
|
};
|
|
}
|
|
|
|
function checkLastAppState(aMiniManifestURL, aExpectedReady, aExpectedDownload,
|
|
aExpectedVersion, aCb) {
|
|
info(aExpectedReady ? "App downloaded" : "App download applied");
|
|
var expected = {
|
|
name: PackagedTestHelper.gAppName,
|
|
manifestURL: aMiniManifestURL,
|
|
installOrigin: PackagedTestHelper.gInstallOrigin,
|
|
progress: 0,
|
|
installState: aExpectedReady ? "updating" : "installed",
|
|
downloadAvailable: aExpectedDownload,
|
|
downloading: false,
|
|
size: 0,
|
|
readyToApplyDownload: aExpectedReady
|
|
};
|
|
|
|
PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, aExpectedVersion,
|
|
expected, true, false, aCb);
|
|
}
|
|
|
|
function updateApp(aExpectedReady, aPreviousVersion, aNextVersion, aFailOnError) {
|
|
var lApp = PackagedTestHelper.gApp;
|
|
|
|
var ondownloadappliedhandler =
|
|
checkLastAppState.bind(PackagedTestHelper, miniManifestURL, false, false,
|
|
aNextVersion,
|
|
setTimeout.bind(undefined, PackagedTestHelper.next, 500));
|
|
|
|
var ondownloadsuccesshandler =
|
|
checkLastAppState.bind(undefined, miniManifestURL,
|
|
aExpectedReady, false, aPreviousVersion,
|
|
function() {
|
|
navigator.mozApps.mgmt.applyDownload(lApp);
|
|
});
|
|
|
|
var ondownloaderrorhandler = aFailOnError ?
|
|
function() {
|
|
ok(false, "We should not get an error but got " +
|
|
lApp.downloadError.name);
|
|
PackagedTestHelper.finish();
|
|
} : null;
|
|
|
|
checkForUpdate(true, ondownloadsuccesshandler, ondownloadappliedhandler,
|
|
ondownloaderrorhandler, true);
|
|
|
|
}
|
|
|
|
var initialPermissionState = {
|
|
"geolocation": "prompt",
|
|
"audio-capture": "prompt",
|
|
"video-capture": "prompt",
|
|
"test-permission-read": "prompt",
|
|
"downloads": "deny"
|
|
}
|
|
|
|
var permissionsToSet = {
|
|
"geolocation": "allow",
|
|
"test-permission-read": "allow",
|
|
"audio-capture": "deny"
|
|
}
|
|
|
|
var permissionsToCheck = {
|
|
"geolocation": "allow",
|
|
"audio-capture": "deny",
|
|
"video-capture": "prompt",
|
|
"test-permission-read": "allow",
|
|
"downloads": "deny"
|
|
}
|
|
|
|
function validatePermissions(aList, aDontFail) {
|
|
var gApp = PackagedTestHelper.gApp;
|
|
var mozPermissions = window.navigator.mozPermissionSettings;
|
|
var permission;
|
|
for (permission in aList) {
|
|
var permValue = mozPermissions.get(permission, gApp.manifestURL,
|
|
gApp.origin, false);
|
|
var wouldFail = permValue != aList[permission];
|
|
var checkFun = (aDontFail && wouldFail) ? todo_is : is;
|
|
checkFun(permValue, aList[permission],
|
|
"Permission " + permission + " should be " + aList[permission]);
|
|
}
|
|
}
|
|
|
|
|
|
var steps = [
|
|
function() {
|
|
// Set up
|
|
SpecialPowers.setAllAppsLaunchable(true);
|
|
SpecialPowers.addPermission("webapps-manage", true, document);
|
|
info("Set up");
|
|
// Note that without useCurrentProfile the permissions just aren't added.
|
|
SpecialPowers.pushPermissions(
|
|
[{'type': 'permissions', 'allow': true, 'context': document}],
|
|
function() {
|
|
SpecialPowers.pushPrefEnv(
|
|
{"set": [["dom.mozPermissionSettings.enabled", true],
|
|
["dom.webapps.useCurrentProfile", true]]},
|
|
PackagedTestHelper.next);
|
|
}
|
|
);
|
|
},
|
|
function() {
|
|
info("autoConfirmAppInstall");
|
|
SpecialPowers.autoConfirmAppInstall(PackagedTestHelper.next);
|
|
},
|
|
function() {
|
|
PackagedTestHelper.setAppVersion(2, PackagedTestHelper.next);
|
|
},
|
|
function() {
|
|
info("== TEST == Install packaged app");
|
|
navigator.mozApps.mgmt.oninstall = function(evt) {
|
|
info("Got oninstall event");
|
|
PackagedTestHelper.gApp = evt.application;
|
|
PackagedTestHelper.gApp.ondownloaderror = function() {
|
|
ok(false, "Download error " + PackagedTestHelper.gApp.downloadError.name);
|
|
PackagedTestHelper.finish();
|
|
};
|
|
PackagedTestHelper.gApp.ondownloadsuccess =
|
|
checkLastAppState.bind(undefined, miniManifestURL, false, false,
|
|
"2", PackagedTestHelper.next);
|
|
};
|
|
|
|
var request = navigator.mozApps.installPackage(miniManifestURL);
|
|
request.onerror = PackagedTestHelper.mozAppsError;
|
|
request.onsuccess = function() {
|
|
info("Application installed");
|
|
};
|
|
},
|
|
function() {
|
|
info("== TEST == Permissions installed correctly");
|
|
validatePermissions(initialPermissionState);
|
|
PackagedTestHelper.next();
|
|
},
|
|
function() {
|
|
info("== TEST == Check for Update and try to download it without update available");
|
|
|
|
function onerror() {
|
|
is(PackagedTestHelper.gApp.downloadError.name, "NO_DOWNLOAD_AVAILABLE", "Download not available");
|
|
ok(!PackagedTestHelper.gApp.readyToApplyDownload, "Not ready to apply download");
|
|
PackagedTestHelper.next();
|
|
}
|
|
function onsuccess() {
|
|
ok(false, "ondownloadsuccess fired");
|
|
PackagedTestHelper.next();
|
|
}
|
|
|
|
checkForUpdate(false, onsuccess, null, onerror, true);
|
|
},
|
|
function() {
|
|
info("== TEST == Remember permissions");
|
|
var gApp = PackagedTestHelper.gApp;
|
|
var mozPermissions = window.navigator.mozPermissionSettings;
|
|
var permission;
|
|
for (permission in permissionsToSet) {
|
|
try {
|
|
window.navigator.mozPermissionSettings.set(permission,
|
|
permissionsToSet[permission],
|
|
gApp.manifestURL,
|
|
gApp.origin, false);
|
|
} catch (e) {
|
|
ok(false,
|
|
"mozPermissionSettings.set failed for " + permission + " - " + e);
|
|
}
|
|
}
|
|
PackagedTestHelper.next();
|
|
},
|
|
function() {
|
|
info("== TEST == Check that the permissions have been saved");
|
|
// Since the permission API isn't really synchronous, just log any errors
|
|
// here.
|
|
validatePermissions(permissionsToCheck, true /*dontFail*/);
|
|
PackagedTestHelper.next();
|
|
},
|
|
function() {
|
|
PackagedTestHelper.setAppVersion(3, PackagedTestHelper.next);
|
|
},
|
|
function() {
|
|
info("== TEST == Update packaged app");
|
|
updateApp(true, "2", "3");
|
|
},
|
|
function() {
|
|
info("== TEST == Check that saved permissions were kept");
|
|
validatePermissions(permissionsToCheck);
|
|
PackagedTestHelper.next();
|
|
},
|
|
function() {
|
|
info("== TEST == Check for Update after getting a new package");
|
|
checkForUpdate(false);
|
|
},
|
|
function() {
|
|
PackagedTestHelper.setAppVersion(4, PackagedTestHelper.next, true);
|
|
},
|
|
function() {
|
|
info("== TEST == Update packaged app - same package");
|
|
updateApp(false, 3, 3, true);
|
|
},
|
|
function() {
|
|
info("== TEST == Check for Update after getting the same package");
|
|
checkForUpdate(false);
|
|
},
|
|
|
|
function() {
|
|
PackagedTestHelper.setAppVersion(5, PackagedTestHelper.next,
|
|
/* aDontUpdatePackage */ false,
|
|
/* aAllowCancel */ false,
|
|
/* aRole */ undefined,
|
|
/* aFailOnce */ true);
|
|
|
|
},
|
|
function() {
|
|
info("== TEST == Update packaged app - fail the update once");
|
|
|
|
var downloadSuccess = function() {
|
|
ok(false, "We got an unexpected downloadsuccess or downloadapplied");
|
|
PackagedTestHelper.finish();
|
|
};
|
|
var downloadError = function() {
|
|
info("We got an expected download error: " +
|
|
PackagedTestHelper.gApp.downloadError.name);
|
|
PackagedTestHelper.next();
|
|
};
|
|
checkForUpdate(true, downloadSuccess, downloadSuccess, downloadError,
|
|
/* aLaunchDownload */ true);
|
|
},
|
|
function() {
|
|
info("=== TEST == Update packaged app - apply the update after failing");
|
|
var lApp = PackagedTestHelper.gApp;
|
|
lApp.ondownloadsuccess = function() {
|
|
info("Download succeeded, applying it");
|
|
navigator.mozApps.mgmt.applyDownload(lApp);
|
|
};
|
|
lApp.ondownloadapplied = function() {
|
|
info("Download successfuly applied");
|
|
PackagedTestHelper.next();
|
|
};
|
|
lApp.ondownloaderror = function() {
|
|
ok(false, "Got an unexpected error: " + lApp.downloaderror.name);
|
|
PackagedTestHelper.finish();
|
|
};
|
|
lApp.download();
|
|
},
|
|
function() {
|
|
info("== TEST == Check for Update applying a previously failed package");
|
|
checkForUpdate(false);
|
|
},
|
|
|
|
function() {
|
|
PackagedTestHelper.setAppVersion(1, PackagedTestHelper.next);
|
|
},
|
|
function() {
|
|
info("== TEST == Update packaged app - Updating a pending app");
|
|
miniManifestURL = PackagedTestHelper.gSJS +
|
|
"?getManifest=true" +
|
|
"&appName=arandomname" +
|
|
"&appToFail1";
|
|
PackagedTestHelper.checkAppDownloadError(miniManifestURL,
|
|
"MANIFEST_MISMATCH", 1, false, true,
|
|
"arandomname",
|
|
function () {
|
|
checkForUpdate(false, null, null, null, false,
|
|
function (request) {
|
|
if (request.error.name === "PENDING_APP_NOT_UPDATABLE") {
|
|
info("Got expected PENDING_APP_NOT_UPDATEABLE");
|
|
} else {
|
|
ok(false, "Got unexpected " + request.error.name);
|
|
}
|
|
PackagedTestHelper.next();
|
|
});
|
|
});
|
|
},
|
|
function() {
|
|
info("all done!\n");
|
|
PackagedTestHelper.finish();
|
|
}
|
|
];
|
|
|
|
PackagedTestHelper.setSteps(steps);
|
|
// appToUpdate added to the URL so we get a unique URL for this app.
|
|
// Unique in this case meaning different from the ones used on the
|
|
// install tests
|
|
miniManifestURL = PackagedTestHelper.gSJS + "?getManifest=true&appToUpdate";
|
|
|
|
addLoadEvent(() => prepareEnv(() => PackagedTestHelper.start()));
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|