mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1335368 part 7. Mostly stop using IsCallerChrome in nsObjectLoadingContent. r=bholley
This commit is contained in:
parent
99d6a6c7d9
commit
d9a60c022b
@ -125,11 +125,6 @@ interface nsIObjectLoadingContent : nsISupports
|
||||
in AString browserDumpID,
|
||||
in boolean submittedCrashReport);
|
||||
|
||||
/**
|
||||
* This method will play a plugin that has been stopped by click-to-play.
|
||||
*/
|
||||
void playPlugin();
|
||||
|
||||
/**
|
||||
* Forces a re-evaluation and reload of the tag, optionally invalidating its
|
||||
* click-to-play state. This can be used when the MIME type that provides a
|
||||
@ -168,18 +163,4 @@ interface nsIObjectLoadingContent : nsISupports
|
||||
* an <embed> with no src).
|
||||
*/
|
||||
readonly attribute nsIURI srcURI;
|
||||
|
||||
/**
|
||||
* The plugin's current state of fallback content. This property
|
||||
* only makes sense if the plugin is not activated.
|
||||
*/
|
||||
readonly attribute unsigned long pluginFallbackType;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
};
|
||||
|
@ -2915,6 +2915,10 @@ nsObjectLoadingContent::ScriptRequestPluginInstance(JSContext* aCx,
|
||||
// NB: Sometimes there's a null cx on the stack, in which case |cx| is the
|
||||
// safe JS context. But in that case, IsCallerChrome() will return true,
|
||||
// so the ensuing expression is short-circuited.
|
||||
// XXXbz the NB comment above doesn't really make sense. At the moment, all
|
||||
// the callers to this except maybe SetupProtoChain have a useful JSContext*
|
||||
// that could be used for nsContentUtils::IsSystemCaller... We do need to
|
||||
// sort out what the SetupProtoChain callers look like.
|
||||
MOZ_ASSERT_IF(nsContentUtils::GetCurrentJSContext(),
|
||||
aCx == nsContentUtils::GetCurrentJSContext());
|
||||
bool callerIsContentJS = (nsContentUtils::GetCurrentJSContext() &&
|
||||
@ -3167,12 +3171,10 @@ nsObjectLoadingContent::NotifyContentObjectWrapper()
|
||||
SetupProtoChain(cx, obj);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::PlayPlugin()
|
||||
void
|
||||
nsObjectLoadingContent::PlayPlugin(SystemCallerGuarantee, ErrorResult& aRv)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerChrome())
|
||||
return NS_OK;
|
||||
|
||||
// This is a ChromeOnly method, so no need to check caller type here.
|
||||
if (!mActivated) {
|
||||
mActivated = true;
|
||||
LOG(("OBJLC [%p]: Activated by user", this));
|
||||
@ -3182,10 +3184,8 @@ nsObjectLoadingContent::PlayPlugin()
|
||||
// Fallback types >= eFallbackClickToPlay are plugin-replacement types, see
|
||||
// header
|
||||
if (mType == eType_Null && mFallbackType >= eFallbackClickToPlay) {
|
||||
return LoadObject(true, true);
|
||||
aRv = LoadObject(true, true);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -3205,14 +3205,6 @@ nsObjectLoadingContent::GetActivated(bool *aActivated)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetPluginFallbackType(uint32_t* aPluginFallbackType)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
|
||||
*aPluginFallbackType = mFallbackType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nsObjectLoadingContent::DefaultFallbackType()
|
||||
{
|
||||
@ -3224,22 +3216,16 @@ nsObjectLoadingContent::DefaultFallbackType()
|
||||
return reason;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::GetRunID(uint32_t* aRunID)
|
||||
uint32_t
|
||||
nsObjectLoadingContent::GetRunID(SystemCallerGuarantee, ErrorResult& aRv)
|
||||
{
|
||||
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;
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
*aRunID = mRunID;
|
||||
return NS_OK;
|
||||
return mRunID;
|
||||
}
|
||||
|
||||
static bool sPrefsInitialized;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define NSOBJECTLOADINGCONTENT_H_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "nsImageLoadingContent.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIChannelEventSink.h"
|
||||
@ -193,10 +194,8 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
{
|
||||
return GetTypeOfContent(NS_ConvertUTF16toUTF8(aMIMEType));
|
||||
}
|
||||
void PlayPlugin(mozilla::ErrorResult& aRv)
|
||||
{
|
||||
aRv = PlayPlugin();
|
||||
}
|
||||
void PlayPlugin(mozilla::dom::SystemCallerGuarantee,
|
||||
mozilla::ErrorResult& aRv);
|
||||
void Reload(bool aClearActivation, mozilla::ErrorResult& aRv)
|
||||
{
|
||||
aRv = Reload(aClearActivation);
|
||||
@ -239,17 +238,8 @@ 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;
|
||||
}
|
||||
uint32_t GetRunID(mozilla::dom::SystemCallerGuarantee,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
bool IsRewrittenYoutubeEmbed() const
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ interface MozObjectLoadingContent {
|
||||
* This method will play a plugin that has been stopped by the click-to-play
|
||||
* feature.
|
||||
*/
|
||||
[ChromeOnly, Throws]
|
||||
[ChromeOnly, Throws, NeedsCallerType]
|
||||
void playPlugin();
|
||||
|
||||
/**
|
||||
@ -204,7 +204,7 @@ interface MozObjectLoadingContent {
|
||||
[ChromeOnly]
|
||||
readonly attribute boolean hasRunningPlugin;
|
||||
|
||||
[ChromeOnly, Throws]
|
||||
[ChromeOnly, Throws, NeedsCallerType]
|
||||
readonly attribute unsigned long runID;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user