diff --git a/mozilla/browser/base/content/browser.js b/mozilla/browser/base/content/browser.js index 1ceec4807d0..c0e0e20ce58 100644 --- a/mozilla/browser/base/content/browser.js +++ b/mozilla/browser/base/content/browser.js @@ -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, diff --git a/mozilla/content/base/src/nsObjectLoadingContent.cpp b/mozilla/content/base/src/nsObjectLoadingContent.cpp index 0d05754119d..55cb0e73293 100644 --- a/mozilla/content/base/src/nsObjectLoadingContent.cpp +++ b/mozilla/content/base/src/nsObjectLoadingContent.cpp @@ -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 diff --git a/mozilla/content/base/src/nsObjectLoadingContent.h b/mozilla/content/base/src/nsObjectLoadingContent.h index 7b351952f10..ea4fbe1fcda 100644 --- a/mozilla/content/base/src/nsObjectLoadingContent.h +++ b/mozilla/content/base/src/nsObjectLoadingContent.h @@ -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; }; diff --git a/mozilla/content/events/public/nsIEventStateManager.h b/mozilla/content/events/public/nsIEventStateManager.h index 5689f2e5120..d90d0acfb4a 100644 --- a/mozilla/content/events/public/nsIEventStateManager.h +++ b/mozilla/content/events/public/nsIEventStateManager.h @@ -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__ diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index 702d2f778d1..ab6cf0f6a67 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -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 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 for svg (bug 240408) - if (aOurContent->Tag() == nsHTMLAtoms::embed) -#ifdef MOZ_SVG - if (!aMimeType.LowerCaseEqualsLiteral("image/svg+xml")) -#endif - return PR_FALSE; - - - nsCOMPtr info( - do_GetService(NS_WEBNAVIGATION_INFO_CONTRACTID, &rv)); - PRUint32 supported; - if (info) { - nsCOMPtr 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 element(do_QueryInterface(aAnchor)); - - if (!element) - return; - - nsCOMPtr style; - element->GetStyle(getter_AddRefs(style)); - - nsCOMPtr 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 htmldoc(do_QueryInterface(doc)); - PRInt32 id; - if (htmldoc && !doc->IsCaseSensitive()) - id = kNameSpaceID_None; - else - id = kNameSpaceID_XHTML; - - nsCOMPtr anchor; - nsresult rv = doc->CreateElem(nsHTMLAtoms::a, nsnull, id, htmldoc != nsnull, - getter_AddRefs(anchor)); - - nsCOMPtr img; - rv |= doc->CreateElem(nsHTMLAtoms::img, nsnull, id, htmldoc != nsnull, - getter_AddRefs(img)); - - nsCOMPtr 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 imageLoader = do_QueryInterface(img); - // XXX imageLoader->ImageURIChanged(src); - - // get the localized text - nsXPIDLString missingPluginLabel; - - nsCOMPtr stringBundleService = - do_GetService(NS_STRINGBUNDLE_CONTRACTID); - - if (stringBundleService) { - nsCOMPtr 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 anchorStyleContext = - styleSet->ResolveStyleFor(anchor, mStyleContext); - nsRefPtr imgStyleContext = - styleSet->ResolveStyleFor(img, anchorStyleContext); - nsRefPtr 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 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); } diff --git a/mozilla/layout/generic/nsObjectFrame.h b/mozilla/layout/generic/nsObjectFrame.h index 6697a51c08a..c16026b6732 100644 --- a/mozilla/layout/generic/nsObjectFrame.h +++ b/mozilla/layout/generic/nsObjectFrame.h @@ -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; }; diff --git a/mozilla/layout/style/nsCSSPseudoClassList.h b/mozilla/layout/style/nsCSSPseudoClassList.h index 83ebce568a2..0501cbf63c2 100644 --- a/mozilla/layout/style/nsCSSPseudoClassList.h +++ b/mozilla/layout/style/nsCSSPseudoClassList.h @@ -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 diff --git a/mozilla/layout/style/nsCSSStyleSheet.cpp b/mozilla/layout/style/nsCSSStyleSheet.cpp index b6b466c4734..741d8a83fef 100644 --- a/mozilla/layout/style/nsCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsCSSStyleSheet.cpp @@ -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; } diff --git a/mozilla/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd b/mozilla/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd index 5c34fb38868..6da416f71c5 100644 --- a/mozilla/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd +++ b/mozilla/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd @@ -19,3 +19,5 @@ + + diff --git a/mozilla/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.properties b/mozilla/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.properties index 30e116afd07..d9d4da7ce41 100644 --- a/mozilla/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.properties +++ b/mozilla/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.properties @@ -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. diff --git a/mozilla/toolkit/mozapps/Makefile.in b/mozilla/toolkit/mozapps/Makefile.in index ab90eb9f4a7..b56ff7f179f 100755 --- a/mozilla/toolkit/mozapps/Makefile.in +++ b/mozilla/toolkit/mozapps/Makefile.in @@ -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 diff --git a/mozilla/toolkit/mozapps/jar.mn b/mozilla/toolkit/mozapps/jar.mn index fcf6c1e0019..8cad3077a47 100755 --- a/mozilla/toolkit/mozapps/jar.mn +++ b/mozilla/toolkit/mozapps/jar.mn @@ -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) diff --git a/mozilla/toolkit/mozapps/plugins/Makefile.in b/mozilla/toolkit/mozapps/plugins/Makefile.in new file mode 100644 index 00000000000..9d01d71af47 --- /dev/null +++ b/mozilla/toolkit/mozapps/plugins/Makefile.in @@ -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 . +# 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 + diff --git a/mozilla/toolkit/mozapps/plugins/content/missingPlugin.xml b/mozilla/toolkit/mozapps/plugins/content/missingPlugin.xml new file mode 100644 index 00000000000..e383cf612ba --- /dev/null +++ b/mozilla/toolkit/mozapps/plugins/content/missingPlugin.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + &missingPlugin.label; + + + + + + + + + + + + + + diff --git a/mozilla/toolkit/mozapps/plugins/content/missingPluginBinding.css b/mozilla/toolkit/mozapps/plugins/content/missingPluginBinding.css new file mode 100644 index 00000000000..4b7fad176e4 --- /dev/null +++ b/mozilla/toolkit/mozapps/plugins/content/missingPluginBinding.css @@ -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 . + * 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; +} + + diff --git a/mozilla/toolkit/mozapps/plugins/pluginGlue.js b/mozilla/toolkit/mozapps/plugins/pluginGlue.js new file mode 100644 index 00000000000..8a43a509088 --- /dev/null +++ b/mozilla/toolkit/mozapps/plugins/pluginGlue.js @@ -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 . + * 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; +} + diff --git a/mozilla/toolkit/themes/pinstripe/mozapps/jar.mn b/mozilla/toolkit/themes/pinstripe/mozapps/jar.mn index f0108f3492f..672351ff404 100755 --- a/mozilla/toolkit/themes/pinstripe/mozapps/jar.mn +++ b/mozilla/toolkit/themes/pinstripe/mozapps/jar.mn @@ -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) diff --git a/mozilla/toolkit/themes/pinstripe/mozapps/plugins/missingPlugin.css b/mozilla/toolkit/themes/pinstripe/mozapps/plugins/missingPlugin.css new file mode 100644 index 00000000000..e1c8af1f0eb --- /dev/null +++ b/mozilla/toolkit/themes/pinstripe/mozapps/plugins/missingPlugin.css @@ -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; +} diff --git a/mozilla/toolkit/themes/qute/mozapps/jar.mn b/mozilla/toolkit/themes/qute/mozapps/jar.mn index 51ecce18dec..137c3c9dbd5 100644 --- a/mozilla/toolkit/themes/qute/mozapps/jar.mn +++ b/mozilla/toolkit/themes/qute/mozapps/jar.mn @@ -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) diff --git a/mozilla/toolkit/themes/qute/mozapps/plugins/missingPlugin.css b/mozilla/toolkit/themes/qute/mozapps/plugins/missingPlugin.css new file mode 100644 index 00000000000..e1c8af1f0eb --- /dev/null +++ b/mozilla/toolkit/themes/qute/mozapps/plugins/missingPlugin.css @@ -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; +} diff --git a/mozilla/toolkit/themes/winstripe/mozapps/jar.mn b/mozilla/toolkit/themes/winstripe/mozapps/jar.mn index 9d196f707db..ed747805fd2 100644 --- a/mozilla/toolkit/themes/winstripe/mozapps/jar.mn +++ b/mozilla/toolkit/themes/winstripe/mozapps/jar.mn @@ -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) diff --git a/mozilla/toolkit/themes/winstripe/mozapps/plugins/missingPlugin.css b/mozilla/toolkit/themes/winstripe/mozapps/plugins/missingPlugin.css new file mode 100644 index 00000000000..e1c8af1f0eb --- /dev/null +++ b/mozilla/toolkit/themes/winstripe/mozapps/plugins/missingPlugin.css @@ -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; +}