Files
palemoon27/docshell/base/nsILoadContext.idl
T
roytam1 c39d750e67 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1198230 - Respect FetchEvent.preventDefault(). r=jdm (acc8e103cf)
- Bug 1183813 - PushEvent.data should be same instance every time. r=smaug (4e74889cb6)
- Bug 1190478 - Hide PushEvent.data until we ship message encryption. r=mt,jst (16c158d76e)
- Bug 1144660 - Make KeepAliveHandler threadsafe refcounted. r=ehsan (77dde56da9)
- Bug 1191647 - Listen to clear-origin-data in ServiceWorkerManager.cpp. r=bkelly (eda9f683db)
- Bug 1189675 - Make all ServiceWorker events non cancelable. r=catalinb (10c9b30da1)
- Bug 1181056 - waitUntil() should throw if called when event is not dispatching. r=smaug (b0355e7571)
- Bug 1189644 - Update waitUntil() and activation to spec. r=catalinb (feef7f7963)
- Bug 1189668 - Expose GetUnfilteredUrl on InternalResponse. r=ehsan (ece8356282)
- Bug 942515 - Show Untrusted Connection Error for SHA-1-based SSL certificates with notBefore >= 2016-01-01 r=keeler (4ad8c1c58e)
- code style (279edb609a)
- style (3b6873d924)
- Bug 1203790 - Trigger a pre barrier when shrinking the initialized length of unboxed arrays, r=jandem. (d5bb7a710b)
- Bug 1205870 - Make sure all possible unboxed array inline capacities are accounted for, r=jandem. (694b1cbf8d)
- Bug 1193459 review follow-up: Copy the comment from TraceKind.h. DONTBUILD CLOSED TREE (d8b7d2a8c4)
- missing extern qualifier and some style (fd9f8899df)
- Bug 1200444 - Make JS::dbg::{IsDebugger,GetDebuggeeGlobals} handle CCWs; r=sfink (0e486daa82)
- Bug 1204790 - Prefer deleted function with public access specifiers instead of private in UniquePtr. r=nfroyd (d6796b1f4d)
- clean old comment (22b342cbe7)
- Bug 1165466 - Fix up docshell and loadcontext inheriting code in nsIScriptSecurityManager. r=bholley (478eb72ff4)
- Bug 1189235 - Use originAttribute for ServiceWorkerRegistrar. r=baku (b0c3f5e0a8)
- Bug 1203916 - Get rid of NS_DOMReadStructuredClone and NS_DOMWriteStructuredClone, r=smaug (0f56e93bbc)
- Bug 1163254 - Add signedPkg to OriginAttributes. r=bholley (c661f106e7)
- Bug 1168226 - ServiceWorkerRegistrar only use the scope when registering a service worker. r=baku (ddc3e393ac)
- Bug 1183894 - Remove warning if MessagePort::CloseInternal is called before start. r=khuey (3553d2091f)
- Bug 1204775 - SharedWorker.port should be a 'real' MessagePort, r=khuey (3ff36c45f5)
- Bug 1188776 - Remove appId/isInBrowserElement from BroadcastChannel. r=bholley (ee1f91cf09)
- Bug 1199265 - Correct actor for Blob in StructuredCloneHelper, r=khuey (c05b33d6d2)
- Bug 1196371 - Add a runtime assertion against illegal string characters in OriginAttributes suffix creation. r=janv,r=mystor (5ee44eec67)
- namespace style (d3c3738b42)
- Bug 871846 - Database changes for locale aware indexes. r=janv (185ecd2bcc)
- Bug 871846 - ICU usage and infrastructure bits. r=janv (5eabbaac22)
- remove strange hack (1169852a68)
- Bug 871846 - Handle locale aware indexes. r=janv (36f37c5e6f)
- Bug 871846 - Implement IDBLocaleAwareKeyRange. r=janv r=sicking (270ed240cc)
- Bug 871846 - Tests for locale aware indexes. r=janv (4eb2a168c8)
- Bug 1180978: Don't proceed with opening an invalidated database. r=janv,baku (54836535c6)
- Bug 1192023 - Use enum class instead of State_ prefix. r=khuey (8df8ed6b1a)
- Bug 871846 - API changes for locale aware indexes. r=janv r=sicking (75ce5c7bb6)
2022-07-26 17:13:16 +08:00

