mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1126004 - Make JS callers of ios.newChannel call ios.newChannel2 in toolkit/components/places -tests (r=mak)
This commit is contained in:
parent
0a5e6b3b13
commit
51db0efbba
@ -30,26 +30,33 @@ function test() {
|
||||
});
|
||||
|
||||
function getIconFile(aCallback) {
|
||||
NetUtil.asyncFetch(favIconLocation, function(inputStream, status) {
|
||||
if (!Components.isSuccessCode(status)) {
|
||||
ok(false, "Could not get the icon file");
|
||||
// Handle error.
|
||||
return;
|
||||
}
|
||||
NetUtil.asyncFetch2(
|
||||
favIconLocation,
|
||||
function(inputStream, status) {
|
||||
if (!Components.isSuccessCode(status)) {
|
||||
ok(false, "Could not get the icon file");
|
||||
// Handle error.
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the returned size versus the expected size.
|
||||
let size = inputStream.available();
|
||||
favIconData = NetUtil.readInputStreamToString(inputStream, size);
|
||||
is(size, favIconData.length, "Check correct icon size");
|
||||
// Check that the favicon loaded correctly before starting the actual tests.
|
||||
is(favIconData.length, 344, "Check correct icon length (344)");
|
||||
// Check the returned size versus the expected size.
|
||||
let size = inputStream.available();
|
||||
favIconData = NetUtil.readInputStreamToString(inputStream, size);
|
||||
is(size, favIconData.length, "Check correct icon size");
|
||||
// Check that the favicon loaded correctly before starting the actual tests.
|
||||
is(favIconData.length, 344, "Check correct icon length (344)");
|
||||
|
||||
if (aCallback) {
|
||||
aCallback();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
if (aCallback) {
|
||||
aCallback();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_IMAGE);
|
||||
}
|
||||
|
||||
function testNormal(aWindow, aCallback) {
|
||||
|
@ -58,15 +58,26 @@ function run_test()
|
||||
getService(Ci.nsIIOService);
|
||||
|
||||
// Test that the default icon has the content type of image/png.
|
||||
let (channel = ios.newChannelFromURI(fs.defaultFavicon)) {
|
||||
let (channel = ios.newChannelFromURI2(fs.defaultFavicon,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_IMAGE)) {
|
||||
channel.asyncOpen(new streamListener("image/png"), null);
|
||||
do_test_pending();
|
||||
}
|
||||
|
||||
// Test URI that we don't know anything about. Will end up being the default
|
||||
// icon, so expect image/png.
|
||||
let (channel = ios.newChannel(moz_anno_favicon_prefix + "http://mozilla.org",
|
||||
null, null)) {
|
||||
let (channel = ios.newChannel2(moz_anno_favicon_prefix + "http://mozilla.org",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_IMAGE)) {
|
||||
channel.asyncOpen(new streamListener("image/png"), null);
|
||||
do_test_pending();
|
||||
}
|
||||
@ -78,8 +89,14 @@ function run_test()
|
||||
(Date.now() + 60 * 60 * 24 * 1000) * 1000);
|
||||
|
||||
// Open the channel
|
||||
let channel = ios.newChannel(moz_anno_favicon_prefix + testURI.spec, null,
|
||||
null);
|
||||
let channel = ios.newChannel2(moz_anno_favicon_prefix + testURI.spec,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_IMAGE);
|
||||
channel.asyncOpen(new streamListener("image/png"), null);
|
||||
do_test_pending();
|
||||
}
|
||||
|
@ -62,7 +62,12 @@ function PathHandler(aMeta, aResponse, aChannelEvent, aRedirURL) {
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
var chan = NetUtil.ioService.newChannelFromURI(uri(PERMA_REDIR_URL));
|
||||
var chan = NetUtil.ioService.newChannelFromURI2(uri(PERMA_REDIR_URL),
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var listener = new ChannelListener();
|
||||
chan.notificationCallbacks = listener;
|
||||
chan.asyncOpen(listener, null);
|
||||
|
@ -19,11 +19,18 @@
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
/** Test for Bug 411966 **/
|
||||
addVisits(typedURI, function() {
|
||||
histsvc.markPageAsTyped(typedURI);
|
||||
|
||||
var clickedLinkChannel = ios.newChannelFromURI(clickedLinkURI);
|
||||
var clickedLinkChannel = ios.newChannelFromURI2(clickedLinkURI,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
clickedLinkChannel.QueryInterface(Ci.nsIHttpChannel).referrer = typedURI;
|
||||
var listener = new StreamListener(clickedLinkChannel, checkDB);
|
||||
clickedLinkChannel.notificationCallbacks = listener;
|
||||
|
Loading…
Reference in New Issue
Block a user