mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1458020 - 4. Add camera permission in the parent process; r=snorp
We had a permission error because we were trying to add camera permission in the child process. Move it to the parent process, where the permission is actually checked. MozReview-Commit-ID: 2OE3BznlVTD
This commit is contained in:
parent
4053e24872
commit
6ed91a89a9
@ -46,6 +46,26 @@ GeckoViewPermission.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
receiveMessage(aMsg) {
|
||||
switch (aMsg.name) {
|
||||
case "GeckoView:AddCameraPermission": {
|
||||
let uri;
|
||||
try {
|
||||
// This fails for principals that serialize to "null", e.g. file URIs.
|
||||
uri = Services.io.newURI(aMsg.data.origin);
|
||||
} catch (e) {
|
||||
uri = Services.io.newURI(aMsg.data.documentURI);
|
||||
}
|
||||
// Although the lifetime is "session" it will be removed upon
|
||||
// use so it's more of a one-shot.
|
||||
Services.perms.add(uri, "MediaManagerVideo",
|
||||
Services.perms.ALLOW_ACTION,
|
||||
Services.perms.EXPIRE_SESSION);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleMediaAskDevicePermission: function(aType, aCallback) {
|
||||
let perms = [];
|
||||
if (aType === "video" || aType === "all") {
|
||||
@ -122,11 +142,10 @@ GeckoViewPermission.prototype = {
|
||||
if (!video) {
|
||||
throw new Error("invalid video id");
|
||||
}
|
||||
// Although the lifetime is "session" it will be removed upon
|
||||
// use so it's more of a one-shot.
|
||||
Services.perms.add(uri, "MediaManagerVideo",
|
||||
Services.perms.ALLOW_ACTION,
|
||||
Services.perms.EXPIRE_SESSION);
|
||||
Services.cpmm.sendAsyncMessage("GeckoView:AddCameraPermission", {
|
||||
origin: win.origin,
|
||||
documentURI: win.document.documentURI,
|
||||
});
|
||||
allowedDevices.appendElement(video);
|
||||
}
|
||||
if (constraints.audio) {
|
||||
|
@ -46,6 +46,9 @@ GeckoViewStartup.prototype = {
|
||||
"getUserMedia:request",
|
||||
"PeerConnection:request",
|
||||
],
|
||||
ppmm: [
|
||||
"GeckoView:AddCameraPermission",
|
||||
],
|
||||
});
|
||||
|
||||
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_DEFAULT) {
|
||||
|
@ -68,6 +68,11 @@ var GeckoViewUtils = {
|
||||
observers.forEach(topic => Services.obs.addObserver(observer, topic));
|
||||
}
|
||||
|
||||
if (!this.IS_PARENT_PROCESS) {
|
||||
// ppmm, mm, and ged are only available in the parent process.
|
||||
return;
|
||||
}
|
||||
|
||||
let addMMListener = (target, names) => {
|
||||
let listener = msg => {
|
||||
target.removeMessageListener(msg.name, listener);
|
||||
|
Loading…
Reference in New Issue
Block a user