mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1148012 - Expose run ID through nsIObjectLoadingContent.idl. r=josh,smaug.
The run ID for a plugin is retrieved and cached in the nsObjectLoadingContent on plugin instantiation. --HG-- extra : rebase_source : d1e87b7751e6367c482b2420aa43bfadbce5e3e8
This commit is contained in:
parent
22a0f74e8f
commit
d95fcd35e3
@ -25,7 +25,7 @@ class nsNPAPIPluginInstance;
|
||||
* interface to mirror this interface when changing it.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(16c14177-52eb-49d3-9842-a1a0b92be11a)]
|
||||
[scriptable, uuid(5efbd411-5bbe-4de1-9f3a-1c3459696eb2)]
|
||||
interface nsIObjectLoadingContent : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -188,4 +188,12 @@ interface nsIObjectLoadingContent : nsISupports
|
||||
* This method will disable the play-preview plugin state.
|
||||
*/
|
||||
void cancelPlayPreview();
|
||||
|
||||
/**
|
||||
* If this plugin runs out-of-process, it has a runID to differentiate
|
||||
* between different times the plugin process has been instantiated.
|
||||
*
|
||||
* This throws NS_ERROR_NOT_IMPLEMENTED for in-process plugins.
|
||||
*/
|
||||
readonly attribute unsigned long runID;
|
||||
};
|
||||
|
@ -701,6 +701,8 @@ nsObjectLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
nsObjectLoadingContent::nsObjectLoadingContent()
|
||||
: mType(eType_Loading)
|
||||
, mFallbackType(eFallbackAlternate)
|
||||
, mRunID(0)
|
||||
, mHasRunID(false)
|
||||
, mChannelLoaded(false)
|
||||
, mInstantiating(false)
|
||||
, mNetworkCreated(true)
|
||||
@ -815,6 +817,17 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
|
||||
|
||||
mInstanceOwner = newOwner;
|
||||
|
||||
if (mInstanceOwner) {
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
rv = mInstanceOwner->GetInstance(getter_AddRefs(inst));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = inst->GetRunID(&mRunID);
|
||||
mHasRunID = NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
// Ensure the frame did not change during instantiation re-entry (common).
|
||||
// HasNewFrame would not have mInstanceOwner yet, so the new frame would be
|
||||
// dangling. (Bug 854082)
|
||||
@ -3145,6 +3158,24 @@ nsObjectLoadingContent::CancelPlayPreview()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetRunID(uint32_t* aRunID)
|
||||
{
|
||||
if (NS_WARN_IF(!nsContentUtils::IsCallerChrome())) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
if (NS_WARN_IF(!aRunID)) {
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
}
|
||||
if (!mHasRunID) {
|
||||
// The plugin instance must not have a run ID, so we must
|
||||
// be running the plugin in-process.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
*aRunID = mRunID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static bool sPrefsInitialized;
|
||||
static uint32_t sSessionTimeoutMinutes;
|
||||
static uint32_t sPersistentTimeoutDays;
|
||||
|
@ -233,6 +233,18 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
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
|
||||
@ -579,6 +591,9 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
// 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.
|
||||
|
@ -122,6 +122,7 @@ public:
|
||||
virtual nsresult EndUpdateBackground(NPP instance,
|
||||
gfxContext* aCtx, const nsIntRect&) override;
|
||||
virtual void GetLibraryPath(nsACString& aPath) { aPath.Assign(mFilePath); }
|
||||
virtual nsresult GetRunID(uint32_t* aRunID) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
private:
|
||||
NP_InitializeFunc mNP_Initialize;
|
||||
|
@ -1778,3 +1778,22 @@ nsNPAPIPluginInstance::GetContentsScaleFactor()
|
||||
}
|
||||
return scaleFactor;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetRunID(uint32_t* aRunID)
|
||||
{
|
||||
if (NS_WARN_IF(!aRunID)) {
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!mPlugin)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PluginLibrary* library = mPlugin->GetLibrary();
|
||||
if (!library) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return library->GetRunID(aRunID);
|
||||
}
|
||||
|
@ -286,6 +286,8 @@ public:
|
||||
// Returns the contents scale factor of the screen the plugin is drawn on.
|
||||
double GetContentsScaleFactor();
|
||||
|
||||
nsresult GetRunID(uint32_t *aRunID);
|
||||
|
||||
static bool InPluginCallUnsafeForReentry() { return gInUnsafePluginCalls > 0; }
|
||||
static void BeginPluginCall(NSPluginCallReentry aReentryState)
|
||||
{
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
const nsIntRect&, gfxContext**) = 0;
|
||||
virtual nsresult EndUpdateBackground(NPP instance,
|
||||
gfxContext*, const nsIntRect&) = 0;
|
||||
virtual nsresult GetRunID(uint32_t* aRunID) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
return mPluginName + mPluginVersion;
|
||||
}
|
||||
|
||||
nsresult GetRunID(uint32_t* aRunID);
|
||||
virtual nsresult GetRunID(uint32_t* aRunID) override;
|
||||
|
||||
protected:
|
||||
virtual mozilla::ipc::RacyInterruptPolicy
|
||||
|
@ -211,6 +211,9 @@ interface MozObjectLoadingContent {
|
||||
*/
|
||||
[ChromeOnly, Throws]
|
||||
void cancelPlayPreview();
|
||||
|
||||
[ChromeOnly, Throws]
|
||||
readonly attribute unsigned long runID;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user