☠☠ backed out by a6c0026d360b ☠ ☠ | |
author | Christoph Kerschbaumer <mozilla@christophkerschbaumer.com> |
Wed, 20 Jan 2016 12:44:21 -0800 | |
changeset 280789 | b82e4d33ec28f5ba9a964cfacfe2ec31bc063a74 |
parent 280788 | 1e963938e988007dedbd49262b3a53943b1f196d |
child 280790 | e4454d27ef63819ad0474b5526e1ac508345afcc |
push id | 70588 |
push user | mozilla@christophkerschbaumer.com |
push date | Thu, 21 Jan 2016 00:24:07 +0000 |
treeherder | mozilla-inbound@e4454d27ef63 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sicking, aus |
bugs | 1232901 |
milestone | 46.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/browser-element/BrowserElementParent.js +++ b/dom/browser-element/BrowserElementParent.js @@ -10,16 +10,17 @@ var Cc = Components.classes; var Cr = Components.results; /* BrowserElementParent injects script to listen for certain events in the * child. We then listen to messages from the child script and take * appropriate action here in the parent. */ 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"); XPCOMUtils.defineLazyGetter(this, "DOMApplicationRegistry", function () { Cu.import("resource://gre/modules/Webapps.jsm"); return DOMApplicationRegistry; }); @@ -996,46 +997,27 @@ BrowserElementParent.prototype = { aOffset, aCount) { this.extListener.onDataAvailable(aRequest, aContext, aInputStream, aOffset, aCount); }, QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener, 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; // Since we're downloading our own local copy we'll want to bypass the // cache and local cache if the channel let's us specify this. let flags = Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS | Ci.nsIChannel.LOAD_BYPASS_CACHE; @@ -1050,17 +1032,17 @@ BrowserElementParent.prototype = { debug('Setting HTTP referrer = ' + (referrer && referrer.spec)); channel.referrer = referrer; if (channel instanceof Ci.nsIHttpChannelInternal) { channel.forceAllowThirdPartyCookie = true; } } // Set-up complete, let's get things started. - channel.asyncOpen(new DownloadListener(), null); + channel.asyncOpen2(new DownloadListener()); return req; }, getScreenshot: function(_width, _height, _mimeType) { if (!this._isAlive()) { throw Components.Exception("Dead content process", Cr.NS_ERROR_DOM_INVALID_STATE_ERR);