mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1407679 - Merge nsIIOService and nsIIOService2; r=nwgh
This commit is contained in:
parent
b9b2ff68ea
commit
cbb956e0c3
@ -65,7 +65,7 @@ function makeHandler(nameTemplate, eventName, expectedStates) {
|
||||
|
||||
function doTest() {
|
||||
var iosvc = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIIOService2);
|
||||
.getService(SpecialPowers.Ci.nsIIOService);
|
||||
iosvc.manageOfflineStatus = false;
|
||||
iosvc.offline = false;
|
||||
ok(navigator.onLine, "navigator.onLine should be true, since we've just " +
|
||||
|
@ -45,7 +45,7 @@ addLoadEvent(function() {
|
||||
|
||||
function doTest() {
|
||||
var iosvc = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIIOService2);
|
||||
.getService(SpecialPowers.Ci.nsIIOService);
|
||||
iosvc.manageOfflineStatus = false;
|
||||
|
||||
info("setting iosvc.offline = true");
|
||||
|
2
layout/tools/reftest/bootstrap.js
vendored
2
layout/tools/reftest/bootstrap.js
vendored
@ -39,7 +39,7 @@ function startup(data, reason) {
|
||||
let orig = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
let ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService2);
|
||||
.getService(Ci.nsIIOService);
|
||||
ios.manageOfflineStatus = false;
|
||||
ios.offline = false;
|
||||
|
||||
|
@ -38,7 +38,7 @@ function _dump(str) {
|
||||
// not connected to a network.
|
||||
{
|
||||
let ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService2);
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
ios.manageOfflineStatus = false;
|
||||
ios.offline = false;
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ XPIDL_SOURCES += [
|
||||
'nsIInputStreamChannel.idl',
|
||||
'nsIInputStreamPump.idl',
|
||||
'nsIIOService.idl',
|
||||
'nsIIOService2.idl',
|
||||
'nsILoadContextInfo.idl',
|
||||
'nsILoadGroup.idl',
|
||||
'nsILoadGroupChild.idl',
|
||||
|
@ -184,6 +184,52 @@ interface nsIIOService : nsISupports
|
||||
* @return true if the URI hostname is a local IP address
|
||||
*/
|
||||
boolean hostnameIsLocalIPAddress(in nsIURI aURI);
|
||||
|
||||
/**
|
||||
* While this is set, IOService will monitor an nsINetworkLinkService
|
||||
* (if available) and set its offline status to "true" whenever
|
||||
* isLinkUp is false.
|
||||
*
|
||||
* Applications that want to control changes to the IOService's offline
|
||||
* status should set this to false, watch for network:link-status-changed
|
||||
* broadcasts, and change nsIIOService::offline as they see fit. Note
|
||||
* that this means during application startup, IOService may be offline
|
||||
* if there is no link, until application code runs and can turn off
|
||||
* this management.
|
||||
*/
|
||||
attribute boolean manageOfflineStatus;
|
||||
|
||||
/**
|
||||
* Creates a channel for a given URI.
|
||||
*
|
||||
* @param aURI
|
||||
* nsIURI from which to make a channel
|
||||
* @param aProxyURI
|
||||
* nsIURI to use for proxy resolution. Can be null in which
|
||||
* case aURI is used
|
||||
* @param aProxyFlags flags from nsIProtocolProxyService to use
|
||||
* when resolving proxies for this new channel
|
||||
* @param aLoadingNode
|
||||
* @param aLoadingPrincipal
|
||||
* @param aTriggeringPrincipal
|
||||
* @param aSecurityFlags
|
||||
* @param aContentPolicyType
|
||||
* These will be used as values for the nsILoadInfo object on the
|
||||
* created channel. For details, see nsILoadInfo in nsILoadInfo.idl
|
||||
* @return reference to the new nsIChannel object
|
||||
*
|
||||
* Please note, if you provide both a loadingNode and a loadingPrincipal,
|
||||
* then loadingPrincipal must be equal to loadingNode->NodePrincipal().
|
||||
* But less error prone is to just supply a loadingNode.
|
||||
*/
|
||||
nsIChannel newChannelFromURIWithProxyFlags2(in nsIURI aURI,
|
||||
in nsIURI aProxyURI,
|
||||
in unsigned long aProxyFlags,
|
||||
in nsIDOMNode aLoadingNode,
|
||||
in nsIPrincipal aLoadingPrincipal,
|
||||
in nsIPrincipal aTriggeringPrincipal,
|
||||
in unsigned long aSecurityFlags,
|
||||
in unsigned long aContentPolicyType);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
@ -1,82 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#include "nsIIOService.idl"
|
||||
|
||||
interface nsIDOMNode;
|
||||
interface nsIPrincipal;
|
||||
|
||||
/**
|
||||
* nsIIOService2 extends nsIIOService
|
||||
*/
|
||||
[scriptable, uuid(52c5804b-0d3c-4d4f-8654-1c36fd310e69)]
|
||||
interface nsIIOService2 : nsIIOService
|
||||
{
|
||||
/**
|
||||
* While this is set, IOService will monitor an nsINetworkLinkService
|
||||
* (if available) and set its offline status to "true" whenever
|
||||
* isLinkUp is false.
|
||||
*
|
||||
* Applications that want to control changes to the IOService's offline
|
||||
* status should set this to false, watch for network:link-status-changed
|
||||
* broadcasts, and change nsIIOService::offline as they see fit. Note
|
||||
* that this means during application startup, IOService may be offline
|
||||
* if there is no link, until application code runs and can turn off
|
||||
* this management.
|
||||
*/
|
||||
attribute boolean manageOfflineStatus;
|
||||
|
||||
/**
|
||||
* Creates a channel for a given URI.
|
||||
*
|
||||
* @param aURI
|
||||
* nsIURI from which to make a channel
|
||||
* @param aProxyURI
|
||||
* nsIURI to use for proxy resolution. Can be null in which
|
||||
* case aURI is used
|
||||
* @param aProxyFlags flags from nsIProtocolProxyService to use
|
||||
* when resolving proxies for this new channel
|
||||
* @param aLoadingNode
|
||||
* @param aLoadingPrincipal
|
||||
* @param aTriggeringPrincipal
|
||||
* @param aSecurityFlags
|
||||
* @param aContentPolicyType
|
||||
* These will be used as values for the nsILoadInfo object on the
|
||||
* created channel. For details, see nsILoadInfo in nsILoadInfo.idl
|
||||
* @return reference to the new nsIChannel object
|
||||
*
|
||||
* Please note, if you provide both a loadingNode and a loadingPrincipal,
|
||||
* then loadingPrincipal must be equal to loadingNode->NodePrincipal().
|
||||
* But less error prone is to just supply a loadingNode.
|
||||
*/
|
||||
nsIChannel newChannelFromURIWithProxyFlags2(in nsIURI aURI,
|
||||
in nsIURI aProxyURI,
|
||||
in unsigned long aProxyFlags,
|
||||
in nsIDOMNode aLoadingNode,
|
||||
in nsIPrincipal aLoadingPrincipal,
|
||||
in nsIPrincipal aTriggeringPrincipal,
|
||||
in unsigned long aSecurityFlags,
|
||||
in unsigned long aContentPolicyType);
|
||||
|
||||
/**
|
||||
* ***** DEPRECATED *****
|
||||
* Please use newChannelFromURIWithProxyFlags2()
|
||||
*
|
||||
* Creates a channel for a given URI.
|
||||
*
|
||||
* @param aURI nsIURI from which to make a channel
|
||||
* @param aProxyURI nsIURI to use for proxy resolution. Can be null in which
|
||||
* case aURI is used
|
||||
* @param aProxyFlags flags from nsIProtocolProxyService to use
|
||||
* when resolving proxies for this new channel
|
||||
* @return reference to the new nsIChannel object
|
||||
*/
|
||||
nsIChannel newChannelFromURIWithProxyFlags(in nsIURI aURI,
|
||||
in nsIURI aProxyURI,
|
||||
in unsigned long aProxyFlags);
|
||||
|
||||
};
|
@ -368,7 +368,6 @@ nsIOService::GetInstance() {
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsIOService,
|
||||
nsIIOService,
|
||||
nsIIOService2,
|
||||
nsINetUtil,
|
||||
nsISpeculativeConnect,
|
||||
nsIObserver,
|
||||
@ -941,46 +940,6 @@ nsIOService::NewChannelFromURIWithProxyFlags2(nsIURI* aURI,
|
||||
result);
|
||||
}
|
||||
|
||||
/* ***** DEPRECATED *****
|
||||
* please use NewChannelFromURIWithProxyFlags2 providing the right arguments for:
|
||||
* * aLoadingNode
|
||||
* * aLoadingPrincipal
|
||||
* * aTriggeringPrincipal
|
||||
* * aSecurityFlags
|
||||
* * aContentPolicyType
|
||||
*
|
||||
* See nsIIoService.idl for a detailed description of those arguments
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannelFromURIWithProxyFlags(nsIURI *aURI,
|
||||
nsIURI *aProxyURI,
|
||||
uint32_t aProxyFlags,
|
||||
nsIChannel **result)
|
||||
{
|
||||
NS_ASSERTION(false, "Deprecated, use NewChannelFromURIWithProxyFlags2 providing loadInfo arguments!");
|
||||
|
||||
const char16_t* params[] = {
|
||||
u"nsIOService::NewChannelFromURIWithProxyFlags()",
|
||||
u"nsIOService::NewChannelFromURIWithProxyFlags2()"
|
||||
};
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("Security by Default"),
|
||||
nullptr, // aDocument
|
||||
nsContentUtils::eNECKO_PROPERTIES,
|
||||
"APIDeprecationWarning",
|
||||
params, ArrayLength(params));
|
||||
|
||||
return NewChannelFromURIWithProxyFlags2(aURI,
|
||||
aProxyURI,
|
||||
aProxyFlags,
|
||||
nullptr, // aLoadingNode
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nullptr, // aTriggeringPrincipal
|
||||
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
|
||||
nsIContentPolicy::TYPE_OTHER,
|
||||
result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::NewChannel2(const nsACString& aSpec,
|
||||
const char* aCharset,
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define nsIOService_h__
|
||||
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsIIOService2.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWeakPtr.h"
|
||||
@ -46,7 +46,7 @@ namespace net {
|
||||
class NeckoChild;
|
||||
class nsAsyncRedirectVerifyHelper;
|
||||
|
||||
class nsIOService final : public nsIIOService2
|
||||
class nsIOService final : public nsIIOService
|
||||
, public nsIObserver
|
||||
, public nsINetUtil
|
||||
, public nsISpeculativeConnect
|
||||
@ -56,7 +56,6 @@ class nsIOService final : public nsIIOService2
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIIOSERVICE
|
||||
NS_DECL_NSIIOSERVICE2
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSINETUTIL
|
||||
NS_DECL_NSISPECULATIVECONNECT
|
||||
|
@ -11,7 +11,7 @@
|
||||
* netwerk/base/ classes
|
||||
*/
|
||||
|
||||
// service implementing nsIIOService and nsIIOService2.
|
||||
// service implementing nsIIOService
|
||||
#define NS_IOSERVICE_CONTRACTID \
|
||||
"@mozilla.org/network/io-service;1"
|
||||
#define NS_IOSERVICE_CID \
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "nsIDNSRecord.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "nsIStreamConverterService.h"
|
||||
#include "nsIIOService2.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIProtocolProxyService.h"
|
||||
#include "nsIProxyInfo.h"
|
||||
#include "nsIProxiedChannel.h"
|
||||
@ -3468,15 +3468,9 @@ WebSocketChannel::AsyncOpen(nsIURI *aURI,
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIIOService2> io2 = do_QueryInterface(ioService, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("WebSocketChannel: unable to continue without ioservice2");
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Ideally we'd call newChannelFromURIWithLoadInfo here, but that doesn't
|
||||
// allow setting proxy uri/flags
|
||||
rv = io2->NewChannelFromURIWithProxyFlags2(
|
||||
rv = ioService->NewChannelFromURIWithProxyFlags2(
|
||||
localURI,
|
||||
mURI,
|
||||
nsIProtocolProxyService::RESOLVE_PREFER_HTTPS_PROXY |
|
||||
|
@ -105,7 +105,7 @@ add_task(async function testDirectProxy() {
|
||||
uri.scheme = "https";
|
||||
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService2);
|
||||
getService(Ci.nsIIOService);
|
||||
let chan = ioService.
|
||||
newChannelFromURIWithProxyFlags2(uri,
|
||||
proxyURI,
|
||||
@ -131,7 +131,7 @@ add_task(async function testWebSocketProxy() {
|
||||
Ci.nsIProtocolProxyService.RESOLVE_ALWAYS_TUNNEL;
|
||||
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService2);
|
||||
getService(Ci.nsIIOService);
|
||||
let chan = ioService.
|
||||
newChannelFromURIWithProxyFlags2(uri,
|
||||
proxyURI,
|
||||
|
@ -64,7 +64,7 @@ TPSCmdLineHandler.prototype = {
|
||||
Services.obs.removeObserver(onStartupFinished, "browser-delayed-startup-finished");
|
||||
/* Ignore the platform's online/offline status while running tests. */
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService2);
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
ios.manageOfflineStatus = false;
|
||||
ios.offline = false;
|
||||
Components.utils.import("resource://tps/tps.jsm");
|
||||
|
@ -11,7 +11,7 @@
|
||||
// Disable automatic network detection, so tests work correctly when
|
||||
// not connected to a network.
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService2);
|
||||
.getService(Ci.nsIIOService);
|
||||
ios.manageOfflineStatus = false;
|
||||
ios.offline = false;
|
||||
|
||||
|
@ -73,7 +73,7 @@ var _testLogger = new _LoggerClass("xpcshell/head.js", _dumpLog, [_add_params]);
|
||||
// not connected to a network.
|
||||
{
|
||||
let ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService2);
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
ios.manageOfflineStatus = false;
|
||||
ios.offline = false;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ XPCOMUtils.defineLazyGetter(Services, "ppmm", () => {
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, "io", () => {
|
||||
return Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService2)
|
||||
.getService(Ci.nsIIOService)
|
||||
.QueryInterface(Ci.nsISpeculativeConnect);
|
||||
});
|
||||
|
||||
|
@ -43,7 +43,6 @@ function run_test() {
|
||||
checkService("eTLD", Ci.nsIEffectiveTLDService);
|
||||
checkService("focus", Ci.nsIFocusManager);
|
||||
checkService("io", Ci.nsIIOService);
|
||||
checkService("io", Ci.nsIIOService2);
|
||||
checkService("intl", Ci.mozIMozIntl);
|
||||
checkService("locale", Ci.mozILocaleService);
|
||||
checkService("logins", Ci.nsILoginManager);
|
||||
|
@ -22,7 +22,7 @@ function getTestDataFile(aFilename) {
|
||||
}
|
||||
|
||||
function loadHelperScript(aScriptFile) {
|
||||
let io = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService2);
|
||||
let io = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
let scriptSpec = io.newFileURI(aScriptFile).spec;
|
||||
let scriptloader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
|
@ -63,7 +63,7 @@
|
||||
#include "nsIDialogParamBlock.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
#include "nsIIOService2.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsINativeAppSupport.h"
|
||||
#include "nsIPlatformInfo.h"
|
||||
@ -4368,7 +4368,7 @@ XREMain::XRE_mainRun()
|
||||
#endif
|
||||
|
||||
if (mStartOffline) {
|
||||
nsCOMPtr<nsIIOService2> io (do_GetService("@mozilla.org/network/io-service;1"));
|
||||
nsCOMPtr<nsIIOService> io(do_GetService("@mozilla.org/network/io-service;1"));
|
||||
NS_ENSURE_TRUE(io, NS_ERROR_FAILURE);
|
||||
io->SetManageOfflineStatus(false);
|
||||
io->SetOffline(true);
|
||||
|
@ -31,7 +31,6 @@ var servicesASTParser = {
|
||||
"nsIFrameScriptLoader": "mm",
|
||||
"nsIProcessScriptLoader": "ppmm",
|
||||
"nsIIOService": "io",
|
||||
"nsIIOService2": "io",
|
||||
"nsISpeculativeConnect": "io",
|
||||
"nsICookieManager": "cookies"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user