mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
8a0a002cf2
- Bug 1148708: Add missing 'override' annotations in DocAccessibleChild.h. rs=ehsan (d606358545)
- Bug 1210408 - make nsMaiInterfaceAction work with proxies, r=tbsaunde (f7c819c6ae)
- Bug 1210407 - teach nsMaiInterfaceTable to use proxies, r=tbsaunde (4ca4f10b5f)
- bug 1185157 make sure we don't send an event to a destroyed ipc document r=billm (23acf53f75)
- bug 1214864 - make SetCarretOffset() async r=davidb (e3079e9b2d)
- missing of Bug 1139972 - IPC Proxy for charAt, r=tbsaunde (e9593ed752)
- bug 1191598 - Pass MOZ_CURRENT_PROJECT in environment when running post-build automation steps for universal mac builds. r=gps (fc342c6ced)
- Bug 1164596 - Add mach android-emulator command; r=ahal (afeb9b27d1)
- Bug 1223149 - Add basic usage documentation for mach build; r=glandium (bfb802d175)
- Bug 1182301 - Improve 'mach build' notifications. r=gps (2c65a122d1)
- Bug 1184696 - Add clobber targets to |mach clobber|; Ability to clobber compiled python files, r=gps (35d8be292e)
- Bug 1117958 - Allow any debugging options to the run or gtest mach subcommands to automatically enable debugging. r=gps (32f986af4b)
- Bug 1180081 - Properly rebuild gtest/libxul before running gtests. r=gps (80db9a3d49)
- Bug 1171647, part 1 - Define a new function to convert the mode to a string. r=njn (61ad16f5ba)
- Bug 1171647, part 2 - Remove redundant assertion for dark matter mode. r=njn (b5ac9519f3)
- Bug 1058178, part 1 - Implement DMD heap scanning mode. r=njn (60e1079536)
- Bug 1058178, part 2 - Implement address clamping analysis for DMD scan logs. r=njn (45c0326b93)
- Bug 1102388 - Fix DMD static constructor ordering dependency. r=mccr8 (59b87897a1)
- Bug 1128705 - Don't redefine PAGE_SIZE in DMD if it's already defined. r=erahm (49216348ee)
- Bug 1179042 - Add a script for analyzing memory blocks using a heap scan DMD log. r=njn DONTBUILD (1c08d2d66e)
- Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat (1c999d139b)
- Bug 1158772 - fix non-idiomatic memset call in nsDeque.cpp; r=erahm (de6b555245)
- Bug 1199400 - Part 1: Use CheckedInt when growing nsDeque capacity. r=froydnj (dfdf6814a3)
- Bug 1199400 - Part 0: Remove unused nsDequeIterator. r=froydnj (38d69d7f47)
- Bug 1199400 - Part 2: Add tests for possible nsDeque corner cases. r=froydnj (931baff195)
- Bug 1201997 - Part 1 - Converted compiled test to gtest for nsDeque class. Added tests to test untested methods. r=froydn (e893916651)
- Bug 1201997 - Part 2 - Removing unused methods from the nsDeque class. r=froydn (41595a90ac)
- Bug 1201997 - Part 3 - Make internally used methods private. r=froydn (8cd3afd96f)
- Bug 1201997 - Part 4 - Change size and offset variables to size_t.r=froydn (73eabc8d60)
- Bug 1215140 P1 Add an nsIConsoleReportCollector interface to support navigation channel logging. r=bz (8a41535e2b)
- Bug 1215140 P2 Make HttpBaseChannel implement nsIConsoleReportCollector. r=bz (75fca301f2)
- Bug 1197679 - If nsUnknownDecoder is involved in e10s DivertToParent can break. r=jduell (5d94a12504)
- Bug 1178991 - smartptr for http converter r=hurley (8e7fbc8443)
- bug 366559 - patch 2, fix nsHTTPCompressConv indentation r=bagder (ba762da587)
- bug 366559 - patch 3, fix nsHTTPCompressConv bracing style r=bagder (54195ab451)
- bits of bug 366559 - patch 7, content-encoding brotli for http (f0b4051022)
- Bug 1205112 - Make PushEvent.data nullable. r=mt,smaug (775db32856)
- Bug 1193414 - SharedWorkers thread should be kept alive also when the SharedWorker object is CCed, r=khuey (b77ea8125c)
- Bug 1206520: Add about:config prefs to enable throwing on asm.js validation failures; r=bz (c42126665d)
- Bug 1193414 - Telemetry for SharedWorker spawning. r=bkelly (77984b7bcc)
- Bug 1205676 - Enable WPT service-worker/unregister-then-register-new-script.https.html in e10s, r=nsm (ec24939cf6)
- Bug 1193133 - Throw when calling postMessage from a Service Worker dom object with no global. r=bkelly (526dcacfab)
- Bug 1181871 P1 Only enforce Cache Context shared data destruction on target thread after init. r=ehsan (cdbf3ed3a8)
- Bug 1181871 P2 Fix ServiceWorkerManager usage of stack-based ErrorResult. r=ehsan (c449195d90)
- minor cleanup and missing bit of 1198230 (02f459db05)
- Bug 1143717 - Implement the ServiceWorkerMessageEvent interface. r=baku (027b3465f2)
- fix misspatch (708eee4e84)
- Bug 1188545 - Disentangle service workers from shared workers and refactor event dispatching code into a separate class. r=nsm,mrbkap (fb5b5341c9)
- Bug 1205228 - Change PackagedAppVerifier to notify the verification result asynchronously. r=valentin. (9edda0fa00)
- Bug 1178518 - Packaged App Utils. r=valentin (f60f3b7a93)
- Bug 1213150 - Part 1: Add a nsContentUtils::IsNonSubresourceRequest helper; r=jdm (b509cc3cc9)
- Bug 1213150 - Part 2: Rework ShouldPrepareForIntercept() in terms of subresource requests; r=jdm (2e92fe8780)
- Bug 1213150 - Part 3: Remove nsIInterceptedChannel.isNavigation; r=jdm (becf1cc12f)
- Bug 1213150 follow-up: fix build bustage (8d73d6ca73)
- Bug 1198394 - Part 1: Allow interception of HSTS upgraded connections in non-e10s mode; r=mcmanus (f504c5be08)
- Bug 1198394 - Part 2: Add a test for interception of HSTS upgraded connections; r=jdm (054e984eef)
- Bug 1187011 - Don't allow response body with null body status. r=bkelly (b1860741d1)
- missing bit of 1140788 (29d319712e)
- Bug 1213436 - Reject core dumps with node IDs that don't fit in an IEEE 754 double; r=sfink (3c1f6fdda0)
- Bug 1211006 - Add Debugger.Source.prototype.canonicalId; r=ejpbruel (eef7b79fce)
- Bug 1199218 - Implement JS::ubi::Node::size for js::LazyScript referents; r=sfink (098a48d240)
- Bug 1220031 - Add JS::ubi::Node::scriptFilename; r=sfink (6b824ae680)
- Bug 1143575. Remove unused MediaQueue::Empty. r=cpearce (de737f3433)
- Bug 1209933 - Make sure all parent runtime pointers are the topmost parent, r=billm. (fe824d967d)
- Bug 1197012 - Fix ThrowTypeError in Notification. r=mccr8 (0b1a097526)
- Bug 1197893 - Check the number of arguments for ThrowTypeError() and ThrowRangeError() at compile time. r=peterv (d98c7d78a0)
- Bug 1142083 - Add test for IDN Unicode domain redirect. r=mcmanus (0c8961fe17)
- Bug 1187159 - Add mochitest for loading packaged apps (iframe+fetch+mozapp) r=jduell (ce90ea561b)
- Bug 1186290 - Notify TabParent to switch process when loading a signed package. r=honzab, r=kanru. (c58a14554a)
- fix (15e2df75eb)
- Bug 1206124 P1 Fix "same-origin" CORS credentials in FetchDriver. r=ehsan (fae1bb6ab3)
- Bug 1206124 P2 Test fetch() with credentials and redirects. r=ehsan (ffc6254112)
- Bug 1211751: Remove nsIChannelEventSink-forwarding from EventSource and FetchDriver. It's never needed. r=smaug (adafe5737a)
- Bug 1212433 Fail fetch() calls that require preflight and also redirect. r=sicking a=abillings (c0d6742b9e)
- Bug 1193128 - Fix base64 decoding when fetching data URIs. r=baku (80bafa291a)
- Bug 1195167 part 1: Let necko handle all protocols. r=bkelly (bb932b0ada)
- Bug 1195167 part 2: Remove redundant aCORSFlag argument and instead use mCORSFlagEverSet. r=bkelly (beadafcad0)
- Bug 1195167 part 3: Remove more scheme-specific handling from FetchDriver. r=bkelly (d00b38db9e)
- Bug 1195167 part 4: Remove FetchDriver::BasicFetch since it is empty. r=bkelly (c5ed097267)
- Bug 1210413 P2 Test CORS credentials on cross-origin redirects. r=sicking a=dveditz (b4eeb8aac0)
- Bug 1210413 P1 Propagate new channel load flags from child to parent on redirect. r=jduell a=dveditz (8b329af4fa)
- Bug 1195167 part 5: Make FetchDriver use AsyncOpen2. r=bkelly (cc217c4cc1)
- Bug 1195167 part 6: Some code simplification since necko handles fetch recursion. r=bkelly (f3b6da2262)
- Bug 1195167: Followup to fix test which I forgot to change (81e7439a2e)
- Bug 1215746: Remove RequestMode::Cors_with_forced_preflight. r=bkelly (0336e812b6)
- Bug 1211000: Move CORS preflight logic from nsCORSListenerProxy to nsCORSPreflightListener. r=ehsan (bf2f71cf22)
- missing bit of Bug 1211443 - Drop scheduled update if decoder initialization isn't done yet. r=jya (f6bc074e33)
- Bug 1182571: Fix nsILoadInfo->GetContentPolicyType API to be less ambigious. Audit and fix all users of it. r=ckerschb (5af6fa7442)
- fix (e40c8e7625)
- Bug 1173811 - Part 1: Propagate the response URL to intercepted channels when necessary (non-e10s). r=mayhemer,bkelly (26f4f13c28)
- Bug 1173811 - Part 2: Propagate the response URL to intercepted channels when necessary (e10s). r=mayhemer,bkelly (a603fe1df2)
- Bug 1154309 - Add New Resource Timing Fields r=bz,hurley (1d14eb6bef)
- Bug 1175685 - add OriginAttribute to LoadInfo. r=jonas, r=ckerschb, r=michal (a5d18bb637)
- Bug 1175685 - add OriginAttribute to LoadInfo. r=jonas, r=ckerschb, r=michal (fb07d2c8aa)
- Bug 1212904 P1 Add a LoadTainting enumeration. r=jduell (a1db8a3e99)
- Bug 1212904 P2 Add LoadTainting information to nsILoadInfo. r=jduell (2482e5e334)
- Bug 1221151 - use [infallible] in nsILoadInfo.idl instead of manual %{C++ blocks; r=jduell (aae73129b6)
- Bug 1045891 - CSP 2 child-src implementation r=ckerschb (792920aeb9)
- Bug 1219931 - CSP: Don't allow removing a policy (r=sicking) (9daaab4186)
- Bug 1208661 - Dump client-side layer textures. r=BenWa (1f2d17d515)
646 lines
24 KiB
C++
646 lines
24 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* 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/. */
|
|
|
|
/*
|
|
* A base class implementing nsIObjectLoadingContent for use by
|
|
* various content nodes that want to provide plugin/document/image
|
|
* loading functionality (eg <embed>, <object>, <applet>, etc).
|
|
*/
|
|
|
|
#ifndef NSOBJECTLOADINGCONTENT_H_
|
|
#define NSOBJECTLOADINGCONTENT_H_
|
|
|
|
#include "mozilla/Attributes.h"
|
|
#include "nsImageLoadingContent.h"
|
|
#include "nsIStreamListener.h"
|
|
#include "nsIChannelEventSink.h"
|
|
#include "nsIContentPolicy.h"
|
|
#include "nsIObjectLoadingContent.h"
|
|
#include "nsIRunnable.h"
|
|
#include "nsIThreadInternal.h"
|
|
#include "nsIFrame.h"
|
|
#include "nsIFrameLoader.h"
|
|
|
|
class nsAsyncInstantiateEvent;
|
|
class nsStopPluginRunnable;
|
|
class AutoSetInstantiatingToFalse;
|
|
class nsPluginFrame;
|
|
class nsFrameLoader;
|
|
class nsXULElement;
|
|
class nsPluginInstanceOwner;
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
template<typename T> class Sequence;
|
|
struct MozPluginParameter;
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
class nsObjectLoadingContent : public nsImageLoadingContent
|
|
, public nsIStreamListener
|
|
, public nsIFrameLoaderOwner
|
|
, public nsIObjectLoadingContent
|
|
, public nsIChannelEventSink
|
|
{
|
|
friend class AutoSetInstantiatingToFalse;
|
|
friend class AutoSetLoadingToFalse;
|
|
friend class CheckPluginStopEvent;
|
|
friend class nsStopPluginRunnable;
|
|
friend class nsAsyncInstantiateEvent;
|
|
|
|
public:
|
|
// This enum's values must be the same as the constants on
|
|
// nsIObjectLoadingContent
|
|
enum ObjectType {
|
|
// Loading, type not yet known. We may be waiting for a channel to open.
|
|
eType_Loading = TYPE_LOADING,
|
|
// Content is a *non-svg* image
|
|
eType_Image = TYPE_IMAGE,
|
|
// Content is a plugin
|
|
eType_Plugin = TYPE_PLUGIN,
|
|
// Content is a subdocument, possibly SVG
|
|
eType_Document = TYPE_DOCUMENT,
|
|
// No content loaded (fallback). May be showing alternate content or
|
|
// a custom error handler - *including* click-to-play dialogs
|
|
eType_Null = TYPE_NULL
|
|
};
|
|
enum FallbackType {
|
|
// The content type is not supported (e.g. plugin not installed)
|
|
eFallbackUnsupported = nsIObjectLoadingContent::PLUGIN_UNSUPPORTED,
|
|
// Showing alternate content
|
|
eFallbackAlternate = nsIObjectLoadingContent::PLUGIN_ALTERNATE,
|
|
// The plugin exists, but is disabled
|
|
eFallbackDisabled = nsIObjectLoadingContent::PLUGIN_DISABLED,
|
|
// The plugin is blocklisted and disabled
|
|
eFallbackBlocklisted = nsIObjectLoadingContent::PLUGIN_BLOCKLISTED,
|
|
// The plugin is considered outdated, but not disabled
|
|
eFallbackOutdated = nsIObjectLoadingContent::PLUGIN_OUTDATED,
|
|
// The plugin has crashed
|
|
eFallbackCrashed = nsIObjectLoadingContent::PLUGIN_CRASHED,
|
|
// Suppressed by security policy
|
|
eFallbackSuppressed = nsIObjectLoadingContent::PLUGIN_SUPPRESSED,
|
|
// Blocked by content policy
|
|
eFallbackUserDisabled = nsIObjectLoadingContent::PLUGIN_USER_DISABLED,
|
|
/// ** All values >= eFallbackClickToPlay are plugin placeholder types
|
|
/// that would be replaced by a real plugin if activated (PlayPlugin())
|
|
/// ** Furthermore, values >= eFallbackClickToPlay and
|
|
/// <= eFallbackVulnerableNoUpdate are click-to-play types.
|
|
// The plugin is disabled until the user clicks on it
|
|
eFallbackClickToPlay = nsIObjectLoadingContent::PLUGIN_CLICK_TO_PLAY,
|
|
// The plugin is vulnerable (update available)
|
|
eFallbackVulnerableUpdatable = nsIObjectLoadingContent::PLUGIN_VULNERABLE_UPDATABLE,
|
|
// The plugin is vulnerable (no update available)
|
|
eFallbackVulnerableNoUpdate = nsIObjectLoadingContent::PLUGIN_VULNERABLE_NO_UPDATE,
|
|
// The plugin is disabled and play preview content is displayed until
|
|
// the extension code enables it by sending the MozPlayPlugin event
|
|
eFallbackPlayPreview = nsIObjectLoadingContent::PLUGIN_PLAY_PREVIEW
|
|
};
|
|
|
|
nsObjectLoadingContent();
|
|
virtual ~nsObjectLoadingContent();
|
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
|
NS_DECL_NSISTREAMLISTENER
|
|
NS_DECL_NSIFRAMELOADEROWNER
|
|
NS_DECL_NSIOBJECTLOADINGCONTENT
|
|
NS_DECL_NSICHANNELEVENTSINK
|
|
|
|
/**
|
|
* Object state. This is a bitmask of NS_EVENT_STATEs epresenting the
|
|
* current state of the object.
|
|
*/
|
|
mozilla::EventStates ObjectState() const;
|
|
|
|
ObjectType Type() const { return mType; }
|
|
|
|
void SetIsNetworkCreated(bool aNetworkCreated)
|
|
{
|
|
mNetworkCreated = aNetworkCreated;
|
|
}
|
|
|
|
/**
|
|
* When the object is loaded, the attributes and all nested <param>
|
|
* elements are cached as name:value string pairs to be passed as
|
|
* parameters when instantiating the plugin.
|
|
*
|
|
* Note: these cached values can be overriden for different quirk cases.
|
|
*/
|
|
// Returns the cached attributes array.
|
|
void GetPluginAttributes(nsTArray<mozilla::dom::MozPluginParameter>& aAttributes);
|
|
|
|
// Returns the cached <param> array.
|
|
void GetPluginParameters(nsTArray<mozilla::dom::MozPluginParameter>& aParameters);
|
|
|
|
/**
|
|
* Immediately instantiate a plugin instance. This is a no-op if mType !=
|
|
* eType_Plugin or a plugin is already running.
|
|
*
|
|
* aIsLoading indicates that we are in the loading code, and we can bypass
|
|
* the mIsLoading check.
|
|
*/
|
|
nsresult InstantiatePluginInstance(bool aIsLoading = false);
|
|
|
|
/**
|
|
* Notify this class the document state has changed
|
|
* Called by nsDocument so we may suspend plugins in inactive documents)
|
|
*/
|
|
void NotifyOwnerDocumentActivityChanged();
|
|
|
|
/**
|
|
* When a plug-in is instantiated, it can create a scriptable
|
|
* object that the page wants to interact with. We expose this
|
|
* object by placing it on the prototype chain of our element,
|
|
* between the element itself and its most-derived DOM prototype.
|
|
*
|
|
* SetupProtoChain handles actually inserting the plug-in
|
|
* scriptable object into the proto chain if needed.
|
|
*
|
|
* DoResolve is a hook that allows us to find out when the web
|
|
* page is looking up a property name on our object and make sure
|
|
* that our plug-in, if any, is instantiated.
|
|
*/
|
|
// Helper for WebIDL node wrapping
|
|
void SetupProtoChain(JSContext* aCx, JS::Handle<JSObject*> aObject);
|
|
|
|
// Remove plugin from protochain
|
|
void TeardownProtoChain();
|
|
|
|
// Helper for WebIDL NeedResolve
|
|
bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
|
|
JS::Handle<jsid> aId,
|
|
JS::MutableHandle<JSPropertyDescriptor> aDesc);
|
|
// The return value is whether DoResolve might end up resolving the given
|
|
// id. If in doubt, return true.
|
|
static bool MayResolve(jsid aId);
|
|
|
|
// Helper for WebIDL enumeration
|
|
void GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& /* unused */,
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
// WebIDL API
|
|
nsIDocument* GetContentDocument();
|
|
void GetActualType(nsAString& aType) const
|
|
{
|
|
CopyUTF8toUTF16(mContentType, aType);
|
|
}
|
|
uint32_t DisplayedType() const
|
|
{
|
|
return mType;
|
|
}
|
|
uint32_t GetContentTypeForMIMEType(const nsAString& aMIMEType)
|
|
{
|
|
return GetTypeOfContent(NS_ConvertUTF16toUTF8(aMIMEType));
|
|
}
|
|
void PlayPlugin(mozilla::ErrorResult& aRv)
|
|
{
|
|
aRv = PlayPlugin();
|
|
}
|
|
void Reload(bool aClearActivation, mozilla::ErrorResult& aRv)
|
|
{
|
|
aRv = Reload(aClearActivation);
|
|
}
|
|
bool Activated() const
|
|
{
|
|
return mActivated;
|
|
}
|
|
nsIURI* GetSrcURI() const
|
|
{
|
|
return mURI;
|
|
}
|
|
|
|
/**
|
|
* The default state that this plugin would be without manual activation.
|
|
* @returns PLUGIN_ACTIVE if the default state would be active.
|
|
*/
|
|
uint32_t DefaultFallbackType();
|
|
|
|
uint32_t PluginFallbackType() const
|
|
{
|
|
return mFallbackType;
|
|
}
|
|
bool HasRunningPlugin() const
|
|
{
|
|
return !!mInstanceOwner;
|
|
}
|
|
void CancelPlayPreview(mozilla::ErrorResult& aRv)
|
|
{
|
|
aRv = CancelPlayPreview();
|
|
}
|
|
void SwapFrameLoaders(nsXULElement& aOtherOwner, mozilla::ErrorResult& aRv)
|
|
{
|
|
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
|
}
|
|
void LegacyCall(JSContext* aCx, JS::Handle<JS::Value> aThisVal,
|
|
const mozilla::dom::Sequence<JS::Value>& aArguments,
|
|
JS::MutableHandle<JS::Value> aRetval,
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
uint32_t GetRunID(mozilla::ErrorResult& aRv)
|
|
{
|
|
uint32_t runID;
|
|
nsresult rv = GetRunID(&runID);
|
|
if (NS_FAILED(rv)) {
|
|
aRv.Throw(rv);
|
|
return 0;
|
|
}
|
|
|
|
return runID;
|
|
}
|
|
|
|
protected:
|
|
/**
|
|
* Begins loading the object when called
|
|
*
|
|
* Attributes of |this| QI'd to nsIContent will be inspected, depending on
|
|
* the node type. This function currently assumes it is a <applet>,
|
|
* <object>, or <embed> tag.
|
|
*
|
|
* The instantiated plugin depends on:
|
|
* - The URI (<embed src>, <object data>)
|
|
* - The type 'hint' (type attribute)
|
|
* - The mime type returned by opening the URI
|
|
* - Enabled plugins claiming the ultimate mime type
|
|
* - The capabilities returned by GetCapabilities
|
|
* - The classid attribute, if eSupportClassID is among the capabilities
|
|
*
|
|
* If eAllowPluginSkipChannel is true, we may skip opening the URI if our
|
|
* type hint points to a valid plugin, deferring that responsibility to the
|
|
* plugin.
|
|
* Similarly, if no URI is provided, but a type hint for a valid plugin is
|
|
* present, that plugin will be instantiated
|
|
*
|
|
* Otherwise a request to that URI is made and the type sent by the server
|
|
* is used to find a suitable handler, EXCEPT when:
|
|
* - The type hint refers to a *supported* plugin, in which case that
|
|
* plugin will be instantiated regardless of the server provided type
|
|
* - The server returns a binary-stream type, and our type hint refers to
|
|
* a valid non-document type, we will use the type hint
|
|
*
|
|
* @param aNotify If we should send notifications. If false, content
|
|
* loading may be deferred while appropriate frames are
|
|
* created
|
|
* @param aForceLoad If we should reload this content (and re-attempt the
|
|
* channel open) even if our parameters did not change
|
|
*/
|
|
nsresult LoadObject(bool aNotify,
|
|
bool aForceLoad = false);
|
|
|
|
enum Capabilities {
|
|
eSupportImages = 1u << 0, // Images are supported (imgILoader)
|
|
eSupportPlugins = 1u << 1, // Plugins are supported (nsIPluginHost)
|
|
eSupportDocuments = 1u << 2, // Documents are supported
|
|
// (nsIDocumentLoaderFactory)
|
|
// This flag always includes SVG
|
|
eSupportSVG = 1u << 3, // SVG is supported (image/svg+xml)
|
|
eSupportClassID = 1u << 4, // The classid attribute is supported
|
|
|
|
// If possible to get a *plugin* type from the type attribute *or* file
|
|
// extension, we can use that type and begin loading the plugin before
|
|
// opening a channel.
|
|
// A side effect of this is if the channel fails, the plugin is still
|
|
// running.
|
|
eAllowPluginSkipChannel = 1u << 5
|
|
};
|
|
|
|
/**
|
|
* Returns the list of capabilities this content node supports. This is a
|
|
* bitmask consisting of flags from the Capabilities enum.
|
|
*
|
|
* The default implementation supports all types but not
|
|
* eSupportClassID or eAllowPluginSkipChannel
|
|
*/
|
|
virtual uint32_t GetCapabilities() const;
|
|
|
|
/**
|
|
* Destroys all loaded documents/plugins and releases references
|
|
*/
|
|
void DestroyContent();
|
|
|
|
static void Traverse(nsObjectLoadingContent *tmp,
|
|
nsCycleCollectionTraversalCallback &cb);
|
|
|
|
void CreateStaticClone(nsObjectLoadingContent* aDest) const;
|
|
|
|
void DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner, bool aDelayedStop,
|
|
bool aForcedReentry = false);
|
|
|
|
nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
nsIContent* aBindingParent,
|
|
bool aCompileEventHandler);
|
|
void UnbindFromTree(bool aDeep = true,
|
|
bool aNullParent = true);
|
|
|
|
/**
|
|
* Return the content policy type used for loading the element.
|
|
*/
|
|
virtual nsContentPolicyType GetContentPolicyType() const = 0;
|
|
|
|
private:
|
|
|
|
// Object parameter changes returned by UpdateObjectParameters
|
|
enum ParameterUpdateFlags {
|
|
eParamNoChange = 0,
|
|
// Parameters that potentially affect the channel changed
|
|
// - mOriginalURI, mOriginalContentType
|
|
eParamChannelChanged = 1u << 0,
|
|
// Parameters that affect displayed content changed
|
|
// - mURI, mContentType, mType, mBaseURI
|
|
eParamStateChanged = 1u << 1,
|
|
// The effective content type changed, independant of object type. This
|
|
// can happen when changing from Loading -> Final type, but doesn't
|
|
// necessarily happen when changing between object types. E.g., if a PDF
|
|
// handler was installed between the last load of this object and now, we
|
|
// might change from eType_Document -> eType_Plugin without changing
|
|
// ContentType
|
|
eParamContentTypeChanged = 1u << 2
|
|
};
|
|
|
|
/**
|
|
* Getter for child <param> elements that are not nested in another plugin
|
|
* dom element.
|
|
* This is an internal helper function and should not be used directly for
|
|
* passing parameters to the plugin instance.
|
|
*
|
|
* See GetPluginParameters and GetPluginAttributes, which also handle
|
|
* quirk-overrides.
|
|
*
|
|
* @param aParameters The array containing pairs of name/value strings
|
|
* from nested <param> objects.
|
|
* @param aIgnoreCodebase Flag for ignoring the "codebase" param when
|
|
* building the array. This is useful when loading
|
|
* java.
|
|
*/
|
|
void GetNestedParams(nsTArray<mozilla::dom::MozPluginParameter>& aParameters,
|
|
bool aIgnoreCodebase);
|
|
|
|
void BuildParametersArray();
|
|
|
|
/**
|
|
* Loads fallback content with the specified FallbackType
|
|
*
|
|
* @param aType FallbackType value for type of fallback we're loading
|
|
* @param aNotify Send notifications and events. If false, caller is
|
|
* responsible for doing so
|
|
*/
|
|
void LoadFallback(FallbackType aType, bool aNotify);
|
|
|
|
/**
|
|
* Internal version of LoadObject that should only be used by this class
|
|
* aLoadingChannel is passed by the LoadObject call from OnStartRequest,
|
|
* primarily for sanity-preservation
|
|
*/
|
|
nsresult LoadObject(bool aNotify,
|
|
bool aForceLoad,
|
|
nsIRequest *aLoadingChannel);
|
|
|
|
/**
|
|
* Introspects the object and sets the following member variables:
|
|
* - mOriginalContentType : This is the type attribute on the element
|
|
* - mOriginalURI : The src or data attribute on the element
|
|
* - mURI : The final URI, considering mChannel if
|
|
* mChannelLoaded is set
|
|
* - mContentType : The final content type, considering mChannel if
|
|
* mChannelLoaded is set
|
|
* - mBaseURI : The object's base URI, which may be set by the
|
|
* object (codebase attribute)
|
|
* - mType : The type the object is determined to be based
|
|
* on the above
|
|
*
|
|
* NOTE The class assumes that mType is the currently loaded type at various
|
|
* points, so the caller of this function must take the appropriate
|
|
* actions to ensure this
|
|
*
|
|
* NOTE This function does not perform security checks, only determining the
|
|
* requested type and parameters of the object.
|
|
*
|
|
* @param aJavaURI Specify that the URI will be consumed by java, which
|
|
* changes codebase parsing and URI construction. Used
|
|
* internally.
|
|
*
|
|
* @return Returns a bitmask of ParameterUpdateFlags values
|
|
*/
|
|
ParameterUpdateFlags UpdateObjectParameters(bool aJavaURI = false);
|
|
|
|
/**
|
|
* Queue a CheckPluginStopEvent and track it in mPendingCheckPluginStopEvent
|
|
*/
|
|
void QueueCheckPluginStopEvent();
|
|
|
|
void NotifyContentObjectWrapper();
|
|
|
|
/**
|
|
* Opens the channel pointed to by mURI into mChannel.
|
|
*/
|
|
nsresult OpenChannel();
|
|
|
|
/**
|
|
* Closes and releases references to mChannel and, if opened, mFinalListener
|
|
*/
|
|
nsresult CloseChannel();
|
|
|
|
/**
|
|
* If this object is allowed to play plugin content, or if it would display
|
|
* click-to-play instead.
|
|
* NOTE that this does not actually check if the object is a loadable plugin
|
|
* NOTE This ignores the current activated state. The caller should check this if appropriate.
|
|
*/
|
|
bool ShouldPlay(FallbackType &aReason, bool aIgnoreCurrentType);
|
|
|
|
/*
|
|
* Helper to check if mBaseURI can be used by java as a codebase
|
|
*/
|
|
bool CheckJavaCodebase();
|
|
|
|
/**
|
|
* Helper to check if our current URI passes policy
|
|
*
|
|
* @param aContentPolicy [out] The result of the content policy decision
|
|
*
|
|
* @return true if call succeeded and NS_CP_ACCEPTED(*aContentPolicy)
|
|
*/
|
|
bool CheckLoadPolicy(int16_t *aContentPolicy);
|
|
|
|
/**
|
|
* Helper to check if the object passes process policy. Assumes we have a
|
|
* final determined type.
|
|
*
|
|
* @param aContentPolicy [out] The result of the content policy decision
|
|
*
|
|
* @return true if call succeeded and NS_CP_ACCEPTED(*aContentPolicy)
|
|
*/
|
|
bool CheckProcessPolicy(int16_t *aContentPolicy);
|
|
|
|
/**
|
|
* Checks whether the given type is a supported document type
|
|
*
|
|
* NOTE Does not take content policy or capabilities into account
|
|
*/
|
|
bool IsSupportedDocument(const nsCString& aType);
|
|
|
|
/**
|
|
* Gets the plugin instance and creates a plugin stream listener, assigning
|
|
* it to mFinalListener
|
|
*/
|
|
bool MakePluginListener();
|
|
|
|
/**
|
|
* Unloads all content and resets the object to a completely unloaded state
|
|
*
|
|
* NOTE Calls StopPluginInstance() and may spin the event loop
|
|
*
|
|
* @param aResetState Reset the object type to 'loading' and destroy channel
|
|
* as well
|
|
*/
|
|
void UnloadObject(bool aResetState = true);
|
|
|
|
/**
|
|
* Notifies document observes about a new type/state of this object.
|
|
* Triggers frame construction as needed. mType must be set correctly when
|
|
* this method is called. This method is cheap if the type and state didn't
|
|
* actually change.
|
|
*
|
|
* @param aSync If a synchronous frame construction is required. If false,
|
|
* the construction may either be sync or async.
|
|
* @param aNotify if false, only need to update the state of our element.
|
|
*/
|
|
void NotifyStateChanged(ObjectType aOldType,
|
|
mozilla::EventStates aOldState,
|
|
bool aSync, bool aNotify);
|
|
|
|
/**
|
|
* Returns a ObjectType value corresponding to the type of content we would
|
|
* support the given MIME type as, taking capabilities and plugin state
|
|
* into account
|
|
*
|
|
* NOTE this does not consider whether the content would be suppressed by
|
|
* click-to-play or other content policy checks
|
|
*/
|
|
ObjectType GetTypeOfContent(const nsCString& aMIMEType);
|
|
|
|
/**
|
|
* Gets the frame that's associated with this content node.
|
|
* Does not flush.
|
|
*/
|
|
nsPluginFrame* GetExistingFrame();
|
|
|
|
// Helper class for SetupProtoChain
|
|
class SetupProtoChainRunner final : public nsIRunnable
|
|
{
|
|
~SetupProtoChainRunner();
|
|
public:
|
|
NS_DECL_ISUPPORTS
|
|
|
|
explicit SetupProtoChainRunner(nsObjectLoadingContent* aContent);
|
|
|
|
NS_IMETHOD Run() override;
|
|
|
|
private:
|
|
// We store an nsIObjectLoadingContent because we can
|
|
// unambiguously refcount that.
|
|
RefPtr<nsIObjectLoadingContent> mContent;
|
|
};
|
|
|
|
// Utility getter for getting our nsNPAPIPluginInstance in a safe way.
|
|
nsresult ScriptRequestPluginInstance(JSContext* aCx,
|
|
nsNPAPIPluginInstance** aResult);
|
|
|
|
// Utility method for getting our plugin JSObject
|
|
static nsresult GetPluginJSObject(JSContext *cx,
|
|
JS::Handle<JSObject*> obj,
|
|
nsNPAPIPluginInstance *plugin_inst,
|
|
JS::MutableHandle<JSObject*> plugin_obj,
|
|
JS::MutableHandle<JSObject*> plugin_proto);
|
|
|
|
// The final listener for mChannel (uriloader, pluginstreamlistener, etc.)
|
|
nsCOMPtr<nsIStreamListener> mFinalListener;
|
|
|
|
// Frame loader, for content documents we load.
|
|
RefPtr<nsFrameLoader> mFrameLoader;
|
|
|
|
// Track if we have a pending AsyncInstantiateEvent
|
|
nsCOMPtr<nsIRunnable> mPendingInstantiateEvent;
|
|
|
|
// Tracks if we have a pending CheckPluginStopEvent
|
|
nsCOMPtr<nsIRunnable> mPendingCheckPluginStopEvent;
|
|
|
|
// The content type of our current load target, updated by
|
|
// UpdateObjectParameters(). Takes the channel's type into account once
|
|
// opened.
|
|
//
|
|
// May change if a channel is opened, does not imply a loaded state
|
|
nsCString mContentType;
|
|
|
|
// The content type 'hint' provided by the element's type attribute. May
|
|
// or may not be used as a final type
|
|
nsCString mOriginalContentType;
|
|
|
|
// The channel that's currently being loaded. If set, but mChannelLoaded is
|
|
// false, has not yet reached OnStartRequest
|
|
nsCOMPtr<nsIChannel> mChannel;
|
|
|
|
// The URI of the current content.
|
|
// May change as we open channels and encounter redirects - does not imply
|
|
// a loaded type
|
|
nsCOMPtr<nsIURI> mURI;
|
|
|
|
// The original URI obtained from inspecting the element (codebase, and
|
|
// src/data). May differ from mURI due to redirects
|
|
nsCOMPtr<nsIURI> mOriginalURI;
|
|
|
|
// The baseURI used for constructing mURI, and used by some plugins (java)
|
|
// as a root for other resource requests.
|
|
nsCOMPtr<nsIURI> mBaseURI;
|
|
|
|
|
|
|
|
// Type of the currently-loaded content.
|
|
ObjectType mType : 8;
|
|
// The type of fallback content we're showing (see ObjectState())
|
|
FallbackType mFallbackType : 8;
|
|
|
|
uint32_t mRunID;
|
|
bool mHasRunID;
|
|
|
|
// If true, we have opened a channel as the listener and it has reached
|
|
// OnStartRequest. Does not get set for channels that are passed directly to
|
|
// the plugin listener.
|
|
bool mChannelLoaded : 1;
|
|
|
|
// Whether we are about to call instantiate on our frame. If we aren't,
|
|
// SetFrame needs to asynchronously call Instantiate.
|
|
bool mInstantiating : 1;
|
|
|
|
// True when the object is created for an element which the parser has
|
|
// created using NS_FROM_PARSER_NETWORK flag. If the element is modified,
|
|
// it may lose the flag.
|
|
bool mNetworkCreated : 1;
|
|
|
|
// Used to keep track of whether or not a plugin has been explicitly
|
|
// activated by PlayPlugin(). (see ShouldPlay())
|
|
bool mActivated : 1;
|
|
|
|
// Used to keep track of whether or not a plugin is blocked by play-preview.
|
|
bool mPlayPreviewCanceled : 1;
|
|
|
|
// Protects DoStopPlugin from reentry (bug 724781).
|
|
bool mIsStopping : 1;
|
|
|
|
// Protects LoadObject from re-entry
|
|
bool mIsLoading : 1;
|
|
|
|
// For plugin stand-in types (click-to-play, play preview, ...) tracks
|
|
// whether content js has tried to access the plugin script object.
|
|
bool mScriptRequested : 1;
|
|
|
|
nsWeakFrame mPrintFrame;
|
|
|
|
RefPtr<nsPluginInstanceOwner> mInstanceOwner;
|
|
nsTArray<mozilla::dom::MozPluginParameter> mCachedAttributes;
|
|
nsTArray<mozilla::dom::MozPluginParameter> mCachedParameters;
|
|
};
|
|
|
|
#endif
|