mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1189060 - add CreateOfferRequest.webidl interface for add-ons r=florian,peterv
This commit is contained in:
parent
2aa6eee49f
commit
41657a18b0
@ -77,10 +77,7 @@ this.ContentWebRTC = {
|
||||
};
|
||||
|
||||
function handlePCRequest(aSubject, aTopic, aData) {
|
||||
// Need to access JS object behind XPCOM wrapper added by observer API (using a
|
||||
// WebIDL interface didn't work here as object comes from JSImplemented code).
|
||||
aSubject = aSubject.wrappedJSObject;
|
||||
let { windowID, callID, isSecure } = aSubject;
|
||||
let { windowID, innerWindowID, callID, isSecure } = aSubject;
|
||||
let contentWindow = Services.wm.getOuterWindowWithId(windowID);
|
||||
|
||||
if (!contentWindow.pendingPeerConnectionRequests) {
|
||||
@ -89,8 +86,9 @@ function handlePCRequest(aSubject, aTopic, aData) {
|
||||
contentWindow.pendingPeerConnectionRequests.add(callID);
|
||||
|
||||
let request = {
|
||||
callID: callID,
|
||||
windowID: windowID,
|
||||
innerWindowID: innerWindowID,
|
||||
callID: callID,
|
||||
documentURI: contentWindow.document.documentURI,
|
||||
secure: isSecure,
|
||||
};
|
||||
|
@ -156,10 +156,14 @@ this.webrtcUI = {
|
||||
|
||||
case "rtcpeer:Request": {
|
||||
// Always allow. This code-point exists for add-ons to override.
|
||||
let request = aMessage.data;
|
||||
let { callID, windowID } = aMessage.data;
|
||||
// Also available: isSecure, innerWindowID. For contentWindow:
|
||||
//
|
||||
// let contentWindow = Services.wm.getOuterWindowWithId(windowID);
|
||||
|
||||
let mm = aMessage.target.messageManager;
|
||||
mm.sendAsyncMessage("rtcpeer:Allow", { callID: request.callID,
|
||||
windowID: request.windowID });
|
||||
mm.sendAsyncMessage("rtcpeer:Allow",
|
||||
{ callID: callID, windowID: windowID });
|
||||
break;
|
||||
}
|
||||
case "rtcpeer:CancelRequest":
|
||||
|
@ -25,6 +25,7 @@ const PC_STATS_CONTRACT = "@mozilla.org/dom/rtcstatsreport;1";
|
||||
const PC_STATIC_CONTRACT = "@mozilla.org/dom/peerconnectionstatic;1";
|
||||
const PC_SENDER_CONTRACT = "@mozilla.org/dom/rtpsender;1";
|
||||
const PC_RECEIVER_CONTRACT = "@mozilla.org/dom/rtpreceiver;1";
|
||||
const PC_COREQUEST_CONTRACT = "@mozilla.org/dom/createofferrequest;1";
|
||||
|
||||
const PC_CID = Components.ID("{bdc2e533-b308-4708-ac8e-a8bfade6d851}");
|
||||
const PC_OBS_CID = Components.ID("{d1748d4c-7f6a-4dc5-add6-d55b7678537e}");
|
||||
@ -35,6 +36,7 @@ const PC_STATS_CID = Components.ID("{7fe6e18b-0da3-4056-bf3b-440ef3809e06}");
|
||||
const PC_STATIC_CID = Components.ID("{0fb47c47-a205-4583-a9fc-cbadf8c95880}");
|
||||
const PC_SENDER_CID = Components.ID("{4fff5d46-d827-4cd4-a970-8fd53977440e}");
|
||||
const PC_RECEIVER_CID = Components.ID("{d974b814-8fde-411c-8c45-b86791b81030}");
|
||||
const PC_COREQUEST_CID = Components.ID("{74b2122d-65a8-4824-aa9e-3d664cb75dc2}");
|
||||
|
||||
// Global list of PeerConnection objects, so they can be cleaned up when
|
||||
// a page is torn down. (Maps inner window ID to an array of PC objects).
|
||||
@ -783,11 +785,10 @@ RTCPeerConnection.prototype = {
|
||||
this._settlePermission = { allow: resolve, deny: reject };
|
||||
let outerId = this._win.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||
let request = { windowID: outerId,
|
||||
innerWindowId: this._winID,
|
||||
callID: this._globalPCListId,
|
||||
isSecure: this._https };
|
||||
request.wrappedJSObject = request;
|
||||
|
||||
let chrome = new CreateOfferRequest(outerId, this._winID,
|
||||
this._globalPCListId, false);
|
||||
let request = this._win.CreateOfferRequest._create(this._win, chrome);
|
||||
Services.obs.notifyObservers(request, "PeerConnection:request", null);
|
||||
});
|
||||
},
|
||||
@ -1489,6 +1490,19 @@ RTCRtpReceiver.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
|
||||
};
|
||||
|
||||
function CreateOfferRequest(windowID, innerWindowID, callID, isSecure) {
|
||||
this.windowID = windowID;
|
||||
this.innerWindowID = innerWindowID;
|
||||
this.callID = callID;
|
||||
this.isSecure = isSecure;
|
||||
}
|
||||
CreateOfferRequest.prototype = {
|
||||
classDescription: "CreateOfferRequest",
|
||||
classID: PC_COREQUEST_CID,
|
||||
contractID: PC_COREQUEST_CONTRACT,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
|
||||
[GlobalPCList,
|
||||
RTCIceCandidate,
|
||||
@ -1498,5 +1512,6 @@ this.NSGetFactory = XPCOMUtils.generateNSGetFactory(
|
||||
RTCRtpReceiver,
|
||||
RTCRtpSender,
|
||||
RTCStatsReport,
|
||||
PeerConnectionObserver]
|
||||
PeerConnectionObserver,
|
||||
CreateOfferRequest]
|
||||
);
|
||||
|
@ -7,6 +7,7 @@ component {7fe6e18b-0da3-4056-bf3b-440ef3809e06} PeerConnection.js
|
||||
component {0fb47c47-a205-4583-a9fc-cbadf8c95880} PeerConnection.js
|
||||
component {4fff5d46-d827-4cd4-a970-8fd53977440e} PeerConnection.js
|
||||
component {d974b814-8fde-411c-8c45-b86791b81030} PeerConnection.js
|
||||
component {74b2122d-65a8-4824-aa9e-3d664cb75dc2} PeerConnection.js
|
||||
|
||||
contract @mozilla.org/dom/peerconnection;1 {bdc2e533-b308-4708-ac8e-a8bfade6d851}
|
||||
contract @mozilla.org/dom/peerconnectionobserver;1 {d1748d4c-7f6a-4dc5-add6-d55b7678537e}
|
||||
@ -17,3 +18,4 @@ contract @mozilla.org/dom/rtcstatsreport;1 {7fe6e18b-0da3-4056-bf3b-440ef3809e06
|
||||
contract @mozilla.org/dom/peerconnectionstatic;1 {0fb47c47-a205-4583-a9fc-cbadf8c95880}
|
||||
contract @mozilla.org/dom/rtpsender;1 {4fff5d46-d827-4cd4-a970-8fd53977440e}
|
||||
contract @mozilla.org/dom/rtpreceiver;1 {d974b814-8fde-411c-8c45-b86791b81030}
|
||||
contract @mozilla.org/dom/createofferrequest;1 {74b2122d-65a8-4824-aa9e-3d664cb75dc2}
|
||||
|
16
dom/webidl/CreateOfferRequest.webidl
Normal file
16
dom/webidl/CreateOfferRequest.webidl
Normal file
@ -0,0 +1,16 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This is an internal IDL file
|
||||
*/
|
||||
|
||||
[ChromeOnly,
|
||||
JSImplementation="@mozilla.org/dom/createofferrequest;1"]
|
||||
interface CreateOfferRequest {
|
||||
readonly attribute unsigned long long windowID;
|
||||
readonly attribute unsigned long long innerWindowID;
|
||||
readonly attribute DOMString callID;
|
||||
readonly attribute boolean isSecure;
|
||||
};
|
@ -88,6 +88,7 @@ WEBIDL_FILES = [
|
||||
'ContainerBoxObject.webidl',
|
||||
'ConvolverNode.webidl',
|
||||
'Coordinates.webidl',
|
||||
'CreateOfferRequest.webidl',
|
||||
'Crypto.webidl',
|
||||
'CSPDictionaries.webidl',
|
||||
'CSPReport.webidl',
|
||||
|
Loading…
Reference in New Issue
Block a user