зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1684220 - Remove some dead plugins code. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D100472
This commit is contained in:
Родитель
2df51d08cb
Коммит
925ab25267
|
@ -1275,21 +1275,16 @@ EventStates nsObjectLoadingContent::ObjectState() const {
|
||||||
switch (mFallbackType) {
|
switch (mFallbackType) {
|
||||||
case eFallbackClickToPlay:
|
case eFallbackClickToPlay:
|
||||||
case eFallbackClickToPlayQuiet:
|
case eFallbackClickToPlayQuiet:
|
||||||
return NS_EVENT_STATE_TYPE_CLICK_TO_PLAY;
|
case eFallbackVulnerableUpdatable:
|
||||||
|
case eFallbackVulnerableNoUpdate:
|
||||||
|
return EventStates();
|
||||||
case eFallbackDisabled:
|
case eFallbackDisabled:
|
||||||
return NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_HANDLER_DISABLED;
|
|
||||||
case eFallbackBlocklisted:
|
case eFallbackBlocklisted:
|
||||||
return NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_HANDLER_BLOCKED;
|
|
||||||
case eFallbackCrashed:
|
case eFallbackCrashed:
|
||||||
return NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_HANDLER_CRASHED;
|
|
||||||
case eFallbackUnsupported:
|
case eFallbackUnsupported:
|
||||||
case eFallbackOutdated:
|
case eFallbackOutdated:
|
||||||
case eFallbackAlternate:
|
case eFallbackAlternate:
|
||||||
return NS_EVENT_STATE_BROKEN;
|
return NS_EVENT_STATE_BROKEN;
|
||||||
case eFallbackVulnerableUpdatable:
|
|
||||||
return NS_EVENT_STATE_VULNERABLE_UPDATABLE;
|
|
||||||
case eFallbackVulnerableNoUpdate:
|
|
||||||
return NS_EVENT_STATE_VULNERABLE_NO_UPDATE;
|
|
||||||
case eFallbackBlockAllPlugins:
|
case eFallbackBlockAllPlugins:
|
||||||
return NS_EVENT_STATE_HANDLER_NOPLUGINS;
|
return NS_EVENT_STATE_HANDLER_NOPLUGINS;
|
||||||
}
|
}
|
||||||
|
@ -1918,6 +1913,7 @@ nsresult nsObjectLoadingContent::LoadObject(bool aNotify, bool aForceLoad,
|
||||||
// Save these for NotifyStateChanged();
|
// Save these for NotifyStateChanged();
|
||||||
EventStates oldState = ObjectState();
|
EventStates oldState = ObjectState();
|
||||||
ObjectType oldType = mType;
|
ObjectType oldType = mType;
|
||||||
|
FallbackType oldFallbackType = mFallbackType;
|
||||||
|
|
||||||
ParameterUpdateFlags stateChange = UpdateObjectParameters();
|
ParameterUpdateFlags stateChange = UpdateObjectParameters();
|
||||||
|
|
||||||
|
@ -2128,9 +2124,10 @@ nsresult nsObjectLoadingContent::LoadObject(bool aNotify, bool aForceLoad,
|
||||||
case eType_Plugin: {
|
case eType_Plugin: {
|
||||||
if (mChannel) {
|
if (mChannel) {
|
||||||
// Force a sync state change now, we need the frame created
|
// Force a sync state change now, we need the frame created
|
||||||
NotifyStateChanged(oldType, oldState, true, aNotify);
|
NotifyStateChanged(oldType, oldState, oldFallbackType, true, aNotify);
|
||||||
oldType = mType;
|
oldType = mType;
|
||||||
oldState = ObjectState();
|
oldState = ObjectState();
|
||||||
|
oldFallbackType = mFallbackType;
|
||||||
|
|
||||||
if (!thisContent->GetPrimaryFrame()) {
|
if (!thisContent->GetPrimaryFrame()) {
|
||||||
// We're un-rendered, and can't instantiate a plugin. HasNewFrame will
|
// We're un-rendered, and can't instantiate a plugin. HasNewFrame will
|
||||||
|
@ -2243,7 +2240,7 @@ nsresult nsObjectLoadingContent::LoadObject(bool aNotify, bool aForceLoad,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify of our final state
|
// Notify of our final state
|
||||||
NotifyStateChanged(oldType, oldState, false, aNotify);
|
NotifyStateChanged(oldType, oldState, oldFallbackType, false, aNotify);
|
||||||
NS_ENSURE_TRUE(mIsLoading, NS_OK);
|
NS_ENSURE_TRUE(mIsLoading, NS_OK);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2548,6 +2545,7 @@ void nsObjectLoadingContent::UnloadObject(bool aResetState) {
|
||||||
|
|
||||||
void nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
void nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
||||||
EventStates aOldState,
|
EventStates aOldState,
|
||||||
|
FallbackType aOldFallbackType,
|
||||||
bool aSync, bool aNotify) {
|
bool aSync, bool aNotify) {
|
||||||
LOG(("OBJLC [%p]: Notifying about state change: (%u, %" PRIx64
|
LOG(("OBJLC [%p]: Notifying about state change: (%u, %" PRIx64
|
||||||
") -> (%u, %" PRIx64 ")"
|
") -> (%u, %" PRIx64 ")"
|
||||||
|
@ -2576,9 +2574,9 @@ void nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
||||||
return; // Nothing to do
|
return; // Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
EventStates newState = ObjectState();
|
const EventStates newState = ObjectState();
|
||||||
|
if (newState == aOldState && mType == aOldType &&
|
||||||
if (newState == aOldState && mType == aOldType) {
|
(mType != eType_Null || mFallbackType == aOldFallbackType)) {
|
||||||
return; // Also done.
|
return; // Also done.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2590,20 +2588,25 @@ void nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
||||||
nsAutoScriptBlocker scriptBlocker;
|
nsAutoScriptBlocker scriptBlocker;
|
||||||
doc->ContentStateChanged(thisEl, changedBits);
|
doc->ContentStateChanged(thisEl, changedBits);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto NeedsUAWidget = [](ObjectType aType, FallbackType aFallbackType) {
|
||||||
|
if (aType != eType_Null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return aFallbackType != eFallbackUnsupported &&
|
||||||
|
aFallbackType != eFallbackOutdated &&
|
||||||
|
aFallbackType != eFallbackAlternate &&
|
||||||
|
aFallbackType != eFallbackDisabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
const bool needsWidget = NeedsUAWidget(mType, mFallbackType);
|
||||||
|
const bool neededWidget = NeedsUAWidget(aOldType, aOldFallbackType);
|
||||||
|
if (needsWidget != neededWidget) {
|
||||||
// Create/destroy plugin problem UAWidget.
|
// Create/destroy plugin problem UAWidget.
|
||||||
const EventStates pluginProblemState =
|
if (neededWidget) {
|
||||||
NS_EVENT_STATE_HANDLER_BLOCKED | NS_EVENT_STATE_HANDLER_CRASHED |
|
|
||||||
NS_EVENT_STATE_TYPE_CLICK_TO_PLAY |
|
|
||||||
NS_EVENT_STATE_VULNERABLE_UPDATABLE |
|
|
||||||
NS_EVENT_STATE_VULNERABLE_NO_UPDATE | NS_EVENT_STATE_HANDLER_NOPLUGINS;
|
|
||||||
|
|
||||||
bool hadProblemState = !(aOldState & pluginProblemState).IsEmpty();
|
|
||||||
bool hasProblemState = !(newState & pluginProblemState).IsEmpty();
|
|
||||||
|
|
||||||
if (hadProblemState && !hasProblemState) {
|
|
||||||
thisEl->NotifyUAWidgetTeardown();
|
thisEl->NotifyUAWidgetTeardown();
|
||||||
} else if (!hadProblemState && hasProblemState) {
|
} else {
|
||||||
thisEl->AttachAndSetUAShadowRoot();
|
thisEl->AttachAndSetUAShadowRoot();
|
||||||
// When blocking all plugins, we do not want the element to have focus
|
// When blocking all plugins, we do not want the element to have focus
|
||||||
// so relinquish focus if we are in that state.
|
// so relinquish focus if we are in that state.
|
||||||
|
@ -2614,11 +2617,10 @@ void nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (aOldType != mType) {
|
}
|
||||||
// If our state changed, then we already recreated frames
|
|
||||||
// Otherwise, need to do that here
|
if (aOldType != mType) {
|
||||||
RefPtr<PresShell> presShell = doc->GetPresShell();
|
if (RefPtr<PresShell> presShell = doc->GetPresShell()) {
|
||||||
if (presShell) {
|
|
||||||
presShell->PostRecreateFramesFor(thisEl);
|
presShell->PostRecreateFramesFor(thisEl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2840,6 +2842,7 @@ nsObjectLoadingContent::GetSrcURI(nsIURI** aURI) {
|
||||||
void nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
|
void nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
|
||||||
EventStates oldState = ObjectState();
|
EventStates oldState = ObjectState();
|
||||||
ObjectType oldType = mType;
|
ObjectType oldType = mType;
|
||||||
|
FallbackType oldFallbackType = mFallbackType;
|
||||||
|
|
||||||
NS_ASSERTION(!mInstanceOwner && !mFrameLoader && !mChannel,
|
NS_ASSERTION(!mInstanceOwner && !mFrameLoader && !mChannel,
|
||||||
"LoadFallback called with loaded content");
|
"LoadFallback called with loaded content");
|
||||||
|
@ -2905,7 +2908,7 @@ void nsObjectLoadingContent::LoadFallback(FallbackType aType, bool aNotify) {
|
||||||
return; // done
|
return; // done
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyStateChanged(oldType, oldState, false, true);
|
NotifyStateChanged(oldType, oldState, oldFallbackType, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsObjectLoadingContent::DoStopPlugin(
|
void nsObjectLoadingContent::DoStopPlugin(
|
||||||
|
|
|
@ -540,7 +540,8 @@ class nsObjectLoadingContent : public nsImageLoadingContent,
|
||||||
* @param aNotify if false, only need to update the state of our element.
|
* @param aNotify if false, only need to update the state of our element.
|
||||||
*/
|
*/
|
||||||
void NotifyStateChanged(ObjectType aOldType, mozilla::EventStates aOldState,
|
void NotifyStateChanged(ObjectType aOldType, mozilla::EventStates aOldState,
|
||||||
bool aSync, bool aNotify);
|
FallbackType aOldFallbackType, bool aSync,
|
||||||
|
bool aNotify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a ObjectType value corresponding to the type of content we would
|
* Returns a ObjectType value corresponding to the type of content we would
|
||||||
|
|
|
@ -205,12 +205,6 @@ class EventStates {
|
||||||
// Content is still loading such that there is nothing to show the
|
// Content is still loading such that there is nothing to show the
|
||||||
// user (eg an image which hasn't started coming in yet).
|
// user (eg an image which hasn't started coming in yet).
|
||||||
#define NS_EVENT_STATE_LOADING NS_DEFINE_EVENT_STATE_MACRO(17)
|
#define NS_EVENT_STATE_LOADING NS_DEFINE_EVENT_STATE_MACRO(17)
|
||||||
// Handler for the content has been blocked.
|
|
||||||
#define NS_EVENT_STATE_HANDLER_BLOCKED NS_DEFINE_EVENT_STATE_MACRO(18)
|
|
||||||
// Handler for the content has been disabled.
|
|
||||||
#define NS_EVENT_STATE_HANDLER_DISABLED NS_DEFINE_EVENT_STATE_MACRO(19)
|
|
||||||
// Handler for the content has crashed
|
|
||||||
#define NS_EVENT_STATE_HANDLER_CRASHED NS_DEFINE_EVENT_STATE_MACRO(20)
|
|
||||||
// Content is required.
|
// Content is required.
|
||||||
#define NS_EVENT_STATE_REQUIRED NS_DEFINE_EVENT_STATE_MACRO(21)
|
#define NS_EVENT_STATE_REQUIRED NS_DEFINE_EVENT_STATE_MACRO(21)
|
||||||
// Content is optional (and can be required).
|
// Content is optional (and can be required).
|
||||||
|
@ -250,12 +244,6 @@ class EventStates {
|
||||||
#define NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL NS_DEFINE_EVENT_STATE_MACRO(38)
|
#define NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL NS_DEFINE_EVENT_STATE_MACRO(38)
|
||||||
// Content has focus and should show a ring.
|
// Content has focus and should show a ring.
|
||||||
#define NS_EVENT_STATE_FOCUSRING NS_DEFINE_EVENT_STATE_MACRO(39)
|
#define NS_EVENT_STATE_FOCUSRING NS_DEFINE_EVENT_STATE_MACRO(39)
|
||||||
// Handler for click to play plugin
|
|
||||||
#define NS_EVENT_STATE_TYPE_CLICK_TO_PLAY NS_DEFINE_EVENT_STATE_MACRO(40)
|
|
||||||
// Handler for click to play plugin (vulnerable w/update)
|
|
||||||
#define NS_EVENT_STATE_VULNERABLE_UPDATABLE NS_DEFINE_EVENT_STATE_MACRO(41)
|
|
||||||
// Handler for click to play plugin (vulnerable w/no update)
|
|
||||||
#define NS_EVENT_STATE_VULNERABLE_NO_UPDATE NS_DEFINE_EVENT_STATE_MACRO(42)
|
|
||||||
// Element has focus-within.
|
// Element has focus-within.
|
||||||
#define NS_EVENT_STATE_FOCUS_WITHIN NS_DEFINE_EVENT_STATE_MACRO(43)
|
#define NS_EVENT_STATE_FOCUS_WITHIN NS_DEFINE_EVENT_STATE_MACRO(43)
|
||||||
// Element is ltr (for :dir pseudo-class)
|
// Element is ltr (for :dir pseudo-class)
|
||||||
|
|
|
@ -55,12 +55,6 @@ bitflags! {
|
||||||
const IN_BROKEN_STATE = 1 << 14;
|
const IN_BROKEN_STATE = 1 << 14;
|
||||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-loading
|
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-loading
|
||||||
const IN_LOADING_STATE = 1 << 17;
|
const IN_LOADING_STATE = 1 << 17;
|
||||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-blocked
|
|
||||||
const IN_HANDLER_BLOCKED_STATE = 1 << 18;
|
|
||||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-disabled
|
|
||||||
const IN_HANDLER_DISABLED_STATE = 1 << 19;
|
|
||||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-crashed
|
|
||||||
const IN_HANDLER_CRASHED_STATE = 1 << 20;
|
|
||||||
/// <https://html.spec.whatwg.org/multipage/#selector-required>
|
/// <https://html.spec.whatwg.org/multipage/#selector-required>
|
||||||
const IN_REQUIRED_STATE = 1 << 21;
|
const IN_REQUIRED_STATE = 1 << 21;
|
||||||
/// <https://html.spec.whatwg.org/multipage/#selector-optional>
|
/// <https://html.spec.whatwg.org/multipage/#selector-optional>
|
||||||
|
@ -106,12 +100,6 @@ bitflags! {
|
||||||
///
|
///
|
||||||
/// But also https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
|
/// But also https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
|
||||||
const IN_FOCUSRING_STATE = 1 << 39;
|
const IN_FOCUSRING_STATE = 1 << 39;
|
||||||
/// Non-standard & undocumented.
|
|
||||||
const IN_HANDLER_CLICK_TO_PLAY_STATE = 1 << 40;
|
|
||||||
/// Non-standard & undocumented.
|
|
||||||
const IN_HANDLER_VULNERABLE_UPDATABLE_STATE = 1 << 41;
|
|
||||||
/// Non-standard & undocumented.
|
|
||||||
const IN_HANDLER_VULNERABLE_NO_UPDATE_STATE = 1 << 42;
|
|
||||||
/// <https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo>
|
/// <https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo>
|
||||||
const IN_FOCUS_WITHIN_STATE = 1 << 43;
|
const IN_FOCUS_WITHIN_STATE = 1 << 43;
|
||||||
/// :dir matching; the states are used for dynamic change detection.
|
/// :dir matching; the states are used for dynamic change detection.
|
||||||
|
|
|
@ -66,13 +66,6 @@ macro_rules! apply_non_ts_list {
|
||||||
|
|
||||||
("-moz-autofill-preview", MozAutofillPreview, IN_AUTOFILL_PREVIEW_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
("-moz-autofill-preview", MozAutofillPreview, IN_AUTOFILL_PREVIEW_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
||||||
|
|
||||||
("-moz-handler-clicktoplay", MozHandlerClickToPlay, IN_HANDLER_CLICK_TO_PLAY_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
|
||||||
("-moz-handler-vulnerable-updatable", MozHandlerVulnerableUpdatable, IN_HANDLER_VULNERABLE_UPDATABLE_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
|
||||||
("-moz-handler-vulnerable-no-update", MozHandlerVulnerableNoUpdate, IN_HANDLER_VULNERABLE_NO_UPDATE_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
|
||||||
|
|
||||||
("-moz-handler-disabled", MozHandlerDisabled, IN_HANDLER_DISABLED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
|
||||||
("-moz-handler-blocked", MozHandlerBlocked, IN_HANDLER_BLOCKED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
|
||||||
("-moz-handler-crashed", MozHandlerCrashed, IN_HANDLER_CRASHED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
|
||||||
("-moz-handler-noplugins", MozHandlerNoPlugins, IN_HANDLER_NOPLUGINS, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
("-moz-handler-noplugins", MozHandlerNoPlugins, IN_HANDLER_NOPLUGINS, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
||||||
|
|
||||||
("-moz-math-increment-script-level", MozMathIncrementScriptLevel, IN_INCREMENT_SCRIPT_LEVEL_STATE, _),
|
("-moz-math-increment-script-level", MozMathIncrementScriptLevel, IN_INCREMENT_SCRIPT_LEVEL_STATE, _),
|
||||||
|
|
|
@ -2033,9 +2033,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
NonTSPseudoClass::MozUIValid |
|
NonTSPseudoClass::MozUIValid |
|
||||||
NonTSPseudoClass::MozBroken |
|
NonTSPseudoClass::MozBroken |
|
||||||
NonTSPseudoClass::MozLoading |
|
NonTSPseudoClass::MozLoading |
|
||||||
NonTSPseudoClass::MozHandlerBlocked |
|
|
||||||
NonTSPseudoClass::MozHandlerDisabled |
|
|
||||||
NonTSPseudoClass::MozHandlerCrashed |
|
|
||||||
NonTSPseudoClass::Required |
|
NonTSPseudoClass::Required |
|
||||||
NonTSPseudoClass::Optional |
|
NonTSPseudoClass::Optional |
|
||||||
NonTSPseudoClass::ReadOnly |
|
NonTSPseudoClass::ReadOnly |
|
||||||
|
@ -2046,9 +2043,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
NonTSPseudoClass::MozDevtoolsHighlighted |
|
NonTSPseudoClass::MozDevtoolsHighlighted |
|
||||||
NonTSPseudoClass::MozStyleeditorTransitioning |
|
NonTSPseudoClass::MozStyleeditorTransitioning |
|
||||||
NonTSPseudoClass::MozFocusRing |
|
NonTSPseudoClass::MozFocusRing |
|
||||||
NonTSPseudoClass::MozHandlerClickToPlay |
|
|
||||||
NonTSPseudoClass::MozHandlerVulnerableUpdatable |
|
|
||||||
NonTSPseudoClass::MozHandlerVulnerableNoUpdate |
|
|
||||||
NonTSPseudoClass::MozHandlerNoPlugins |
|
NonTSPseudoClass::MozHandlerNoPlugins |
|
||||||
NonTSPseudoClass::MozMathIncrementScriptLevel |
|
NonTSPseudoClass::MozMathIncrementScriptLevel |
|
||||||
NonTSPseudoClass::InRange |
|
NonTSPseudoClass::InRange |
|
||||||
|
|
Загрузка…
Ссылка в новой задаче