Bug 309521

- add pseudo-classes for :-moz-type-unsupported and :-moz-has-handlerref (and a
  content state for the former)
  - make nsObjectLoadingContent return the right content state
- Add an XBL binding that gets instantiated for broken plugins
  - Make it themable
- Remove a lot of now-unused code in nsObjectFrame
- Fixes pluginfinder.
r+sr=bz, r=mconnor


git-svn-id: svn://10.0.0.236/trunk@186703 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cbiesinger%web.de
2005-12-29 14:15:33 +00:00
parent b2d5b25c82
commit 32c8a8358d
22 changed files with 428 additions and 433 deletions

View File

@@ -713,7 +713,9 @@ function prepareForStartup()
gNavigatorBundle = document.getElementById("bundle_browser");
gProgressMeterPanel = document.getElementById("statusbar-progresspanel");
gBrowser.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver.onUpdatePageReport, false);
gBrowser.addEventListener("PluginNotFound", gMissingPluginInstaller.newMissingPlugin, false);
// Note: we need to listen to untrusted events, because the pluginfinder XBL
// binding can't fire trusted ones (runs with page privileges).
gBrowser.addEventListener("PluginNotFound", gMissingPluginInstaller.newMissingPlugin, false, true);
gBrowser.addEventListener("NewTab", BrowserOpenTab, false);
var webNavigation;
@@ -5877,6 +5879,11 @@ missingPluginInstaller.prototype.installSinglePlugin = function(aEvent){
}
missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
// Since we are expecting also untrusted events, make sure
// that the target is a plugin
if (!(aEvent.target instanceof Components.interfaces.nsIObjectLoadingContent))
return;
// For broken non-object plugin tags, register a click handler so
// that the user can click the plugin replacement to get the new
// plugin. Object tags can, and often do, deal with that themselves,

View File

