mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1232901 - Use channel.asyncOpen2 within dom/browser-element/BrowserElementParent.js (r=sicking,aus)
This commit is contained in:
parent
8a445d8fdb
commit
54fea4cb15
@ -15,6 +15,7 @@ var Cr = Components.results;
|
||||
*/
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/BrowserElementPromptService.jsm");
|
||||
|
||||
@ -1001,36 +1002,17 @@ BrowserElementParent.prototype = {
|
||||
Ci.nsIRequestObserver])
|
||||
};
|
||||
|
||||
// If we have a URI we'll use it to get the triggering principal to use,
|
||||
// if not available a null principal is acceptable.
|
||||
let referrer = null;
|
||||
let principal = null;
|
||||
if (_options.referrer) {
|
||||
// newURI can throw on malformed URIs.
|
||||
try {
|
||||
referrer = Services.io.newURI(_options.referrer, null, null);
|
||||
}
|
||||
catch(e) {
|
||||
debug('Malformed referrer -- ' + e);
|
||||
}
|
||||
let referrer = Services.io.newURI(_options.referrer, null, null);
|
||||
let principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(
|
||||
referrer, this._frameLoader.loadContext.originAttributes);
|
||||
|
||||
// This simply returns null if there is no principal available
|
||||
// for the requested uri. This is an acceptable fallback when
|
||||
// calling newChannelFromURI2.
|
||||
principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(
|
||||
referrer, this._frameLoader.loadContext.originAttributes);
|
||||
}
|
||||
|
||||
debug('Using principal? ' + !!principal);
|
||||
|
||||
let channel =
|
||||
Services.io.newChannelFromURI2(url,
|
||||
null, // No document.
|
||||
principal, // Loading principal
|
||||
principal, // Triggering principal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
let channel = NetUtil.newChannel({
|
||||
uri: url,
|
||||
loadingPrincipal: principal,
|
||||
securityFlags: SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS,
|
||||
contentPolicyType: Ci.nsIContentPolicy.TYPE_OTHER
|
||||
});
|
||||
|
||||
// XXX We would set private browsing information prior to calling this.
|
||||
channel.notificationCallbacks = interfaceRequestor;
|
||||
@ -1055,7 +1037,7 @@ BrowserElementParent.prototype = {
|
||||
}
|
||||
|
||||
// Set-up complete, let's get things started.
|
||||
channel.asyncOpen(new DownloadListener(), null);
|
||||
channel.asyncOpen2(new DownloadListener());
|
||||
|
||||
return req;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user