mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1091898 - pass in getWebIDLCallerPrincipal().origin to IdP to allow use of Promises. r=mt
This commit is contained in:
parent
f12260ac57
commit
7302dd56ad
@ -707,9 +707,12 @@ RTCPeerConnection.prototype = {
|
||||
"Invalid type " + desc.type + " provided to setRemoteDescription");
|
||||
}
|
||||
|
||||
// Have to get caller's origin outside of Promise constructor and pass it in
|
||||
let origin = Cu.getWebIDLCallerPrincipal().origin;
|
||||
|
||||
this._queueOrRun({
|
||||
func: this._setRemoteDescription,
|
||||
args: [type, desc.sdp, onSuccess, onError],
|
||||
args: [type, desc.sdp, origin, onSuccess, onError],
|
||||
wait: true
|
||||
});
|
||||
},
|
||||
@ -736,7 +739,7 @@ RTCPeerConnection.prototype = {
|
||||
return good;
|
||||
},
|
||||
|
||||
_setRemoteDescription: function(type, sdp, onSuccess, onError) {
|
||||
_setRemoteDescription: function(type, sdp, origin, onSuccess, onError) {
|
||||
let idpComplete = false;
|
||||
let setRemoteComplete = false;
|
||||
let idpError = null;
|
||||
@ -785,7 +788,7 @@ RTCPeerConnection.prototype = {
|
||||
}
|
||||
|
||||
try {
|
||||
this._remoteIdp.verifyIdentityFromSDP(sdp, idpDone);
|
||||
this._remoteIdp.verifyIdentityFromSDP(sdp, origin, idpDone);
|
||||
} catch (e) {
|
||||
// if processing the SDP for identity doesn't work
|
||||
this.logWarning(e.message, e.fileName, e.lineNumber);
|
||||
@ -1142,7 +1145,8 @@ PeerConnectionObserver.prototype = {
|
||||
onCreateOfferSuccess: function(sdp) {
|
||||
let pc = this._dompc;
|
||||
let fp = pc._impl.fingerprint;
|
||||
pc._localIdp.appendIdentityToSDP(sdp, fp, function(sdp, assertion) {
|
||||
let origin = Cu.getWebIDLCallerPrincipal().origin;
|
||||
pc._localIdp.appendIdentityToSDP(sdp, fp, origin, function(sdp, assertion) {
|
||||
if (assertion) {
|
||||
pc._gotIdentityAssertion(assertion);
|
||||
}
|
||||
@ -1161,7 +1165,8 @@ PeerConnectionObserver.prototype = {
|
||||
onCreateAnswerSuccess: function(sdp) {
|
||||
let pc = this._dompc;
|
||||
let fp = pc._impl.fingerprint;
|
||||
pc._localIdp.appendIdentityToSDP(sdp, fp, function(sdp, assertion) {
|
||||
let origin = Cu.getWebIDLCallerPrincipal().origin;
|
||||
pc._localIdp.appendIdentityToSDP(sdp, fp, origin, function(sdp, assertion) {
|
||||
if (assertion) {
|
||||
pc._gotIdentityAssertion(assertion);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ PeerConnectionIdp.prototype = {
|
||||
* IdP proxy as parameter, else (verification failed OR no a=identity line in
|
||||
* SDP at all) null is passed to callback.
|
||||
*/
|
||||
verifyIdentityFromSDP: function(sdp, callback) {
|
||||
verifyIdentityFromSDP: function(sdp, origin, callback) {
|
||||
let identity = this._getIdentityFromSdp(sdp);
|
||||
let fingerprints = this._getFingerprintsFromSdp(sdp);
|
||||
// it's safe to use the fingerprint we got from the SDP here,
|
||||
@ -135,7 +135,7 @@ PeerConnectionIdp.prototype = {
|
||||
}
|
||||
|
||||
this.setIdentityProvider(identity.idp.domain, identity.idp.protocol);
|
||||
this._verifyIdentity(identity.assertion, fingerprints, callback);
|
||||
this._verifyIdentity(identity.assertion, fingerprints, origin, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -212,7 +212,7 @@ PeerConnectionIdp.prototype = {
|
||||
/**
|
||||
* Asks the IdP proxy to verify an identity.
|
||||
*/
|
||||
_verifyIdentity: function(assertion, fingerprints, callback) {
|
||||
_verifyIdentity: function(assertion, fingerprints, origin, callback) {
|
||||
function onVerification(message) {
|
||||
if (message && this._checkVerifyResponse(message, fingerprints)) {
|
||||
callback(message);
|
||||
@ -224,7 +224,8 @@ PeerConnectionIdp.prototype = {
|
||||
|
||||
let request = {
|
||||
type: "VERIFY",
|
||||
message: assertion
|
||||
message: assertion,
|
||||
origin: origin
|
||||
};
|
||||
this._sendToIdp(request, "validation", onVerification.bind(this));
|
||||
},
|
||||
@ -235,7 +236,7 @@ PeerConnectionIdp.prototype = {
|
||||
* parameter. If no IdP is configured the original SDP (without a=identity
|
||||
* line) is passed to the callback.
|
||||
*/
|
||||
appendIdentityToSDP: function(sdp, fingerprint, callback) {
|
||||
appendIdentityToSDP: function(sdp, fingerprint, origin, callback) {
|
||||
let onAssertion = function() {
|
||||
callback(this.wrapSdp(sdp), this.assertion);
|
||||
}.bind(this);
|
||||
@ -245,7 +246,7 @@ PeerConnectionIdp.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
this._getIdentityAssertion(fingerprint, onAssertion);
|
||||
this._getIdentityAssertion(fingerprint, origin, onAssertion);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -270,10 +271,11 @@ PeerConnectionIdp.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
this._getIdentityAssertion(fingerprint, callback);
|
||||
let origin = Cu.getWebIDLCallerPrincipal().origin;
|
||||
this._getIdentityAssertion(fingerprint, origin, callback);
|
||||
},
|
||||
|
||||
_getIdentityAssertion: function(fingerprint, callback) {
|
||||
_getIdentityAssertion: function(fingerprint, origin, callback) {
|
||||
let [algorithm, digest] = fingerprint.split(" ", 2);
|
||||
let message = {
|
||||
fingerprint: [{
|
||||
@ -284,7 +286,8 @@ PeerConnectionIdp.prototype = {
|
||||
let request = {
|
||||
type: "SIGN",
|
||||
message: JSON.stringify(message),
|
||||
username: this.username
|
||||
username: this.username,
|
||||
origin: origin
|
||||
};
|
||||
|
||||
// catch the assertion, clean it up, warn if absent
|
||||
@ -308,7 +311,6 @@ PeerConnectionIdp.prototype = {
|
||||
* @param callback (function) the function to call with the results
|
||||
*/
|
||||
_sendToIdp: function(request, type, callback) {
|
||||
request.origin = Cu.getWebIDLCallerPrincipal().origin;
|
||||
this._idpchannel.send(request, this._wrapCallback(type, callback));
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user