@@ -245,16 +245,28 @@ class AutoNotifier {
class AutoFallback {
public:
AutoFallback(nsObjectLoadingContent* aContent, const nsresult* rv)
: mContent(aContent), mResult(rv) {}
: mContent(aContent), mResult(rv), mTypeUnsupported(PR_FALSE) {}
~AutoFallback() {
if (NS_FAILED(*mResult)) {
LOG(("OBJLC [%p]: rv=%08x, falling back\n", mContent, *mResult));
mContent->Fallback(PR_FALSE);
if (mTypeUnsupported) {
mContent->mTypeUnsupported = PR_TRUE;
}
}
}
/**
* This function can be called to indicate that, after falling back,
* mTypeUnsupported should be set to true.
*/
void TypeUnsupported() {
mTypeUnsupported = PR_TRUE;
}
private:
nsObjectLoadingContent* mContent;
const nsresult* mResult;
PRBool mTypeUnsupported;
};
/**
@@ -301,6 +313,7 @@ nsObjectLoadingContent::nsObjectLoadingContent()
, mInstantiating(PR_FALSE)
, mUserDisabled(PR_FALSE)
, mSuppressed(PR_FALSE)
, mTypeUnsupported(PR_FALSE)
{
}
@@ -422,11 +435,18 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, nsISupports *aConte
case eType_Loading:
NS_NOTREACHED("Should not have a loading type here!");
case eType_Null:
LOG(("OBJLC [%p]: Unsupported type, falling back\n", this));
// Need to fallback here (instead of using the case below), so that we can
// set mTypeUnsupported without it being overwritten. This is also why we
// return early.
Fallback(PR_FALSE);
// Do nothing, but fire the plugin not found event if needed
if (IsUnsupportedPlugin(thisContent)) {
FirePluginNotFound(thisContent);
}
break;
mTypeUnsupported = PR_TRUE;
return NS_BINDING_ABORTED;
}
if (mFinalListener) {
@@ -664,9 +684,13 @@ nsObjectLoadingContent::ObjectState() const
return NS_EVENT_STATE_SUPPRESSED;
if (mUserDisabled)
return NS_EVENT_STATE_USERDISABLED;
// Otherwise, just broken
return NS_EVENT_STATE_BROKEN;
// Otherwise, broken
PRInt32 state = NS_EVENT_STATE_BROKEN;
if (mTypeUnsupported) {
state |= NS_EVENT_STATE_TYPE_UNSUPPORTED;
}
return state;
};
NS_NOTREACHED("unknown type?");
// this return statement only exists to avoid a compile warning
@@ -872,6 +896,7 @@ nsObjectLoadingContent::ObjectURIChanged(nsIURI* aURI,
if (IsUnsupportedPlugin(thisContent)) {
FirePluginNotFound(thisContent);
}
fallback.TypeUnsupported();
break;
};
@@ -1116,7 +1141,7 @@ nsObjectLoadingContent::UnloadContent()
mFrameLoader = nsnull;
}
mType = eType_Null;
mUserDisabled = mSuppressed = PR_FALSE;
mUserDisabled = mSuppressed = mTypeUnsupported = PR_FALSE;
}
void

View File

@@ -332,6 +332,8 @@ class nsObjectLoadingContent : public nsImageLoadingContent
// Blocking status from content policy
PRBool mUserDisabled : 1;
PRBool mSuppressed : 1;
// Whether we fell back because of an unsupported type
PRBool mTypeUnsupported:1;
friend struct nsAsyncInstantiateEvent;
};

View File

@@ -182,5 +182,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventStateManager, NS_IEVENTSTATEMANAGER_IID)
// Content is still loading such that there is nothing to show the
// user (eg an image which hasn't started coming in yet)
#define NS_EVENT_STATE_LOADING 0x00100000
// Content is of a type that gecko can't handle
#define NS_EVENT_STATE_TYPE_UNSUPPORTED \
0x00200000
#endif // nsIEventStateManager_h__

View File

@@ -495,45 +495,6 @@ nsObjectFrame::GetSkipSides() const
}
// #define DO_DIRTY_INTERSECT 1 // enable dirty rect intersection during paint
static PRBool
IsSupportedImage(const nsCString& aMimeType)
{
nsCOMPtr<imgILoader> loader(do_GetService("@mozilla.org/image/loader;1"));
PRBool supported;
nsresult rv = loader->SupportImageWithMimeType(aMimeType.get(), &supported);
return NS_SUCCEEDED(rv) && supported;
}
static PRBool
IsSupportedDocument(nsIContent* aOurContent,
const nsCString& aMimeType)
{
nsresult rv;
// only allow browser to handle content of <embed> for svg (bug 240408)
if (aOurContent->Tag() == nsHTMLAtoms::embed)
#ifdef MOZ_SVG
if (!aMimeType.LowerCaseEqualsLiteral("image/svg+xml"))
#endif
return PR_FALSE;
nsCOMPtr<nsIWebNavigationInfo> info(
do_GetService(NS_WEBNAVIGATION_INFO_CONTRACTID, &rv));
PRUint32 supported;
if (info) {
nsCOMPtr<nsIWebNavigation> webNav =
do_GetInterface(aOurContent->GetCurrentDoc()->GetScriptGlobalObject());
rv = info->IsTypeSupported(aMimeType, webNav, &supported);
}
return NS_SUCCEEDED(rv) &&
supported != nsIWebNavigationInfo::UNSUPPORTED &&
supported != nsIWebNavigationInfo::PLUGIN;
}
NS_IMETHODIMP
nsObjectFrame::SetInitialChildList(nsPresContext* aPresContext,
nsIAtom* aListName,
@@ -564,7 +525,6 @@ nsObjectFrame::Init(nsPresContext* aPresContext,
#ifdef DEBUG
mInstantiating = PR_FALSE;
#endif
mIsBrokenPlugin = PR_FALSE;
if (sDefaultPluginDisabled == (PRBool)0xffffffff) {
sDefaultPluginDisabled =
@@ -772,36 +732,6 @@ nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext,
}
}
static void
SizeAnchor(nsIContent *aAnchor, PRInt32 aWidth, PRInt32 aHeight)
{
nsCOMPtr<nsIDOMElementCSSInlineStyle> element(do_QueryInterface(aAnchor));
if (!element)
return;
nsCOMPtr<nsIDOMCSSStyleDeclaration> style;
element->GetStyle(getter_AddRefs(style));
nsCOMPtr<nsIDOMCSS2Properties> css2props(do_QueryInterface(style));
if (!css2props) {
return;
}
nsAutoString tmp;
tmp.AppendInt(aWidth);
tmp.AppendLiteral("px");
css2props->SetWidth(tmp);
tmp.Truncate();
tmp.AppendInt(aHeight);
tmp.AppendLiteral("px");
css2props->SetHeight(tmp);
}
NS_IMETHODIMP
nsObjectFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics,
@@ -812,53 +742,6 @@ nsObjectFrame::Reflow(nsPresContext* aPresContext,
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
nsresult rv = NS_OK;
// If we have a child, we toss the reflow over to it.
nsIFrame * child = mFrames.FirstChild();
if (IsBroken()) {
// This is a broken plugin, if we don't already have a child
// frame, create the child frames manually. If any of this frame
// construction code ever changes to use the frame constructor, or
// any other change, this probably needs some changes too.
if (!child) {
CreateDefaultFrames(aPresContext, aMetrics, aReflowState);
child = mFrames.FirstChild();
}
if (child) {
GetDesiredSize(aPresContext, aReflowState, aMetrics);
// Build a reflow state so we can see what the child's border and
// padding are going to be
nsHTMLReflowState state(aPresContext, aReflowState, child,
nsSize(aReflowState.availableWidth,
aReflowState.availableHeight));
float t2p = aPresContext->TwipsToPixels();
PRInt32 width = NSTwipsToIntPixels(aMetrics.width - state.mComputedBorderPadding.LeftRight(), t2p);
PRInt32 height = NSTwipsToIntPixels(aMetrics.height - state.mComputedBorderPadding.TopBottom(), t2p);
// Set the child's content width and height
SizeAnchor(child->GetContent(), width, height);
// SizeAnchor() is seriously evil as it ends up setting an
// attribute (through the style changes that it does) while
// we're in reflow. This is also seriously evil, as it pulls
// that reflow command out of the reflow queue, as leaving it
// there can get us into infinite loops while reflowing object
// frames for missing plugins.
nsReflowType reflowType(eReflowType_StyleChanged);
aPresContext->PresShell()->CancelReflowCommand(child, &reflowType);
}
}
if (child) {
// Reflow the child; our size just depends on that of the child,
// pure and simple
return HandleChild(aPresContext, aMetrics, aReflowState, aStatus, child);
}
// Get our desired size
GetDesiredSize(aPresContext, aReflowState, aMetrics);
@@ -960,51 +843,11 @@ nsObjectFrame::FixupWindow(const nsSize& aSize)
#endif
}
nsresult
nsObjectFrame::HandleChild(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus,
nsIFrame* child)
{
// Note that in the image and document cases the child shares our
// style context, so we simply want to reflow the child with pretty
// much our own reflow state, in the case of a broken plugin, the
// child has its own style context, so we create a new reflow
// state....
// XXXbz maybe we should always have a different style context?
// XXXroc no, that seems to break things. But as is, this causes
// an assertion failure in nsContainerFrame because the reflow
// state isn't built for the right frame.
nsReflowStatus status;
if (IsBroken()) {
nsHTMLReflowState state(aPresContext, aReflowState, child,
nsSize(aReflowState.availableWidth,
aReflowState.availableHeight));
ReflowChild(child, aPresContext, aMetrics, state, 0, 0, 0, status);
FinishReflowChild(child, aPresContext, &state, aMetrics, 0, 0, 0);
} else {
ReflowChild(child, aPresContext, aMetrics, aReflowState, 0, 0, 0, status);
FinishReflowChild(child, aPresContext, &aReflowState, aMetrics, 0, 0, 0);
}
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
PRBool
nsObjectFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
{
if (aTabIndex)
*aTabIndex = -1;
if (IsBroken()) {
// Inner anchor for "click to install plugin" is focusable,
// but not the object frame itself
return PR_FALSE;
}
return nsObjectFrameSuper::IsFocusable(aTabIndex, aWithMouse);
}
@@ -1070,199 +913,6 @@ nsPoint nsObjectFrame::GetWindowOriginInPixels(PRBool aWindowless)
return origin;
}
void
nsObjectFrame::CreateDefaultFrames(nsPresContext *aPresContext,
nsHTMLReflowMetrics& aMetrics,
const nsHTMLReflowState& aReflowState)
{
NS_ASSERTION(IsBroken(),
"CreateDefaultFrames() called on non-broken plugin!");
nsIFrame * child = mFrames.FirstChild();
if (child) {
NS_ERROR("Um, this should only be called once!");
// We have a child already, don't do anything
return;
}
// first, we need to get the document
nsIDocument *doc = mContent->GetDocument();
nsIPresShell *shell = aPresContext->GetPresShell();
nsStyleSet *styleSet = shell->StyleSet();
nsCOMPtr<nsIHTMLDocument> htmldoc(do_QueryInterface(doc));
PRInt32 id;
if (htmldoc && !doc->IsCaseSensitive())
id = kNameSpaceID_None;
else
id = kNameSpaceID_XHTML;
nsCOMPtr<nsIContent> anchor;
nsresult rv = doc->CreateElem(nsHTMLAtoms::a, nsnull, id, htmldoc != nsnull,
getter_AddRefs(anchor));
nsCOMPtr<nsIContent> img;
rv |= doc->CreateElem(nsHTMLAtoms::img, nsnull, id, htmldoc != nsnull,
getter_AddRefs(img));
nsCOMPtr<nsITextContent> text;
rv |= NS_NewTextNode(getter_AddRefs(text), doc->NodeInfoManager());
if (NS_FAILED(rv))
return;
// Mark the nodes anonymous
anchor->SetNativeAnonymous(PR_TRUE);
img->SetNativeAnonymous(PR_TRUE);
text->SetNativeAnonymous(PR_TRUE);
// Set up the anonymous tree. Note that the binding parent for the anchor is
// used to cut off style rules from the page so they won't apply to it.
rv = anchor->BindToTree(doc, mContent, anchor, PR_TRUE);
if (NS_FAILED(rv)) {
anchor->UnbindFromTree();
return;
}
anchor->AppendChildTo(img, PR_FALSE);
anchor->AppendChildTo(text, PR_FALSE);
nsAutoString style;
CopyASCIItoUTF16("text-align: -moz-center;"
"overflow: -moz-hidden-unscrollable;"
"display: block;"
"border: 1px outset;"
"padding: 5px;"
"font-size: 12px;"
"font-family: sans-serif;"
"background: white;"
"-moz-user-select: none;"
"text-decoration: none;"
"color: black;", style);
// Style things and load the image
anchor->SetAttr(kNameSpaceID_None, nsHTMLAtoms::style, style, PR_TRUE);
anchor->SetAttr(kNameSpaceID_None, nsHTMLAtoms::href, NS_LITERAL_STRING("#"), PR_TRUE);
NS_NAMED_LITERAL_STRING(src,
"chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png");
img->SetAttr(kNameSpaceID_None, nsHTMLAtoms::src, src, PR_FALSE);
NS_NAMED_LITERAL_STRING(imgStyle,
"display: block; border: 0px; width: 32px; height: 32px;");
img->SetAttr(kNameSpaceID_None, nsHTMLAtoms::style, imgStyle, PR_FALSE);
// Kick off the image load.
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(img);
// XXX imageLoader->ImageURIChanged(src);
// get the localized text
nsXPIDLString missingPluginLabel;
nsCOMPtr<nsIStringBundleService> stringBundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if (stringBundleService) {
nsCOMPtr<nsIStringBundle> stringBundle;
stringBundleService->CreateBundle(
"chrome://mozapps/locale/plugins/plugins.properties",
getter_AddRefs(stringBundle));
if (stringBundle)
rv = stringBundle->GetStringFromName(NS_LITERAL_STRING("missingPlugin.label").get(),
getter_Copies(missingPluginLabel));
}
if (!stringBundleService || NS_FAILED(rv))
missingPluginLabel.AssignLiteral("Click here to download plugin.");
text->SetText(missingPluginLabel, PR_FALSE);
// Resolve style for the anchor, img, and text nodes.
nsRefPtr<nsStyleContext> anchorStyleContext =
styleSet->ResolveStyleFor(anchor, mStyleContext);
nsRefPtr<nsStyleContext> imgStyleContext =
styleSet->ResolveStyleFor(img, anchorStyleContext);
nsRefPtr<nsStyleContext> textStyleContext =
shell->StyleSet()->ResolveStyleForNonElement(anchorStyleContext);
if (!anchorStyleContext || !imgStyleContext || !textStyleContext)
return;
nsIFrame *anchorFrame = nsnull;
nsIFrame *imgFrame = nsnull;
nsIFrame *textFrame = nsnull;
do {
anchorFrame = NS_NewBlockFrame(shell);
if (NS_UNLIKELY(!anchorFrame)) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
rv = anchorFrame->Init(aPresContext, anchor, this, anchorStyleContext, PR_FALSE);
if (NS_FAILED(rv))
break;
// Give it a space manager, so it won't crash of ancestors don't have one
anchorFrame->AddStateBits(NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT);
nsHTMLContainerFrame::CreateViewForFrame(anchorFrame, this, PR_FALSE);
imgFrame = NS_NewImageFrame(shell);
if (NS_UNLIKELY(!imgFrame))
return;
rv = imgFrame->Init(aPresContext, img, anchorFrame, imgStyleContext, PR_FALSE);
if (NS_FAILED(rv))
break;
nsHTMLContainerFrame::CreateViewForFrame(imgFrame, anchorFrame, PR_FALSE);
anchorFrame->AppendFrames(nsnull, imgFrame);
textFrame = NS_NewTextFrame(shell);
if (NS_UNLIKELY(!textFrame)) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
rv = textFrame->Init(aPresContext, text, anchorFrame, textStyleContext,
PR_FALSE);
if (NS_FAILED(rv))
break;
textFrame->SetInitialChildList(aPresContext, nsnull, nsnull);
anchorFrame->AppendFrames(nsnull, textFrame);
} while (0);
if (NS_FAILED(rv)) {
if (anchorFrame)
anchorFrame->Destroy(aPresContext);
if (imgFrame)
imgFrame->Destroy(aPresContext);
if (textFrame)
textFrame->Destroy(aPresContext);
} else {
// Creation of all our anonymous content succeeded.
mFrames.AppendFrame(this, anchorFrame);
}
nsCOMPtr<nsISupportsArray> array;
NS_NewISupportsArray(getter_AddRefs(array));
if (array) {
array->AppendElement(anchor);
array->AppendElement(img);
array->AppendElement(text);
shell->SetAnonymousContentFor(mContent, array);
}
}
NS_IMETHODIMP
nsObjectFrame::DidReflow(nsPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
@@ -1332,12 +982,6 @@ nsObjectFrame::Paint(nsPresContext* aPresContext,
if (!GetStyleVisibility()->IsVisibleOrCollapsed())
return NS_OK;
nsIFrame * child = mFrames.FirstChild();
if (child) { // if we have children, we are probably not really a plugin
nsObjectFrameSuper::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
return NS_OK;
}
// If we are painting in Print Preview do nothing....
if (aPresContext->Type() == nsPresContext::eContext_PrintPreview) {
return NS_OK;
@@ -2315,10 +1959,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetValue(nsPluginInstancePeerVariable varia
NS_IMETHODIMP
nsPluginInstanceOwner::PluginNotAvailable(const char *aMimeType)
{
if (mOwner) {
mOwner->PluginNotAvailable(aMimeType);
}
return NS_OK;
}
@@ -2709,37 +2349,6 @@ void nsObjectFrame::FixUpURLS(const nsString &name, nsAString &value)
}
}
void
nsObjectFrame::PluginNotAvailable(const char *aMimeType)
{
if (!aMimeType) {
NS_ERROR("bogus type... behavior will be broken");
return;
}
nsDependentCString type(aMimeType);
if (!sDefaultPluginDisabled) {
// The default plugin is enabled, don't fire events etc.
return;
}
// For non-image and non-document mime types, fire the plugin not
// found event and mark this plugin as broken.
if (!IsSupportedImage(type) &&
!IsSupportedDocument(mContent, type)) {
FirePluginNotFoundEvent(mContent);
mIsBrokenPlugin = PR_TRUE;
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
GetParent()->ReflowDirtyChild(mContent->GetDocument()->GetShellAt(0),
this);
}
}
// Cache the attributes and/or parameters of our tag into a single set
// of arrays to be compatible with 4.x. The attributes go first,
// followed by a PARAM/null and then any PARAM tags. Also, hold the
@@ -3373,14 +2982,6 @@ nsPluginInstanceOwner::MouseUp(nsIDOMEvent* aMouseEvent)
nsresult
nsPluginInstanceOwner::MouseClick(nsIDOMEvent* aMouseEvent)
{
if (mOwner->IsBroken()) {
FirePluginNotFoundEvent(mOwner->GetContent());
aMouseEvent->PreventDefault();
return NS_OK;
}
return DispatchMouseToPlugin(aMouseEvent);
}

View File

@@ -130,20 +130,9 @@ public:
void FixUpURLS(const nsString &name, nsAString &value);
void PluginNotAvailable(const char *aMimeType);
// Returns true if this object frame links to content that we have
// no enabled plugin for, that means not even the default plugin.
PRBool IsBroken() const
{
return mIsBrokenPlugin;
}
virtual PRBool IsContainingBlock() const
{
// Broken plugins are containing blocks.
return IsBroken();
return PR_FALSE;
}
protected:
@@ -171,12 +160,6 @@ protected:
*/
void FixupWindow(const nsSize& aSize);
nsresult HandleChild(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus,
nsIFrame* child);
PRBool IsFocusable(PRInt32 *aTabIndex = nsnull, PRBool aWithMouse = PR_FALSE);
// check attributes and optionally CSS to see if we should display anything
@@ -186,10 +169,6 @@ protected:
nsPoint GetWindowOriginInPixels(PRBool aWindowless);
void CreateDefaultFrames(nsPresContext *aPresContext,
nsHTMLReflowMetrics& aMetrics,
const nsHTMLReflowState& aReflowState);
/**
* Makes sure that mInstanceOwner is valid and without a current plugin
* instance. Essentially, this prepares the frame to receive a new plugin.
@@ -207,8 +186,6 @@ private:
// to the underlying problem described in bug 136927.
PRBool mInstantiating;
#endif
PRPackedBool mIsBrokenPlugin;
};

View File

@@ -82,6 +82,9 @@ CSS_PSEUDO_CLASS(mozBroken, ":-moz-broken")
CSS_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled")
CSS_PSEUDO_CLASS(mozSuppressed, ":-moz-suppressed")
CSS_PSEUDO_CLASS(mozLoading, ":-moz-loading")
CSS_PSEUDO_CLASS(mozTypeUnsupported, ":-moz-type-unsupported")
CSS_PSEUDO_CLASS(mozHasHandlerRef, ":-moz-has-handlerref")
// CSS 3 UI
// http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes

View File

@@ -2940,6 +2940,25 @@ static PRBool SelectorMatches(RuleProcessorData &data,
child->Tag()->Equals(nsDependentString(pseudoClass->mString)))));
result = (child == nsnull);
}
else if (nsCSSPseudoClasses::mozHasHandlerRef == pseudoClass->mAtom) {
nsIContent *child = nsnull;
nsIContent *element = data.mContent;
PRInt32 index = -1;
result = PR_FALSE;
if (element) {
do {
child = element->GetChildAt(++index);
if (child && child->IsContentOfType(nsIContent::eHTML) &&
child->Tag() == nsHTMLAtoms::param &&
child->AttrValueIs(kNameSpaceID_None, nsHTMLAtoms::name,
NS_LITERAL_STRING("pluginurl"), eIgnoreCase)) {
result = PR_TRUE;
break;
}
} while (child);
}
}
else if (nsCSSPseudoClasses::root == pseudoClass->mAtom) {
result = (data.mParentContent == nsnull);
}
@@ -3060,6 +3079,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
else if (nsCSSPseudoClasses::mozLoading == pseudoClass->mAtom) {
stateToCheck = NS_EVENT_STATE_LOADING;
}
else if (nsCSSPseudoClasses::mozTypeUnsupported == pseudoClass->mAtom) {
stateToCheck = NS_EVENT_STATE_TYPE_UNSUPPORTED;
}
else if (nsCSSPseudoClasses::required == pseudoClass->mAtom) {
stateToCheck = NS_EVENT_STATE_REQUIRED;
}

View File

@@ -19,3 +19,5 @@
<!ENTITY pluginWizard.finalPage.moreInfo.label "Find out more about Plugins or manually find missing plugins.">
<!ENTITY pluginWizard.finalPage.restart.label "&brandShortName; needs to be restarted for the plugin(s) to work.">
<!ENTITY missingPlugin.label "Click here to download plugin.">

View File

@@ -19,5 +19,3 @@ pluginInstallationSummary.manualInstall.tooltip=Manually install the plugin.
pluginInstallation.noPluginsFound=No suitable plugins were found.
pluginInstallation.noPluginsInstalled=No plugins were installed.
pluginInstallation.unknownPlugin=Unknown Plugin
missingPlugin.label=Click here to download plugin.

View File

@@ -42,7 +42,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = downloads extensions update xpinstall
DIRS = downloads extensions update xpinstall plugins
include $(topsrcdir)/config/rules.mk

View File

@@ -32,3 +32,5 @@ toolkit.jar:
content/mozapps/plugins/pluginInstallerWizard.css (plugins/content/pluginInstallerWizard.css)
content/mozapps/plugins/pluginInstallerDatasource.js (plugins/content/pluginInstallerDatasource.js)
content/mozapps/plugins/pluginInstallerService.js (plugins/content/pluginInstallerService.js)
content/mozapps/plugins/missingPlugin.xml (plugins/content/missingPlugin.xml)
content/mozapps/plugins/missingPluginBinding.css (plugins/content/missingPluginBinding.css)

View File

@@ -0,0 +1,48 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the makefile for the plugin finder.
#
# The Initial Developer of the Original Code is
# Christian Biesinger <cbiesinger@web.de>.
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
EXTRA_COMPONENTS = pluginGlue.js
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,75 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is the Mozilla "puzzle piece" xbl binding.
-
- The Initial Developer of the Original Code is
- Christian Biesinger <cbiesinger@web.de>.
- Portions created by the Initial Developer are Copyright (C) 2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<!DOCTYPE bindings SYSTEM "chrome://mozapps/locale/plugins/plugins.dtd">
<bindings id="pluginBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<binding id="missingPlugin">
<resources>
<stylesheet src="chrome://mozapps/skin/plugins/missingPlugin.css"/>
</resources>
<content>
<!-- This uses html:a instead of something like a div so that it can be
tabbed to and just generically behaves more like something clickable
(i.e. for a11y reasons. see Bug 245349).
-->
<html:a href="#">
<xul:image id="missingPluginPlaceholder"/>
&missingPlugin.label;
</html:a>
<!-- Make our fallback content disappear (XBL requires this) -->
<html:div style="display:none;"><children/></html:div>
</content>
<handlers>
<handler event="click" button="0">
<![CDATA[
event.preventDefault();
// Fire a PluginNotFound event to trigger the infobar
var ev = document.createEvent("Events");
ev.initEvent("PluginNotFound", true, true);
this.dispatchEvent(ev);
]]>
</handler>
</handlers>
</binding>
</bindings>

View File

@@ -0,0 +1,44 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the stylesheet for the pluginfinder XBL binding.
*
* The Initial Developer of the Original Code is
* Christian Biesinger <cbiesinger@web.de>.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
embed:-moz-type-unsupported, applet:-moz-type-unsupported,
object:-moz-has-handlerref:-moz-type-unsupported {
-moz-binding: url('chrome://mozapps/content/plugins/missingPlugin.xml#missingPlugin') !important;
}

View File

@@ -0,0 +1,78 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla pluginfinder style sheet registration code.
*
* The Initial Developer of the Original Code is
* Christian Biesinger <cbiesinger@web.de>.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* @file
* This file contains the agent style sheet registration code for the
* pluginfinder XBL binding. It's not a real module, it only exists so that we
* can call addCategoryEntry / deleteCategoryEntry.
*/
var module = {
categoryEntry: "pluginfinder xbl binding",
categoryValue: "chrome://mozapps/content/plugins/missingPluginBinding.css",
// registerSelf: Register this component.
registerSelf: function (compMgr, fileSpec, location, type) {
var catman = Components.classes['@mozilla.org/categorymanager;1']
.getService(Components.interfaces.nsICategoryManager);
catman.addCategoryEntry("agent-style-sheets", this.categoryEntry,
this.categoryValue, true, true);
},
// unregisterSelf: Unregister this component.
unregisterSelf: function (aCompMgr, aLocation, aLoaderStr) {
catman.deleteCategoryEntry("agent-style-sheets", this.categoryEntry,
true);
},
// getClassObject: Return this component's factory object.
getClassObject: function (compMgr, cid, iid) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
},
// canUnload: n/a (returns true)
canUnload: function(compMgr) {
return true;
}
};
// NSGetModule: Return the nsIModule object.
function NSGetModule(compMgr, fileSpec) {
return module;
}

