nsILoadContext.idl (4466B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "nsISupports.idl" 8 9 interface mozIDOMWindowProxy; 10 11 webidl Element; 12 13 [ref] native OriginAttributes(mozilla::OriginAttributes); 14 15 %{C++ 16 #ifdef MOZILLA_INTERNAL_API 17 namespace mozilla { 18 class OriginAttributes; 19 } 20 #endif 21 %} 22 23 /** 24 * An nsILoadContext represents the context of a load. This interface 25 * can be queried for various information about where the load is 26 * happening. 27 */ 28 [builtinclass, scriptable, uuid(2813a7a3-d084-4d00-acd0-f76620315c02)] 29 interface nsILoadContext : nsISupports 30 { 31 /** 32 * associatedWindow is the window with which the load is associated, if any. 33 * Note that the load may be triggered by a document which is different from 34 * the document in associatedWindow, and in fact the source of the load need 35 * not be same-origin with the document in associatedWindow. This attribute 36 * may be null if there is no associated window. 37 */ 38 readonly attribute mozIDOMWindowProxy associatedWindow; 39 40 /** 41 * topWindow is the top window which is of same type as associatedWindow. 42 * This is equivalent to associatedWindow.top, but is provided here as a 43 * convenience. All the same caveats as associatedWindow of apply, of 44 * course. This attribute may be null if there is no associated window. 45 */ 46 readonly attribute mozIDOMWindowProxy topWindow; 47 48 /** 49 * topFrameElement is the <iframe>, <frame>, or <browser> element which 50 * contains the topWindow with which the load is associated. 51 * 52 * Note that we may have a topFrameElement even when we don't have an 53 * associatedWindow, if the topFrameElement's content lives out of process. 54 * topFrameElement is available in single-process and multiprocess contexts. 55 * Note that topFrameElement may be in chrome even when the nsILoadContext is 56 * associated with content. 57 */ 58 readonly attribute Element topFrameElement; 59 60 /** 61 * True if the load context is content (as opposed to chrome). This is 62 * determined based on the type of window the load is performed in, NOT based 63 * on any URIs that might be around. 64 */ 65 readonly attribute boolean isContent; 66 67 /* 68 * Attribute that determines if private browsing should be used. May not be 69 * changed after a document has been loaded in this context. 70 */ 71 attribute boolean usePrivateBrowsing; 72 73 /** 74 * Attribute that determines if remote (out-of-process) tabs should be used. 75 */ 76 readonly attribute boolean useRemoteTabs; 77 78 /** 79 * Determines if out-of-process iframes should be used. 80 */ 81 readonly attribute boolean useRemoteSubframes; 82 83 /* 84 * Attribute that determines if tracking protection should be used. May not be 85 * changed after a document has been loaded in this context. 86 */ 87 attribute boolean useTrackingProtection; 88 89 %{C++ 90 /** 91 * De-XPCOMed getter to make call-sites cleaner. 92 */ 93 bool UsePrivateBrowsing() 94 { 95 bool usingPB = false; 96 GetUsePrivateBrowsing(&usingPB); 97 return usingPB; 98 } 99 100 bool UseRemoteTabs() 101 { 102 bool usingRT = false; 103 GetUseRemoteTabs(&usingRT); 104 return usingRT; 105 } 106 107 bool UseRemoteSubframes() 108 { 109 bool usingRSF = false; 110 GetUseRemoteSubframes(&usingRSF); 111 return usingRSF; 112 } 113 114 bool UseTrackingProtection() 115 { 116 bool usingTP = false; 117 GetUseTrackingProtection(&usingTP); 118 return usingTP; 119 } 120 %} 121 122 /** 123 * Set the private browsing state of the load context, meant to be used internally. 124 */ 125 [noscript] void SetPrivateBrowsing(in boolean aInPrivateBrowsing); 126 127 /** 128 * Set the remote tabs state of the load context, meant to be used internally. 129 */ 130 [noscript] void SetRemoteTabs(in boolean aUseRemoteTabs); 131 132 /** 133 * Set the remote subframes bit of this load context. Exclusively meant to be used internally. 134 */ 135 [noscript] void SetRemoteSubframes(in boolean aUseRemoteSubframes); 136 137 /** 138 * A dictionary of the non-default origin attributes associated with this 139 * nsILoadContext. 140 */ 141 [binaryname(ScriptableOriginAttributes), implicit_jscontext] 142 readonly attribute jsval originAttributes; 143 144 /** 145 * The C++ getter for origin attributes. 146 */ 147 [noscript, notxpcom] void GetOriginAttributes(out OriginAttributes aAttrs); 148 };