зеркало из https://github.com/mozilla/gecko-dev.git
Back out c51c5db7903f (bug 679194) since I'm backing out the cset that it stacks on top of
This commit is contained in:
Родитель
8d812655b7
Коммит
2410af5111
|
@ -211,7 +211,7 @@ var PageActions = {
|
|||
},
|
||||
|
||||
// Permissions we track in Page Actions
|
||||
_permissions: ["popup", "offline-app", "geolocation", "desktop-notification", "openWebappsList", "openWebappsUninstall"],
|
||||
_permissions: ["popup", "offline-app", "geolocation", "desktop-notification"],
|
||||
|
||||
_forEachPermissions: function _forEachPermissions(aHost, aCallback) {
|
||||
let pm = Services.perms;
|
||||
|
@ -1734,37 +1734,6 @@ var WebappsUI = {
|
|||
return app;
|
||||
},
|
||||
|
||||
askPermission: function(aMessage, aType, aCallbacks) {
|
||||
let uri = Services.io.newURI(aMessage.json.from, null, null);
|
||||
let perm = Services.perms.testExactPermission(uri, aType);
|
||||
switch(perm) {
|
||||
case Ci.nsIPermissionManager.ALLOW_ACTION:
|
||||
aCallbacks.allow();
|
||||
return;
|
||||
case Ci.nsIPermissionManager.DENY_ACTION:
|
||||
aCallbacks.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
let prompt = Cc["@mozilla.org/content-permission/prompt;1"].createInstance(Ci.nsIContentPermissionPrompt);
|
||||
|
||||
prompt.prompt({
|
||||
type: aType,
|
||||
uri: uri,
|
||||
window: null,
|
||||
element: aMessage.target,
|
||||
|
||||
cancel: function() {
|
||||
aCallbacks.cancel();
|
||||
},
|
||||
|
||||
allow: function() {
|
||||
Services.perms.add(uri, aType, Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
aCallbacks.allow();
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
let browser = aMessage.target;
|
||||
switch(aMessage.name) {
|
||||
|
@ -1783,18 +1752,9 @@ var WebappsUI = {
|
|||
{ installed: app != null, app: app, callbackID: aMessage.json.callbackID });
|
||||
break;
|
||||
case "OpenWebapps:MgmtList":
|
||||
this.askPermission(aMessage, "openWebappsList", {
|
||||
cancel: function() {
|
||||
browser.messageManager.sendAsyncMessage("OpenWebapps:MgmtList:Return",
|
||||
{ ok: false, callbackID: aMessage.json.callbackID });
|
||||
},
|
||||
|
||||
allow: function() {
|
||||
let list = OpenWebapps.mgmtList();
|
||||
browser.messageManager.sendAsyncMessage("OpenWebapps:MgmtList:Return",
|
||||
{ ok: true, apps: list, callbackID: aMessage.json.callbackID });
|
||||
}
|
||||
});
|
||||
let list = OpenWebapps.mgmtList();
|
||||
browser.messageManager.sendAsyncMessage("OpenWebapps:MgmtList:Return",
|
||||
{ ok: true, apps: list, callbackID: aMessage.json.callbackID });
|
||||
break;
|
||||
case "OpenWebapps:MgmtLaunch":
|
||||
let res = OpenWebapps.mgmtLaunch(aMessage.json.origin);
|
||||
|
@ -1802,19 +1762,9 @@ var WebappsUI = {
|
|||
{ ok: res, callbackID: aMessage.json.callbackID });
|
||||
break;
|
||||
case "OpenWebapps:MgmtUninstall":
|
||||
this.askPermission(aMessage, "openWebappsUninstall", {
|
||||
cancel: function() {
|
||||
browser.messageManager.sendAsyncMessage("OpenWebapps:MgmtUninstall:Return",
|
||||
{ ok: false, callbackID: aMessage.json.callbackID });
|
||||
},
|
||||
|
||||
allow: function() {
|
||||
let uninstalled = OpenWebapps.mgmtUninstall(aMessage.json.origin);
|
||||
browser.messageManager.sendAsyncMessage("OpenWebapps:MgmtUninstall:Return",
|
||||
{ ok: uninstalled, callbackID: aMessage.json.callbackID });
|
||||
}
|
||||
});
|
||||
|
||||
let uninstalled = OpenWebapps.mgmtUninstall(aMessage.json.origin);
|
||||
browser.messageManager.sendAsyncMessage("OpenWebapps:MgmtUninstall:Return",
|
||||
{ ok: uninstalled, callbackID: aMessage.json.callbackID });
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1581,27 +1581,27 @@ let OpenWebapps = {
|
|||
|
||||
xhr.send(null);
|
||||
},
|
||||
|
||||
|
||||
amInstalled: function(aAppURI, aSuccessCallback, aErrorCallback) {
|
||||
sendAsyncMessage("OpenWebapps:AmInstalled", { appURI: aAppURI, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
|
||||
},
|
||||
|
||||
|
||||
getInstalledBy: function(aStoreURI, aSuccessCallback, aErrorCallback) {
|
||||
sendAsyncMessage("OpenWebapps:GetInstalledBy", { storeURI: aStoreURI.href, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
|
||||
},
|
||||
|
||||
|
||||
mgmtLaunch: function(aOrigin, aSuccessCallback, aErrorCallback) {
|
||||
sendAsyncMessage("OpenWebapps:MgmtLaunch", { origin: aOrigin, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
|
||||
},
|
||||
|
||||
mgmtList: function(aFrom, aSuccessCallback, aErrorCallback) {
|
||||
sendAsyncMessage("OpenWebapps:MgmtList", { from: aFrom.href, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
|
||||
|
||||
mgmtList: function(aSuccessCallback, aErrorCallback) {
|
||||
sendAsyncMessage("OpenWebapps:MgmtList", { callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
|
||||
},
|
||||
|
||||
mgmtUninstall: function(aFrom, aOrigin, aSuccessCallback, aErrorCallback) {
|
||||
sendAsyncMessage("OpenWebapps:MgmtUninstall", { from: aFrom.href, origin: aOrigin, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
|
||||
|
||||
mgmtUninstall: function(aOrigin, aSuccessCallback, aErrorCallback) {
|
||||
sendAsyncMessage("OpenWebapps:MgmtUninstall", { origin: aOrigin, callbackID: OpenWebapps.getCallbackId({ success: aSuccessCallback, error: aErrorCallback }) });
|
||||
},
|
||||
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
let msg = aMessage.json;
|
||||
let callbacks = OpenWebapps.getCallback(msg.callbackID);
|
||||
|
@ -1680,12 +1680,12 @@ let OpenWebapps = {
|
|||
OpenWebapps.mgmtLaunch(aOrigin, aSuccessCallback, aErrorCallback);
|
||||
}, "OpenWebappsMgmt_launch");
|
||||
|
||||
sandbox.importFunction(function(aFrom, aSuccessCallback, aErrorCallback) {
|
||||
OpenWebapps.mgmtList(aFrom, aSuccessCallback, aErrorCallback);
|
||||
sandbox.importFunction(function(aSuccessCallback, aErrorCallback) {
|
||||
OpenWebapps.mgmtList(aSuccessCallback, aErrorCallback);
|
||||
}, "OpenWebappsMgmt_list");
|
||||
|
||||
sandbox.importFunction(function(aFrom, aOrigin, aSuccessCallback, aErrorCallback) {
|
||||
OpenWebapps.mgmtUninstall(aFrom, aOrigin, aSuccessCallback, aErrorCallback);
|
||||
sandbox.importFunction(function(aOrigin, aSuccessCallback, aErrorCallback) {
|
||||
OpenWebapps.mgmtUninstall(aOrigin, aSuccessCallback, aErrorCallback);
|
||||
}, "OpenWebappsMgmt_uninstall");
|
||||
|
||||
let toInject = OpenWebapps.getInjected();
|
||||
|
|
|
@ -56,11 +56,11 @@ if (window && window.navigator) {
|
|||
},
|
||||
|
||||
list: function(aSuccessCallback, aErrorCallback) {
|
||||
return OpenWebappsMgmt_list(window.location, aSuccessCallback, aErrorCallback);
|
||||
return OpenWebappsMgmt_list(aSuccessCallback, aErrorCallback);
|
||||
},
|
||||
|
||||
uninstall: function(aOrigin, aSuccessCallback, aErrorCallback) {
|
||||
return OpenWebappsMgmt_uninstall(window.location, aOrigin, aSuccessCallback, aErrorCallback);
|
||||
return OpenWebappsMgmt_uninstall(aOrigin, aSuccessCallback, aErrorCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@ function setPagePermission(type, uri, allow) {
|
|||
}
|
||||
|
||||
const kEntities = { "geolocation": "geolocation", "desktop-notification": "desktopNotification",
|
||||
"indexedDB": "offlineApps", "indexedDBQuota": "indexedDBQuota",
|
||||
"openWebappsList": "openWebappsList", "openWebappsUninstall": "openWebappsUninstall"};
|
||||
"indexedDB": "offlineApps", "indexedDBQuota": "indexedDBQuota" };
|
||||
|
||||
function ContentPermissionPrompt() {}
|
||||
|
||||
|
|
|
@ -173,14 +173,6 @@ indexedDBQuota.allow=Allow
|
|||
indexedDBQuota.dontAllow=Don't Allow
|
||||
indexedDBQuota.wantsTo=%S wants to store a lot of data on your device for offline use.
|
||||
|
||||
# Open Web Apps management API
|
||||
openWebappsUninstall.allow=Allow
|
||||
openWebappsUninstall.dontAllow=Don't Allow
|
||||
openWebappsUninstall.wantsTo=%S wants to uninstall an application on your device.
|
||||
openWebappsList.allow=Allow
|
||||
openWebappsList.dontAllow=Don't Allow
|
||||
openWebappsList.wantsTo=%S wants to retrieve the list of applications on you device.
|
||||
|
||||
# Bookmark List
|
||||
bookmarkList.desktop=Desktop Bookmarks
|
||||
|
||||
|
@ -214,8 +206,6 @@ pageactions.popup=Popups
|
|||
pageactions.offline-app=Offline Storage
|
||||
pageactions.password=Password
|
||||
pageactions.desktop-notification=Web Notifications
|
||||
pageactions.openWebappsUninstall=Uninstalling Open Web Apps
|
||||
pageactions.openWebappsList=Listing Open Web Apps
|
||||
|
||||
# Open Search
|
||||
opensearch.searchWith=Search With:
|
||||
|
|
Загрузка…
Ссылка в новой задаче