168 lines
5.4 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin
* 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 "nsISupports.idl"
interface nsIDOMWindow;
interface nsIDOMElement;
%{C++
#ifdef MOZILLA_INTERNAL_API
#include "mozilla/BasePrincipal.h" // for OriginAttributes
#include "mozilla/dom/ScriptSettings.h" // for AutoJSAPI
#include "xpcpublic.h" // for PrivilegedJunkScope
#include "nsContentUtils.h" // for IsSystemPrincipal
#endif
%}
/**
* An nsILoadContext represents the context of a load. This interface
* can be queried for various information about where the load is
* happening.
*/
[scriptable, uuid(1220e340-b337-4c35-aaa1-f51362763621)]
interface nsILoadContext : nsISupports
{
/**
* associatedWindow is the window with which the load is associated, if any.
* Note that the load may be triggered by a document which is different from
* the document in associatedWindow, and in fact the source of the load need
* not be same-origin with the document in associatedWindow. This attribute
* may be null if there is no associated window.
*/
readonly attribute nsIDOMWindow associatedWindow;
/**
* topWindow is the top window which is of same type as associatedWindow.
* This is equivalent to associatedWindow.top, but is provided here as a
* convenience. All the same caveats as associatedWindow of apply, of
* course. This attribute may be null if there is no associated window.
*/
readonly attribute nsIDOMWindow topWindow;
/**
* topFrameElement is the <iframe>, <frame>, or <browser> element which
* contains the topWindow with which the load is associated.
*
* Note that we may have a topFrameElement even when we don't have an
* associatedWindow, if the topFrameElement's content lives out of process.
* topFrameElement is available in single-process and multiprocess contexts.
* Note that topFrameElement may be in chrome even when the nsILoadContext is
* associated with content.
*/
readonly attribute nsIDOMElement topFrameElement;
/**
* If this LoadContext corresponds to a nested remote iframe, we don't have
* access to the topFrameElement. Instead, we must use this id to send
* messages. A return value of 0 signifies that this load context is not for
* a nested frame.
*/
readonly attribute unsigned long long nestedFrameId;
/**
* Check whether the load is happening in a particular type of application.
*
* @param an application type. For now, the constants to be passed here are
* the nsIDocShell APP_TYPE_* constants.
*
* @return whether there is some ancestor of the associatedWindow that is of
* the given app type.
*/
boolean isAppOfType(in unsigned long appType);
/**
* True if the load context is content (as opposed to chrome). This is
* determined based on the type of window the load is performed in, NOT based
* on any URIs that might be around.
*/
readonly attribute boolean isContent;
/*
* Attribute that determines if private browsing should be used.
*/
attribute boolean usePrivateBrowsing;
/**
* Attribute that determines if remote (out-of-process) tabs should be used.
*/
readonly attribute boolean useRemoteTabs;
%{C++
/**
* De-XPCOMed getter to make call-sites cleaner.
*/
bool UsePrivateBrowsing() {
bool usingPB;
GetUsePrivateBrowsing(&usingPB);
return usingPB;
}
bool UseRemoteTabs() {
bool usingRT;
GetUseRemoteTabs(&usingRT);
return usingRT;
}
%}
/**
* Set the private browsing state of the load context, meant to be used internally.
*/
[noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing);
/**
* Set the remote tabs state of the load context, meant to be used internally.
*/
[noscript] void SetRemoteTabs(in boolean aUseRemoteTabs);
/**
* Returns true iff the load is occurring inside a browser element.
*/
readonly attribute boolean isInBrowserElement;
/**
* Returns the app id of the app the load is occurring is in. Returns
* nsIScriptSecurityManager::NO_APP_ID if the load is not part of an app.
*/
readonly attribute unsigned long appId;
/**
* A dictionary of the non-default origin attributes associated with this
* nsILoadContext.
*/
readonly attribute jsval originAttributes;
%{C++
#ifdef MOZILLA_INTERNAL_API
/**
* The C++ getter for origin attributes.
*/
bool GetOriginAttributes(mozilla::OriginAttributes& aAttrs)
{
mozilla::dom::AutoJSAPI jsapi;
bool ok = jsapi.Init(xpc::PrivilegedJunkScope());
NS_ENSURE_TRUE(ok, false);
JS::Rooted<JS::Value> v(jsapi.cx());
nsresult rv = GetOriginAttributes(&v);
NS_ENSURE_SUCCESS(rv, false);
MOZ_ASSERT(v.isObject());
JS::Rooted<JSObject*> obj(jsapi.cx(), &v.toObject());
// If we're JS-implemented, the object will be left in a different (System-Principaled)
// scope, so we may need to enter its compartment.
MOZ_ASSERT(nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(obj)));
JSAutoCompartment ac(jsapi.cx(), obj);
mozilla::OriginAttributes attrs;
ok = attrs.Init(jsapi.cx(), v);
NS_ENSURE_TRUE(ok, false);
aAttrs = attrs;
return true;
}
#endif
%}
};