mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 556dc4f97e08 (bug 1072090) for m-oth orange
This commit is contained in:
parent
55c352d8fe
commit
f1e72c526f
@ -107,7 +107,6 @@ function _setAppProperties(aObj, aApp) {
|
||||
aObj.redirects = aApp.redirects;
|
||||
aObj.widgetPages = aApp.widgetPages || [];
|
||||
aObj.kind = aApp.kind;
|
||||
aObj.enabled = aApp.enabled !== undefined ? aApp.enabled : true;
|
||||
}
|
||||
|
||||
this.AppsUtils = {
|
||||
|
@ -424,10 +424,6 @@ WebappsApplication.prototype = {
|
||||
return new this._window.DOMError(this._proxy.downloadError);
|
||||
},
|
||||
|
||||
get enabled() {
|
||||
return this._proxy.enabled;
|
||||
},
|
||||
|
||||
download: function() {
|
||||
cpmm.sendAsyncMessage("Webapps:Download",
|
||||
{ manifestURL: this.manifestURL });
|
||||
@ -617,7 +613,7 @@ WebappsApplication.prototype = {
|
||||
case "Webapps:Launch:Return:KO":
|
||||
this.removeMessageListeners(["Webapps:Launch:Return:OK",
|
||||
"Webapps:Launch:Return:KO"]);
|
||||
Services.DOMRequest.fireError(req, msg.error);
|
||||
Services.DOMRequest.fireError(req, "APP_INSTALL_PENDING");
|
||||
break;
|
||||
case "Webapps:Launch:Return:OK":
|
||||
this.removeMessageListeners(["Webapps:Launch:Return:OK",
|
||||
@ -726,14 +722,12 @@ WebappsApplicationMgmt.prototype = {
|
||||
"Webapps:Install:Return:OK",
|
||||
"Webapps:GetNotInstalled:Return:OK",
|
||||
"Webapps:Import:Return",
|
||||
"Webapps:ExtractManifest:Return",
|
||||
"Webapps:SetEnabled:Return"]);
|
||||
"Webapps:ExtractManifest:Return"]);
|
||||
cpmm.sendAsyncMessage("Webapps:RegisterForMessages",
|
||||
{
|
||||
messages: ["Webapps:Install:Return:OK",
|
||||
"Webapps:Uninstall:Return:OK",
|
||||
"Webapps:Uninstall:Broadcast:Return:OK",
|
||||
"Webapps:SetEnabled:Return"]
|
||||
"Webapps:Uninstall:Broadcast:Return:OK"]
|
||||
}
|
||||
);
|
||||
},
|
||||
@ -742,8 +736,7 @@ WebappsApplicationMgmt.prototype = {
|
||||
cpmm.sendAsyncMessage("Webapps:UnregisterForMessages",
|
||||
["Webapps:Install:Return:OK",
|
||||
"Webapps:Uninstall:Return:OK",
|
||||
"Webapps:Uninstall:Broadcast:Return:OK",
|
||||
"Webapps:SetEnabled:Return"]);
|
||||
"Webapps:Uninstall:Broadcast:Return:OK"]);
|
||||
},
|
||||
|
||||
applyDownload: function(aApp) {
|
||||
@ -811,12 +804,6 @@ WebappsApplicationMgmt.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
setEnabled: function(aApp, aValue) {
|
||||
cpmm.sendAsyncMessage("Webapps:SetEnabled",
|
||||
{ manifestURL: aApp.manifestURL,
|
||||
enabled: aValue });
|
||||
},
|
||||
|
||||
get oninstall() {
|
||||
return this.__DOM_IMPL__.getEventHandler("oninstall");
|
||||
},
|
||||
@ -825,10 +812,6 @@ WebappsApplicationMgmt.prototype = {
|
||||
return this.__DOM_IMPL__.getEventHandler("onuninstall");
|
||||
},
|
||||
|
||||
get onenabledstatechange() {
|
||||
return this.__DOM_IMPL__.getEventHandler("onenabledstatechange");
|
||||
},
|
||||
|
||||
set oninstall(aCallback) {
|
||||
this.__DOM_IMPL__.setEventHandler("oninstall", aCallback);
|
||||
},
|
||||
@ -837,14 +820,9 @@ WebappsApplicationMgmt.prototype = {
|
||||
this.__DOM_IMPL__.setEventHandler("onuninstall", aCallback);
|
||||
},
|
||||
|
||||
set onenabledstatechange(aCallback) {
|
||||
this.__DOM_IMPL__.setEventHandler("onenabledstatechange", aCallback);
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
let msg = aMessage.data;
|
||||
let req;
|
||||
|
||||
if (["Webapps:Import:Return",
|
||||
"Webapps:ExtractManifest:Return"]
|
||||
.indexOf(aMessage.name) != -1) {
|
||||
@ -853,13 +831,11 @@ WebappsApplicationMgmt.prototype = {
|
||||
req = this.getRequest(msg.requestID);
|
||||
}
|
||||
|
||||
// We want Webapps:Install:Return:OK, Webapps:Uninstall:Broadcast:Return:OK
|
||||
// and Webapps:SetEnabled:Return
|
||||
// We want Webapps:Install:Return:OK and Webapps:Uninstall:Broadcast:Return:OK
|
||||
// to be broadcasted to all instances of mozApps.mgmt.
|
||||
if (!((msg.oid == this._id && req) ||
|
||||
aMessage.name == "Webapps:Install:Return:OK" ||
|
||||
aMessage.name == "Webapps:Uninstall:Broadcast:Return:OK" ||
|
||||
aMessage.name == "Webapps:SetEnabled:Return")) {
|
||||
aMessage.name == "Webapps:Uninstall:Broadcast:Return:OK")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -903,14 +879,6 @@ WebappsApplicationMgmt.prototype = {
|
||||
req.reject(new this._window.DOMError(msg.error || ""));
|
||||
}
|
||||
break;
|
||||
case "Webapps:SetEnabled:Return":
|
||||
{
|
||||
let app = createContentApplicationObject(this._window, msg);
|
||||
let event =
|
||||
new this._window.MozApplicationEvent("enabledstatechange", { application : app });
|
||||
this.__DOM_IMPL__.dispatchEvent(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (aMessage.name !== "Webapps:Uninstall:Broadcast:Return:OK") {
|
||||
this.removeRequest(msg.requestID);
|
||||
|
@ -173,30 +173,20 @@ this.DOMApplicationRegistry = {
|
||||
dirKey: DIRECTORY_NAME,
|
||||
|
||||
init: function() {
|
||||
this.messages = ["Webapps:Install",
|
||||
"Webapps:Uninstall",
|
||||
"Webapps:GetSelf",
|
||||
"Webapps:CheckInstalled",
|
||||
"Webapps:GetInstalled",
|
||||
"Webapps:GetNotInstalled",
|
||||
this.messages = ["Webapps:Install", "Webapps:Uninstall",
|
||||
"Webapps:GetSelf", "Webapps:CheckInstalled",
|
||||
"Webapps:GetInstalled", "Webapps:GetNotInstalled",
|
||||
"Webapps:Launch",
|
||||
"Webapps:InstallPackage",
|
||||
"Webapps:GetList",
|
||||
"Webapps:RegisterForMessages",
|
||||
"Webapps:GetList", "Webapps:RegisterForMessages",
|
||||
"Webapps:UnregisterForMessages",
|
||||
"Webapps:CancelDownload",
|
||||
"Webapps:CheckForUpdate",
|
||||
"Webapps:Download",
|
||||
"Webapps:ApplyDownload",
|
||||
"Webapps:Install:Return:Ack",
|
||||
"Webapps:AddReceipt",
|
||||
"Webapps:RemoveReceipt",
|
||||
"Webapps:ReplaceReceipt",
|
||||
"Webapps:CancelDownload", "Webapps:CheckForUpdate",
|
||||
"Webapps:Download", "Webapps:ApplyDownload",
|
||||
"Webapps:Install:Return:Ack", "Webapps:AddReceipt",
|
||||
"Webapps:RemoveReceipt", "Webapps:ReplaceReceipt",
|
||||
"Webapps:RegisterBEP",
|
||||
"Webapps:Export",
|
||||
"Webapps:Import",
|
||||
"Webapps:Export", "Webapps:Import",
|
||||
"Webapps:ExtractManifest",
|
||||
"Webapps:SetEnabled",
|
||||
"child-process-shutdown"];
|
||||
|
||||
this.frameMessages = ["Webapps:ClearBrowserData"];
|
||||
@ -293,10 +283,6 @@ this.DOMApplicationRegistry = {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (app.enabled === undefined) {
|
||||
app.enabled = true;
|
||||
}
|
||||
|
||||
// At startup we can't be downloading, and the $TMP directory
|
||||
// will be empty so we can't just apply a staged update.
|
||||
app.downloading = false;
|
||||
@ -1195,14 +1181,13 @@ this.DOMApplicationRegistry = {
|
||||
Services.prefs.setBoolPref("dom.mozApps.used", true);
|
||||
|
||||
// We need to check permissions for calls coming from mozApps.mgmt.
|
||||
// These are: getNotInstalled(), applyDownload(), uninstall(), import(),
|
||||
// extractManifest(), setEnabled().
|
||||
// These are: getNotInstalled(), applyDownload(), uninstall(), import() and
|
||||
// extractManifest().
|
||||
if (["Webapps:GetNotInstalled",
|
||||
"Webapps:ApplyDownload",
|
||||
"Webapps:Uninstall",
|
||||
"Webapps:Import",
|
||||
"Webapps:ExtractManifest",
|
||||
"Webapps:SetEnabled"].indexOf(aMessage.name) != -1) {
|
||||
"Webapps:ExtractManifest"].indexOf(aMessage.name) != -1) {
|
||||
if (!aMessage.target.assertPermission("webapps-manage")) {
|
||||
debug("mozApps message " + aMessage.name +
|
||||
" from a content process with no 'webapps-manage' privileges.");
|
||||
@ -1337,9 +1322,6 @@ this.DOMApplicationRegistry = {
|
||||
case "Webapps:ExtractManifest":
|
||||
this.doExtractManifest(msg, mm);
|
||||
break;
|
||||
case "Webapps:SetEnabled":
|
||||
this.setEnabled(msg);
|
||||
break;
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -1552,7 +1534,6 @@ this.DOMApplicationRegistry = {
|
||||
aMm.sendAsyncMessage("Webapps:Launch:Return:OK", aData);
|
||||
},
|
||||
function onfailure(reason) {
|
||||
aData.error = reason;
|
||||
aMm.sendAsyncMessage("Webapps:Launch:Return:KO", aData);
|
||||
}
|
||||
);
|
||||
@ -4318,25 +4299,6 @@ this.DOMApplicationRegistry = {
|
||||
});
|
||||
},
|
||||
|
||||
setEnabled: function(aData) {
|
||||
debug("setEnabled " + aData.manifestURL + " : " + aData.enabled);
|
||||
let id = this._appIdForManifestURL(aData.manifestURL);
|
||||
if (!id || !this.webapps[id]) {
|
||||
return;
|
||||
}
|
||||
|
||||
debug("Enabling " + id);
|
||||
let app = this.webapps[id];
|
||||
app.enabled = aData.enabled;
|
||||
this._saveApps().then(() => {
|
||||
DOMApplicationRegistry.broadcastMessage("Webapps:UpdateState", {
|
||||
app: app,
|
||||
id: app.id
|
||||
});
|
||||
this.broadcastMessage("Webapps:SetEnabled:Return", app);
|
||||
});
|
||||
},
|
||||
|
||||
getManifestFor: function(aManifestURL) {
|
||||
let id = this._appIdForManifestURL(aManifestURL);
|
||||
let app = this.webapps[id];
|
||||
|
@ -22,7 +22,6 @@ support-files =
|
||||
marketplace/*
|
||||
pkg_install_iframe.html
|
||||
|
||||
[test_app_enabled.html]
|
||||
[test_app_update.html]
|
||||
[test_bug_795164.html]
|
||||
[test_import_export.html]
|
||||
|
@ -1,129 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id={1XXXXXX}
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug {1072090}</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={1072090}">Mozilla Bug {1072090}</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 go() {
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ "type": "webapps-manage", "allow": 1, "context": document }],
|
||||
function() { gGenerator.next() });
|
||||
}
|
||||
|
||||
function continueTest() {
|
||||
try {
|
||||
gGenerator.next();
|
||||
} catch (e if e instanceof StopIteration) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
function finish() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function cbError(aEvent) {
|
||||
ok(false, "Error callback invoked " +
|
||||
aEvent.target.error.name + " " + aEvent.target.error.message);
|
||||
finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
/**
|
||||
* Flip the `enabled` state of an app back and forth.
|
||||
*/
|
||||
function runTest() {
|
||||
SpecialPowers.setAllAppsLaunchable(true);
|
||||
|
||||
SpecialPowers.autoConfirmAppInstall(continueTest);
|
||||
yield undefined;
|
||||
|
||||
SpecialPowers.autoConfirmAppUninstall(continueTest);
|
||||
yield undefined;
|
||||
|
||||
request = navigator.mozApps.mgmt.getAll();
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
yield undefined;
|
||||
var initialAppsCount = request.result.length;
|
||||
info("Starting with " + initialAppsCount + " apps installed.");
|
||||
|
||||
var request = navigator.mozApps.install(gManifestURL, { });
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
yield undefined;
|
||||
|
||||
var app = request.result;
|
||||
ok(app, "App is non-null");
|
||||
is(app.manifestURL, gManifestURL, "App manifest url is correct.");
|
||||
is(app.enabled, true, "App is enabled by default after install.");
|
||||
|
||||
// Switch the app to disabled.
|
||||
navigator.mozApps.mgmt.onenabledstatechange = function(event) {
|
||||
ok(true, "onenabledstatechange received");
|
||||
is(event.application.enabled, false, "Application is disabled");
|
||||
is(app.enabled, false, "Application is disabled");
|
||||
continueTest();
|
||||
}
|
||||
|
||||
navigator.mozApps.mgmt.setEnabled(app, false);
|
||||
yield undefined;
|
||||
|
||||
// Re-enable the app.
|
||||
navigator.mozApps.mgmt.onenabledstatechange = function(event) {
|
||||
ok(true, "onenabledstatechange received");
|
||||
is(event.application.enabled, true, "Application is enabled");
|
||||
is(app.enabled, true, "Application is enabled");
|
||||
continueTest();
|
||||
}
|
||||
|
||||
navigator.mozApps.mgmt.setEnabled(app, true);
|
||||
yield undefined;
|
||||
|
||||
navigator.mozApps.mgmt.onuninstall = function(event) {
|
||||
var app = event.application;
|
||||
is(app.manifestURL, gManifestURL, "App uninstall event ok.");
|
||||
is(app.manifest.name, "Really Rapid Release (hosted)",
|
||||
"App uninstall manifest ok.");
|
||||
continueTest();
|
||||
}
|
||||
request = navigator.mozApps.mgmt.uninstall(app);
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
yield undefined;
|
||||
yield undefined;
|
||||
is(request.result, gManifestURL, "App uninstalled.");
|
||||
navigator.mozApps.mgmt.onuninstall = null;
|
||||
|
||||
request = navigator.mozApps.mgmt.getAll();
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
yield undefined;
|
||||
is(request.result.length, initialAppsCount, "All apps are uninstalled.");
|
||||
}
|
||||
|
||||
addLoadEvent(go);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -77,7 +77,7 @@ function cbError(aEvent) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
/**
|
||||
* Test exporting and importing hosted and packaged apps.
|
||||
* Install 2 apps from the same origin and uninstall them.
|
||||
*/
|
||||
function runTest() {
|
||||
SpecialPowers.setAllAppsLaunchable(true);
|
||||
|
@ -44,13 +44,11 @@ var mgmtProps = {
|
||||
uninstall: "function",
|
||||
oninstall: "object",
|
||||
onuninstall: "object",
|
||||
onstatechange: "object",
|
||||
ownerGlobal: "object",
|
||||
removeEventListener: "function",
|
||||
setEventHandler: "function",
|
||||
extractManifest: "function",
|
||||
import: "function",
|
||||
setEnabled: "function"
|
||||
import: "function"
|
||||
};
|
||||
|
||||
isDeeply([p for (p in navigator.mozApps.mgmt)].sort(),
|
||||
|
@ -32,7 +32,6 @@ interface DOMApplication : EventTarget {
|
||||
readonly attribute DOMString installOrigin;
|
||||
readonly attribute DOMTimeStamp installTime;
|
||||
readonly attribute boolean removable;
|
||||
readonly attribute boolean enabled;
|
||||
|
||||
[Cached, Pure]
|
||||
readonly attribute sequence<DOMString> receipts;
|
||||
@ -97,9 +96,6 @@ interface DOMApplicationsManager : EventTarget {
|
||||
Promise<DOMApplication> import(Blob blob);
|
||||
Promise<any> extractManifest(Blob blob);
|
||||
|
||||
void setEnabled(DOMApplication app, boolean state);
|
||||
|
||||
attribute EventHandler oninstall;
|
||||
attribute EventHandler onuninstall;
|
||||
attribute EventHandler onenabledstatechange;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user