mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 742092 - Bridge the permission prompt to the content using the homescreen messaging API. r=fabrice
This commit is contained in:
parent
d2056d85c2
commit
11701b7a60
@ -437,7 +437,7 @@ Services.obs.addObserver(function onConsoleAPILogEvent(subject, topic, data) {
|
||||
serverSocket.asyncListen(listener);
|
||||
})();
|
||||
|
||||
CustomEventManager = {
|
||||
var CustomEventManager = {
|
||||
init: function custevt_init() {
|
||||
window.addEventListener("ContentStart", (function(evt) {
|
||||
content.addEventListener("mozContentEvent", this, false, true);
|
||||
@ -461,7 +461,7 @@ CustomEventManager = {
|
||||
}
|
||||
}
|
||||
|
||||
AlertsHelper = {
|
||||
var AlertsHelper = {
|
||||
_listeners: {},
|
||||
_count: 0,
|
||||
|
||||
@ -492,7 +492,7 @@ AlertsHelper = {
|
||||
}
|
||||
}
|
||||
|
||||
WebappsHelper = {
|
||||
var WebappsHelper = {
|
||||
_installers: {},
|
||||
_count: 0,
|
||||
|
||||
|
@ -27,12 +27,35 @@ ContentPermissionPrompt.prototype = {
|
||||
return false;
|
||||
},
|
||||
|
||||
_id: 0,
|
||||
prompt: function(request) {
|
||||
// returns true if the request was handled
|
||||
if (this.handleExistingPermission(request))
|
||||
return;
|
||||
|
||||
// TODO : show UI to grant or deny permission
|
||||
let browser = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let content = browser.content;
|
||||
if (!content)
|
||||
return;
|
||||
|
||||
let requestId = this._id++;
|
||||
content.addEventListener("mozContentEvent", function contentEvent(evt) {
|
||||
if (evt.detail.id != requestId)
|
||||
return;
|
||||
|
||||
content.removeEventListener(evt.type, contentEvent);
|
||||
if (evt.detail.type == "permission-allow") {
|
||||
request.allow();
|
||||
return;
|
||||
}
|
||||
|
||||
request.cancel();
|
||||
});
|
||||
|
||||
browser.shell.sendEvent(browser.content, "mozChromeEvent", {
|
||||
"type": "permission-prompt", "permission": request.type,
|
||||
"id": requestId, "url": request.uri.spec
|
||||
});
|
||||
},
|
||||
|
||||
classID: Components.ID("{8c719f03-afe0-4aac-91ff-6c215895d467}"),
|
||||
|
Loading…
Reference in New Issue
Block a user