Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIRequest; |
michael@0 | 9 | interface nsIFrame; |
michael@0 | 10 | interface nsIObjectFrame; |
michael@0 | 11 | interface nsIPluginTag; |
michael@0 | 12 | interface nsIDOMElement; |
michael@0 | 13 | interface nsIDOMClientRect; |
michael@0 | 14 | interface nsIURI; |
michael@0 | 15 | |
michael@0 | 16 | %{C++ |
michael@0 | 17 | class nsNPAPIPluginInstance; |
michael@0 | 18 | %} |
michael@0 | 19 | [ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance); |
michael@0 | 20 | |
michael@0 | 21 | /** |
michael@0 | 22 | * This interface represents a content node that loads objects. |
michael@0 | 23 | * |
michael@0 | 24 | * Please make sure to update the MozObjectLoadingContent WebIDL |
michael@0 | 25 | * interface to mirror this interface when changing it. |
michael@0 | 26 | */ |
michael@0 | 27 | |
michael@0 | 28 | [scriptable, uuid(16c14177-52eb-49d3-9842-a1a0b92be11a)] |
michael@0 | 29 | interface nsIObjectLoadingContent : nsISupports |
michael@0 | 30 | { |
michael@0 | 31 | /** |
michael@0 | 32 | * See notes in nsObjectLoadingContent.h |
michael@0 | 33 | */ |
michael@0 | 34 | const unsigned long TYPE_LOADING = 0; |
michael@0 | 35 | const unsigned long TYPE_IMAGE = 1; |
michael@0 | 36 | const unsigned long TYPE_PLUGIN = 2; |
michael@0 | 37 | const unsigned long TYPE_DOCUMENT = 3; |
michael@0 | 38 | const unsigned long TYPE_NULL = 4; |
michael@0 | 39 | |
michael@0 | 40 | const unsigned long PLUGIN_ACTIVE = 0xFF; |
michael@0 | 41 | |
michael@0 | 42 | // The content type is not supported (e.g. plugin not installed) |
michael@0 | 43 | const unsigned long PLUGIN_UNSUPPORTED = 0; |
michael@0 | 44 | // Showing alternate content |
michael@0 | 45 | const unsigned long PLUGIN_ALTERNATE = 1; |
michael@0 | 46 | // The plugin exists, but is disabled |
michael@0 | 47 | const unsigned long PLUGIN_DISABLED = 2; |
michael@0 | 48 | // The plugin is blocklisted and disabled |
michael@0 | 49 | const unsigned long PLUGIN_BLOCKLISTED = 3; |
michael@0 | 50 | // The plugin is considered outdated, but not disabled |
michael@0 | 51 | const unsigned long PLUGIN_OUTDATED = 4; |
michael@0 | 52 | // The plugin has crashed |
michael@0 | 53 | const unsigned long PLUGIN_CRASHED = 5; |
michael@0 | 54 | // Suppressed by security policy |
michael@0 | 55 | const unsigned long PLUGIN_SUPPRESSED = 6; |
michael@0 | 56 | // Blocked by content policy |
michael@0 | 57 | const unsigned long PLUGIN_USER_DISABLED = 7; |
michael@0 | 58 | /// ** All values >= PLUGIN_CLICK_TO_PLAY are plugin placeholder types that |
michael@0 | 59 | /// would be replaced by a real plugin if activated (playPlugin()) |
michael@0 | 60 | /// ** Furthermore, values >= PLUGIN_CLICK_TO_PLAY and |
michael@0 | 61 | /// <= PLUGIN_VULNERABLE_NO_UPDATE are click-to-play types. |
michael@0 | 62 | // The plugin is disabled until the user clicks on it |
michael@0 | 63 | const unsigned long PLUGIN_CLICK_TO_PLAY = 8; |
michael@0 | 64 | // The plugin is vulnerable (update available) |
michael@0 | 65 | const unsigned long PLUGIN_VULNERABLE_UPDATABLE = 9; |
michael@0 | 66 | // The plugin is vulnerable (no update available) |
michael@0 | 67 | const unsigned long PLUGIN_VULNERABLE_NO_UPDATE = 10; |
michael@0 | 68 | // The plugin is in play preview mode |
michael@0 | 69 | const unsigned long PLUGIN_PLAY_PREVIEW = 11; |
michael@0 | 70 | |
michael@0 | 71 | /** |
michael@0 | 72 | * The actual mime type (the one we got back from the network |
michael@0 | 73 | * request) for the element. |
michael@0 | 74 | */ |
michael@0 | 75 | readonly attribute ACString actualType; |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * Gets the type of the content that's currently loaded. See |
michael@0 | 79 | * the constants above for the list of possible values. |
michael@0 | 80 | */ |
michael@0 | 81 | readonly attribute unsigned long displayedType; |
michael@0 | 82 | |
michael@0 | 83 | /** |
michael@0 | 84 | * Gets the content type that corresponds to the give MIME type. See the |
michael@0 | 85 | * constants above for the list of possible values. If nothing else fits, |
michael@0 | 86 | * TYPE_NULL will be returned. |
michael@0 | 87 | */ |
michael@0 | 88 | unsigned long getContentTypeForMIMEType(in AUTF8String aMimeType); |
michael@0 | 89 | |
michael@0 | 90 | /** |
michael@0 | 91 | * Returns the base URI of the object as seen by plugins. This differs from |
michael@0 | 92 | * the normal codebase in that it takes <param> tags and plugin-specific |
michael@0 | 93 | * quirks into account. |
michael@0 | 94 | */ |
michael@0 | 95 | [noscript] readonly attribute nsIURI baseURI; |
michael@0 | 96 | |
michael@0 | 97 | /** |
michael@0 | 98 | * Returns the plugin instance if it has already been instantiated. This |
michael@0 | 99 | * will never instantiate the plugin and so is safe to call even when |
michael@0 | 100 | * content script must not execute. |
michael@0 | 101 | */ |
michael@0 | 102 | [noscript] readonly attribute nsNPAPIPluginInstancePtr pluginInstance; |
michael@0 | 103 | |
michael@0 | 104 | /** |
michael@0 | 105 | * Tells the content about an associated object frame. |
michael@0 | 106 | * This can be called multiple times for different frames. |
michael@0 | 107 | * |
michael@0 | 108 | * This is noscript because this is an internal method that will go away, and |
michael@0 | 109 | * because nsIObjectFrame is unscriptable. |
michael@0 | 110 | */ |
michael@0 | 111 | [noscript] void hasNewFrame(in nsIObjectFrame aFrame); |
michael@0 | 112 | |
michael@0 | 113 | /** |
michael@0 | 114 | * If this object is in going to be printed, this method |
michael@0 | 115 | * returns the nsIObjectFrame object which should be used when |
michael@0 | 116 | * printing the plugin. The returned nsIFrame is in the original document, |
michael@0 | 117 | * not in the static clone. |
michael@0 | 118 | */ |
michael@0 | 119 | [noscript] nsIFrame getPrintFrame(); |
michael@0 | 120 | |
michael@0 | 121 | /* |
michael@0 | 122 | * Notifications from pluginhost that our instance crashed or was destroyed. |
michael@0 | 123 | */ |
michael@0 | 124 | [noscript] void pluginDestroyed(); |
michael@0 | 125 | [noscript] void pluginCrashed(in nsIPluginTag pluginTag, |
michael@0 | 126 | in AString pluginDumpID, |
michael@0 | 127 | in AString browserDumpID, |
michael@0 | 128 | in boolean submittedCrashReport); |
michael@0 | 129 | |
michael@0 | 130 | /** |
michael@0 | 131 | * This method will play a plugin that has been stopped by the |
michael@0 | 132 | * click-to-play plugins or play-preview features. |
michael@0 | 133 | */ |
michael@0 | 134 | void playPlugin(); |
michael@0 | 135 | |
michael@0 | 136 | /** |
michael@0 | 137 | * Forces a re-evaluation and reload of the tag, optionally invalidating its |
michael@0 | 138 | * click-to-play state. This can be used when the MIME type that provides a |
michael@0 | 139 | * type has changed, for instance, to force the tag to re-evalulate the |
michael@0 | 140 | * handler to use. |
michael@0 | 141 | */ |
michael@0 | 142 | void reload(in boolean aClearActivation); |
michael@0 | 143 | |
michael@0 | 144 | /** |
michael@0 | 145 | * This attribute will return true if the current content type has been |
michael@0 | 146 | * activated, either explicitly or by passing checks that would have it be |
michael@0 | 147 | * click-to-play or play-preview. |
michael@0 | 148 | */ |
michael@0 | 149 | readonly attribute boolean activated; |
michael@0 | 150 | |
michael@0 | 151 | [noscript] void stopPluginInstance(); |
michael@0 | 152 | |
michael@0 | 153 | [noscript] void syncStartPluginInstance(); |
michael@0 | 154 | [noscript] void asyncStartPluginInstance(); |
michael@0 | 155 | |
michael@0 | 156 | /** |
michael@0 | 157 | * Puts the tag in the "waiting on a channel" state and adopts this |
michael@0 | 158 | * channel. This does not override the normal logic of examining attributes |
michael@0 | 159 | * and the channel type, so the load may cancel this channel if it decides not |
michael@0 | 160 | * to use one. |
michael@0 | 161 | * |
michael@0 | 162 | * This assumes: |
michael@0 | 163 | * - This tag has not begun loading yet |
michael@0 | 164 | * - This channel has not yet hit OnStartRequest |
michael@0 | 165 | * - The caller will continue to pass channel events to us as a listener |
michael@0 | 166 | */ |
michael@0 | 167 | [noscript] void initializeFromChannel(in nsIRequest request); |
michael@0 | 168 | |
michael@0 | 169 | /** |
michael@0 | 170 | * The URL of the data/src loaded in the object. This may be null (i.e. |
michael@0 | 171 | * an <embed> with no src). |
michael@0 | 172 | */ |
michael@0 | 173 | readonly attribute nsIURI srcURI; |
michael@0 | 174 | |
michael@0 | 175 | /** |
michael@0 | 176 | * The plugin's current state of fallback content. This property |
michael@0 | 177 | * only makes sense if the plugin is not activated. |
michael@0 | 178 | */ |
michael@0 | 179 | readonly attribute unsigned long pluginFallbackType; |
michael@0 | 180 | |
michael@0 | 181 | /** |
michael@0 | 182 | * If this object currently owns a running plugin, regardless of whether or |
michael@0 | 183 | * not one is pending spawn/despawn. |
michael@0 | 184 | */ |
michael@0 | 185 | readonly attribute bool hasRunningPlugin; |
michael@0 | 186 | |
michael@0 | 187 | /** |
michael@0 | 188 | * This method will disable the play-preview plugin state. |
michael@0 | 189 | */ |
michael@0 | 190 | void cancelPlayPreview(); |
michael@0 | 191 | }; |