mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 863337 - [homescreen] If an icon is changed in an update, it's not updated before the next reboot. r=fabrice, r=ferjm
This commit is contained in:
parent
59cbb438d9
commit
212dec808a
@ -525,9 +525,25 @@ WebappsApplication.prototype = {
|
||||
if (msg.manifestURL != this.manifestURL)
|
||||
return;
|
||||
|
||||
for (let prop in msg.app) {
|
||||
this[prop] = msg.app[prop];
|
||||
}
|
||||
manifestCache.evict(this.manifestURL, this.innerWindowID);
|
||||
|
||||
let hiddenProps = ["manifest", "updateManifest"];
|
||||
let updatableProps = ["installOrigin", "installTime", "installState",
|
||||
"lastUpdateCheck", "updateTime", "progress", "downloadAvailable",
|
||||
"downloading", "readyToApplyDownload", "downloadSize"];
|
||||
// Props that we don't update: origin, receipts, manifestURL, removable.
|
||||
|
||||
updatableProps.forEach(function(prop) {
|
||||
if (msg.app[prop]) {
|
||||
this[prop] = msg.app[prop];
|
||||
}
|
||||
}, this);
|
||||
|
||||
hiddenProps.forEach(function(prop) {
|
||||
if (msg.app[prop]) {
|
||||
this["_" + prop] = msg.app[prop];
|
||||
}
|
||||
}, this);
|
||||
|
||||
if (msg.event == "downloadapplied") {
|
||||
this._fireEvent("downloadapplied", this._ondownloadapplied);
|
||||
|
@ -1459,6 +1459,7 @@ this.DOMApplicationRegistry = {
|
||||
|
||||
app.name = manifest.name;
|
||||
app.csp = manifest.csp || "";
|
||||
app.updateTime = Date.now();
|
||||
} else {
|
||||
manifest = new ManifestHelper(aOldManifest, app.origin);
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
var gBasePath = "tests/dom/apps/tests/";
|
||||
var gAppTemplatePath = "tests/dom/apps/tests/file_app.template.html";
|
||||
var gAppcacheTemplatePath = "tests/dom/apps/tests/file_cached_app.template.appcache";
|
||||
var gDefaultIcon = "default_icon";
|
||||
|
||||
function makeResource(templatePath, version, apptype) {
|
||||
let icon = getState('icon') || gDefaultIcon;
|
||||
var res = readTemplate(templatePath).replace(/VERSIONTOKEN/g, version)
|
||||
.replace(/APPTYPETOKEN/g, apptype);
|
||||
.replace(/APPTYPETOKEN/g, apptype)
|
||||
.replace(/ICONTOKEN/g, icon);
|
||||
|
||||
// Hack - This is necessary to make the tests pass, but hbambas says it
|
||||
// shouldn't be necessary. Comment it out and watch the tests fail.
|
||||
@ -27,6 +30,20 @@ function handleRequest(request, response) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ("setIcon" in query) {
|
||||
let icon = query.setIcon;
|
||||
if (icon === 'DEFAULT') {
|
||||
icon = null;
|
||||
}
|
||||
|
||||
setState('icon', icon);
|
||||
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
response.setHeader("Access-Control-Allow-Origin", "*", false);
|
||||
response.write('OK');
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the app type.
|
||||
var apptype = query.apptype;
|
||||
if (apptype != 'hosted' && apptype != 'cached')
|
||||
|
@ -1,5 +1,8 @@
|
||||
{
|
||||
"name": "Really Rapid Release (hosted)",
|
||||
"description": "Updated even faster than <a href='http://mozilla.org'>Firefox</a>, just to annoy slashdotters.",
|
||||
"launch_path": "/tests/dom/apps/tests/file_app.sjs?apptype=hosted"
|
||||
"launch_path": "/tests/dom/apps/tests/file_app.sjs?apptype=hosted",
|
||||
"icons": {
|
||||
"128": "ICONTOKEN"
|
||||
}
|
||||
}
|
||||
|
@ -85,6 +85,31 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=826058
|
||||
checkAppState(app, true, 3, continueTest);
|
||||
yield;
|
||||
|
||||
// check for update
|
||||
var icons = app.manifest.icons;
|
||||
var oldIcon = icons[Object.keys(icons)[0]];
|
||||
var oldUpdateTime = app.updateTime;
|
||||
setAppIcon('new_icon', continueTest);
|
||||
yield;
|
||||
|
||||
app.ondownloadavailable = function() {
|
||||
ok(false, 'Got a downloadavailable event for non-cached hosted apps');
|
||||
};
|
||||
|
||||
app.ondownloadapplied = function() {
|
||||
ok(true, 'Got a downloadapplied when checking for update');
|
||||
app.ondownloadapplied = app.ondownloadavailable = null;
|
||||
continueTest();
|
||||
};
|
||||
app.checkForUpdate();
|
||||
yield;
|
||||
|
||||
icons = app.manifest.icons;
|
||||
var newIcon = icons[Object.keys(icons)[0]];
|
||||
var newUpdateTime = app.updateTime;
|
||||
isnot(oldIcon, newIcon, 'The icon should be updated');
|
||||
isnot(oldUpdateTime, newUpdateTime, 'The update time should be updated');
|
||||
|
||||
// Uninstall the app.
|
||||
request = navigator.mozApps.mgmt.uninstall(app);
|
||||
request.onerror = cbError;
|
||||
@ -157,6 +182,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=826058
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function setAppIcon(icon, cb) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", function() { is(xhr.responseText, "OK", "setIcon OK"); cb(); });
|
||||
xhr.addEventListener("error", cbError);
|
||||
xhr.addEventListener("abort", cbError);
|
||||
xhr.open('GET', gBaseURL + 'file_app.sjs?setIcon=' + icon, true);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
// This function checks the state of an installed app. It does the following:
|
||||
//
|
||||
// * Check various state on the app object itself.
|
||||
@ -199,6 +233,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=826058
|
||||
cb();
|
||||
}
|
||||
}
|
||||
|
||||
// This event is triggered when the app calls "alert".
|
||||
ifr.addEventListener('mozbrowsershowmodalprompt', listener, false);
|
||||
|
||||
// Add the iframe to the DOM, triggering the launch.
|
||||
@ -227,6 +263,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=826058
|
||||
</head>
|
||||
<body onload="go()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=826058">Mozilla Bug 826058</a>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=863337">Mozilla Bug 863337</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user