View File

@@ -14,6 +14,7 @@ classic.jar:
skin/classic/mozapps/extensions/about.css (extensions/about.css)
skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
skin/classic/mozapps/extensions/update.css (extensions/update.css)
skin/classic/mozapps/plugins/missingPlugin.css (plugins/missingPlugin.css)
skin/classic/mozapps/pref/check.gif (pref/check.gif)
skin/classic/mozapps/pref/dot.gif (pref/dot.gif)
skin/classic/mozapps/pref/pref.css (pref/pref.css)

View File

@@ -0,0 +1,35 @@
/*
* This file's style only applies to broken objects, not the rest
* of the page.
*/
@namespace html url(http://www.w3.org/1999/xhtml);
html|object > *|*,
html|embed > *|*,
html|applet > *|* {
width: inherit;
height: inherit;
}
html|a {
text-align: -moz-center;
overflow: -moz-hidden-unscrollable;
display: block;
border: 1px outset;
padding: 5px;
font-size: 12px;
font-family: sans-serif;
background: white;
-moz-user-select: none;
text-decoration: none;
color: black;
}
#missingPluginPlaceholder {
list-style-image: url(chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png);
display: block;
border: 0px;
width: 32px;
height: 32px;
}

View File

@@ -15,6 +15,7 @@ classic.jar:
skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
skin/classic/mozapps/extensions/update.css (extensions/update.css)
skin/classic/mozapps/extensions/themeGeneric.png (extensions/themeGeneric.png)
skin/classic/mozapps/plugins/missingPlugin.css (plugins/missingPlugin.css)
skin/classic/mozapps/pref/check.gif (pref/check.gif)
skin/classic/mozapps/pref/dot.gif (pref/dot.gif)
skin/classic/mozapps/pref/pref.css (pref/pref.css)

