mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1143922 - Add AsyncOpen2 to channels within JS tests (r=sicking)
This commit is contained in:
parent
2afdc09ece
commit
a0d4858bb8
@ -36,6 +36,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
var SimpleURI = Cc["@mozilla.org/network/simple-uri;1"];
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var contentSecManager = Cc["@mozilla.org/contentsecuritymanager;1"]
|
||||
.getService(Ci.nsIContentSecurityManager);
|
||||
|
||||
var PROTOCOL_SCHEME = "jsproto";
|
||||
|
||||
@ -70,12 +72,22 @@ CustomChannel.prototype = {
|
||||
listener.onStopRequest(this, context, Cr.NS_OK);
|
||||
} catch(e) {}
|
||||
},
|
||||
asyncOpen2: function(listener) {
|
||||
// throws an error if security checks fail
|
||||
var outListener = contentSecManager.performSecurityCheck(this, listener);
|
||||
return this.asyncOpen(outListener, null);
|
||||
},
|
||||
open: function() {
|
||||
let data = "bar";
|
||||
let stream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream);
|
||||
stream.setData(data, data.length);
|
||||
return stream;
|
||||
},
|
||||
open2: function() {
|
||||
// throws an error if security checks fail
|
||||
contentSecManager.performSecurityCheck(this, null);
|
||||
return this.open();
|
||||
},
|
||||
isPending: function() {
|
||||
return false;
|
||||
},
|
||||
|
@ -6,6 +6,9 @@
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
var contentSecManager = Cc["@mozilla.org/contentsecuritymanager;1"]
|
||||
.getService(Ci.nsIContentSecurityManager);
|
||||
|
||||
function ProtocolHandler() {
|
||||
this.uri = Cc["@mozilla.org/network/simple-uri;1"].
|
||||
createInstance(Ci.nsIURI);
|
||||
@ -55,10 +58,19 @@ ProtocolHandler.prototype = {
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).open();
|
||||
},
|
||||
open2: function() {
|
||||
// throws an error if security checks fail
|
||||
contentSecManager.performSecurityCheck(this, null);
|
||||
return this.open();
|
||||
},
|
||||
asyncOpen: function(aListener, aContext) {
|
||||
throw Components.Exception("Not implemented",
|
||||
Cr.NS_ERROR_NOT_IMPLEMENTED);
|
||||
},
|
||||
asyncOpen2: function(aListener, aContext) {
|
||||
throw Components.Exception("Not implemented",
|
||||
Cr.NS_ERROR_NOT_IMPLEMENTED);
|
||||
},
|
||||
contentDisposition: Ci.nsIChannel.DISPOSITION_INLINE,
|
||||
get contentDispositionFilename() {
|
||||
throw Components.Exception("No file name",
|
||||
|
@ -10,6 +10,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
const baseURL = "http://mochi.test:8888/browser/" +
|
||||
"toolkit/components/addoncompat/tests/browser/";
|
||||
|
||||
var contentSecManager = Cc["@mozilla.org/contentsecuritymanager;1"]
|
||||
.getService(Ci.nsIContentSecurityManager);
|
||||
|
||||
function forEachWindow(f)
|
||||
{
|
||||
let wins = Services.ww.getWindowEnumerator("navigator:browser");
|
||||
@ -295,6 +298,12 @@ function testAboutModuleRegistration()
|
||||
Services.tm.currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
||||
},
|
||||
|
||||
asyncOpen2: function(listener) {
|
||||
// throws an error if security checks fail
|
||||
var outListener = contentSecManager.performSecurityCheck(this, listener);
|
||||
return this.asyncOpen(outListener, null);
|
||||
},
|
||||
|
||||
open: function() {
|
||||
function getWindow(channel) {
|
||||
try
|
||||
@ -322,6 +331,12 @@ function testAboutModuleRegistration()
|
||||
return stream;
|
||||
},
|
||||
|
||||
open2: function() {
|
||||
// throws an error if security checks fail
|
||||
contentSecManager.performSecurityCheck(this, null);
|
||||
return this.open();
|
||||
},
|
||||
|
||||
isPending: function() {
|
||||
return false;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user