Bug 1911759 - Add nsIIOService.originAttributesForNetworkState r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D209819
This commit is contained in:
@@ -168,6 +168,14 @@ interface nsIIOService : nsISupports
|
||||
*/
|
||||
nsIWebTransport newWebTransport();
|
||||
|
||||
|
||||
/**
|
||||
* Calls GetOriginAttributesForNetworkState
|
||||
* see StoragePrincipalHelper.h
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
jsval originAttributesForNetworkState(in nsIChannel aChannel);
|
||||
|
||||
/**
|
||||
* Returns true if networking is in "offline" mode. When in offline mode,
|
||||
* attempts to access the network will fail (although this does not
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include "mozilla/net/SocketProcessHost.h"
|
||||
#include "mozilla/net/SocketProcessParent.h"
|
||||
#include "mozilla/net/SSLTokensCache.h"
|
||||
#include "mozilla/StoragePrincipalHelper.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsContentSecurityManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
@@ -1254,6 +1255,22 @@ nsIOService::NewWebTransport(nsIWebTransport** result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::OriginAttributesForNetworkState(
|
||||
nsIChannel* aChannel, JSContext* cx, JS::MutableHandle<JS::Value> _retval) {
|
||||
OriginAttributes attrs;
|
||||
if (!StoragePrincipalHelper::GetOriginAttributesForNetworkState(aChannel,
|
||||
attrs)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!mozilla::dom::ToJSValue(cx, attrs, _retval))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool nsIOService::IsLinkUp() {
|
||||
InitializeNetworkLinkService();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user