View File

@@ -0,0 +1,35 @@
/*
* This file's style only applies to broken objects, not the rest
* of the page.
*/
@namespace html url(http://www.w3.org/1999/xhtml);
html|object > *|*,
html|embed > *|*,
html|applet > *|* {
width: inherit;
height: inherit;
}
html|a {
text-align: -moz-center;
overflow: -moz-hidden-unscrollable;
display: block;
border: 1px outset;
padding: 5px;
font-size: 12px;
font-family: sans-serif;
background: white;
-moz-user-select: none;
text-decoration: none;
color: black;
}
#missingPluginPlaceholder {
list-style-image: url(chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png);
display: block;
border: 0px;
width: 32px;
height: 32px;
}

View File

@@ -14,6 +14,7 @@ classic.jar:
skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
skin/classic/mozapps/extensions/update.css (extensions/update.css)
skin/classic/mozapps/extensions/themeGeneric.png (extensions/themeGeneric.png)
skin/classic/mozapps/plugins/missingPlugin.css (plugins/missingPlugin.css)
skin/classic/mozapps/plugins/pluginInstallerWizard.css (plugins/pluginInstallerWizard.css)
skin/classic/mozapps/pref/check.gif (pref/check.gif)
skin/classic/mozapps/pref/dot.gif (pref/dot.gif)

View File

@@ -0,0 +1,35 @@
/*
* This file's style only applies to broken objects, not the rest
* of the page.
*/
@namespace html url(http://www.w3.org/1999/xhtml);
html|object > *|*,
html|embed > *|*,
html|applet > *|* {
width: inherit;
height: inherit;
}
html|a {
text-align: -moz-center;
overflow: -moz-hidden-unscrollable;
display: block;
border: 1px outset;
padding: 5px;
font-size: 12px;
font-family: sans-serif;
background: white;
-moz-user-select: none;
text-decoration: none;
color: black;
}
#missingPluginPlaceholder {
list-style-image: url(chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png);
display: block;
border: 0px;
width: 32px;
height: 32px;
}