Skip to content

Commit

Permalink
Bug 1093947: Make JS callers of ios.newChannel call ios.newChannel2 i…
Browse files Browse the repository at this point in the history
…n uriloader/ (r=smaug,bz)
  • Loading branch information
Christoph Kerschbaumer committed Jan 9, 2015
1 parent 71aff52 commit 918fda3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
13 changes: 10 additions & 3 deletions uriloader/exthandler/nsWebHandlerApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
* 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/. */

Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

////////////////////////////////////////////////////////////////////////////////
//// Constants

const Ci = Components.interfaces;
const Cr = Components.results;
const Cc = Components.classes;
const Cu = Components.utils;

Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");

////////////////////////////////////////////////////////////////////////////////
//// nsWebHandler class
Expand Down Expand Up @@ -80,7 +82,12 @@ nsWebHandlerApp.prototype = {
if (aWindowContext) {

// create a channel from this URI
var channel = ioService.newChannelFromURI(uriToSend);
var channel = ioService.newChannelFromURI2(uriToSend,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
channel.loadFlags = Ci.nsIChannel.LOAD_DOCUMENT_URI;

// load the channel
Expand Down
11 changes: 8 additions & 3 deletions uriloader/exthandler/tests/unit_ipc/test_encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,14 @@ function runChildTestSet(set)
{
DownloadListener.onFinished = testFinisher(set[2]);
sendCommand('\
let uri = ioservice.newURI("http://localhost:4444' + set[0] + '", null, null);\
let channel = ioservice.newChannelFromURI(uri); \
uriloader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED, new WindowContext()); \
let uri = ioservice.newURI("http://localhost:4444' + set[0] + '", null, null); \
let channel = ioservice.newChannelFromURI2(uri, \
null, /* aLoadingNode */ \
Services.scriptSecurityManager.getSystemPrincipal(), \
null, /* aTriggeringPrincipal */ \
Ci.nsILoadInfo.SEC_NORMAL, \
Ci.nsIContentPolicy.TYPE_OTHER); \
uriloader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED, new WindowContext()); \
');
}

Expand Down

0 comments on commit 918fda3

Please sign in to comment.