Merge mozilla-central into mozilla-inbound

This commit is contained in:
Ehsan Akhgari 2012-07-19 08:44:19 -04:00
commit 6f83bbeaa8
15 changed files with 219 additions and 1074 deletions

View File

@ -1185,6 +1185,11 @@ public:
return mLoadedAsData;
}
bool IsLoadedAsInteractiveData()
{
return mLoadedAsInteractiveData;
}
bool MayStartLayout()
{
return mMayStartLayout;
@ -1770,6 +1775,11 @@ protected:
// as scripts and plugins, disabled.
bool mLoadedAsData;
// This flag is only set in nsXMLDocument, for e.g. documents used in XBL. We
// don't want animations to play in such documents, so we need to store the
// flag here so that we can check it in nsDocument::GetAnimationController.
bool mLoadedAsInteractiveData;
// If true, whoever is creating the document has gotten it to the
// point where it's safe to start layout on it.
bool mMayStartLayout;

View File

@ -1173,11 +1173,6 @@ protected:
bool mInXBLUpdate:1;
// This flag is only set in nsXMLDocument, for e.g. documents used in XBL. We
// don't want animations to play in such documents, so we need to store the
// flag here so that we can check it in nsDocument::GetAnimationController.
bool mLoadedAsInteractiveData:1;
// Whether we're currently holding a lock on all of our images.
bool mLockingImages:1;

View File

@ -1536,21 +1536,6 @@ nsresult
nsGenericElement::GetAttribute(const nsAString& aName,
nsAString& aReturn)
{
// I hate XUL
if (IsXUL()) {
const nsAttrValue* val =
nsXULElement::FromContent(this)->GetAttrValue(aName);
if (val) {
val->ToString(aReturn);
}
else {
// XXX should be SetDOMStringToNull(aReturn);
// See bug 232598
aReturn.Truncate();
}
return NS_OK;
}
const nsAttrValue* val =
mAttrsAndChildren.GetAttr(aName,
IsHTML() && IsInHTMLDocument() ?
@ -1558,7 +1543,13 @@ nsGenericElement::GetAttribute(const nsAString& aName,
if (val) {
val->ToString(aReturn);
} else {
SetDOMStringToNull(aReturn);
if (IsXUL()) {
// XXX should be SetDOMStringToNull(aReturn);
// See bug 232598
aReturn.Truncate();
} else {
SetDOMStringToNull(aReturn);
}
}
return NS_OK;

View File

@ -575,8 +575,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
#ifdef MOZ_XUL
if (aClone && !aParent && aNode->IsElement() &&
aNode->AsElement()->IsXUL()) {
nsXULElement *xulElem = static_cast<nsXULElement*>(elem);
if (!xulElem->mPrototype || xulElem->IsInDoc()) {
if (!aNode->OwnerDoc()->IsLoadedAsInteractiveData()) {
clone->SetFlags(NODE_FORCE_XBL_BINDINGS);
}
}

View File

@ -193,15 +193,6 @@ nsStyledElementNotElementCSSInlineStyle::GetInlineStyleRule()
nsIDOMCSSStyleDeclaration*
nsStyledElementNotElementCSSInlineStyle::GetStyle(nsresult* retval)
{
nsXULElement* xulElement = nsXULElement::FromContent(this);
if (xulElement) {
nsresult rv = xulElement->EnsureLocalStyle();
if (NS_FAILED(rv)) {
*retval = rv;
return nsnull;
}
}
nsGenericElement::nsDOMSlots *slots = DOMSlots();
if (!slots->mStyle) {

View File

@ -40,7 +40,6 @@
#include "nsMutationEvent.h"
#include "nsIXPConnect.h"
#include "nsDOMCID.h"
#include "nsIScriptEventHandlerOwner.h"
#include "nsFocusManager.h"
#include "nsIDOMElement.h"
#include "nsContentUtils.h"
@ -662,21 +661,8 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
NS_ASSERTION(!listener->GetHandler(), "What is there to compile?");
nsIScriptContext *context = listener->GetEventContext();
nsCOMPtr<nsIScriptEventHandlerOwner> handlerOwner =
do_QueryInterface(mTarget);
nsScriptObjectHolder<JSObject> handler(context);
if (handlerOwner) {
result = handlerOwner->GetCompiledEventHandler(aListenerStruct->mTypeAtom,
handler);
if (NS_SUCCEEDED(result) && handler) {
aListenerStruct->mHandlerIsString = false;
} else {
// Make sure there's nothing in the holder in the failure case
handler.set(nsnull);
}
}
if (aListenerStruct->mHandlerIsString) {
// OK, we didn't find an existing compiled event handler. Flag us
// as not a string so we don't keep trying to compile strings
@ -745,41 +731,29 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
return NS_ERROR_FAILURE;
}
PRUint32 argCount;
const char **argNames;
// If no content, then just use kNameSpaceID_None for the
// namespace ID. In practice, it doesn't matter since SVG is
// the only thing with weird arg names and SVG doesn't map event
// listeners to the window.
nsContentUtils::GetEventArgNames(content ?
content->GetNameSpaceID() :
kNameSpaceID_None,
aListenerStruct->mTypeAtom,
&argCount, &argNames);
if (handlerOwner) {
// Always let the handler owner compile the event
// handler, as it may want to use a special
// context or scope object.
result = handlerOwner->CompileEventHandler(context,
aListenerStruct->mTypeAtom,
*body,
url.get(), lineNo,
handler);
} else {
PRUint32 argCount;
const char **argNames;
// If no content, then just use kNameSpaceID_None for the
// namespace ID. In practice, it doesn't matter since SVG is
// the only thing with weird arg names and SVG doesn't map event
// listeners to the window.
nsContentUtils::GetEventArgNames(content ?
content->GetNameSpaceID() :
kNameSpaceID_None,
aListenerStruct->mTypeAtom,
&argCount, &argNames);
result = context->CompileEventHandler(aListenerStruct->mTypeAtom,
argCount, argNames,
*body,
url.get(), lineNo,
SCRIPTVERSION_DEFAULT, // for now?
handler);
if (result == NS_ERROR_ILLEGAL_VALUE) {
NS_WARNING("Probably a syntax error in the event handler!");
return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA;
}
NS_ENSURE_SUCCESS(result, result);
result = context->CompileEventHandler(aListenerStruct->mTypeAtom,
argCount, argNames,
*body,
url.get(), lineNo,
SCRIPTVERSION_DEFAULT, // for now?
handler);
if (result == NS_ERROR_ILLEGAL_VALUE) {
NS_WARNING("Probably a syntax error in the event handler!");
return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA;
}
NS_ENSURE_SUCCESS(result, result);
}
if (handler) {

View File

@ -130,8 +130,13 @@ nsresult nsGStreamerReader::Init(nsBuiltinDecoderReader* aCloneDonor)
gst_object_unref(sinkpad);
mAudioSink = gst_parse_bin_from_description("capsfilter name=filter ! "
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
"appsink name=audiosink sync=true caps=audio/x-raw-float,"
"channels={1,2},rate=44100,width=32,endianness=1234", TRUE, NULL);
#else
"appsink name=audiosink sync=true caps=audio/x-raw-int,"
"channels={1,2},rate=48000,width=16,endianness=1234", TRUE, NULL);
#endif
mAudioAppSink = GST_APP_SINK(gst_bin_get_by_name(GST_BIN(mAudioSink),
"audiosink"));
gst_app_sink_set_callbacks(mAudioAppSink, &mSinkCallbacks,

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,6 @@
#include "nsEventListenerManager.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIRDFResource.h"
#include "nsIScriptEventHandlerOwner.h"
#include "nsBindingManager.h"
#include "nsIURI.h"
#include "nsIXULTemplateBuilder.h"
@ -74,8 +73,7 @@ class nsXULPrototypeAttribute
{
public:
nsXULPrototypeAttribute()
: mName(nsGkAtoms::id), // XXX this is a hack, but names have to have a value
mEventHandler(nsnull)
: mName(nsGkAtoms::id) // XXX this is a hack, but names have to have a value
{
XUL_PROTOTYPE_ATTRIBUTE_METER(gNumAttributes);
MOZ_COUNT_CTOR(nsXULPrototypeAttribute);
@ -85,53 +83,10 @@ public:
nsAttrName mName;
nsAttrValue mValue;
// mEventHandler is only valid for the language ID specified in the
// containing nsXULPrototypeElement. We would ideally use
// nsScriptObjectHolder, but want to avoid the extra lang ID.
JSObject* mEventHandler;
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
/**
If enough attributes, on average, are event handlers, it pays to keep
mEventHandler here, instead of maintaining a separate mapping in each
nsXULElement associating those mName values with their mEventHandlers.
Assume we don't need to keep mNameSpaceID along with mName in such an
event-handler-only name-to-function-pointer mapping.
Let
minAttrSize = sizeof(mNodeInof) + sizeof(mValue)
mappingSize = sizeof(mNodeInfo) + sizeof(mEventHandler)
elemOverhead = nElems * sizeof(MappingPtr)
Then
nAttrs * minAttrSize + nEventHandlers * mappingSize + elemOverhead
> nAttrs * (minAttrSize + mappingSize - sizeof(mNodeInfo))
which simplifies to
nEventHandlers * mappingSize + elemOverhead
> nAttrs * (mappingSize - sizeof(mNodeInfo))
or
nEventHandlers + (nElems * sizeof(MappingPtr)) / mappingSize
> nAttrs * (1 - sizeof(mNodeInfo) / mappingSize)
If nsCOMPtr and all other pointers are the same size, this reduces to
nEventHandlers + nElems / 2 > nAttrs / 2
To measure how many attributes are event handlers, compile XUL source
with XUL_PROTOTYPE_ATTRIBUTE_METERING and watch the counters below.
Plug into the above relation -- if true, it pays to put mEventHandler
in nsXULPrototypeAttribute rather than to keep a separate mapping.
Recent numbers after opening four browser windows:
nElems 3537, nAttrs 2528, nEventHandlers 1042
giving 1042 + 3537/2 > 2528/2 or 2810 > 1264.
As it happens, mEventHandler also makes this struct power-of-2 sized,
8 words on most architectures, which makes for strength-reduced array
index-to-pointer calculations.
*/
static PRUint32 gNumElements;
static PRUint32 gNumAttributes;
static PRUint32 gNumEventHandlers;
static PRUint32 gNumCacheTests;
static PRUint32 gNumCacheHits;
static PRUint32 gNumCacheSets;
@ -143,9 +98,7 @@ public:
/**
A prototype content model element that holds the "primordial" values
that have been parsed from the original XUL document. A
'lightweight' nsXULElement may delegate its representation to this
structure, which is shared.
that have been parsed from the original XUL document.
*/
@ -195,11 +148,10 @@ public:
nsXULPrototypeElement()
: nsXULPrototypeNode(eType_Element),
mNumAttributes(0),
mAttributes(nsnull),
mHasIdAttribute(false),
mHasClassAttribute(false),
mHasStyleAttribute(false),
mHoldsScriptObject(false)
mAttributes(nsnull)
{
}
@ -239,14 +191,11 @@ public:
nsCOMPtr<nsINodeInfo> mNodeInfo; // [OWNER]
PRUint32 mNumAttributes;
PRUint32 mNumAttributes:29;
PRUint32 mHasIdAttribute:1;
PRUint32 mHasClassAttribute:1;
PRUint32 mHasStyleAttribute:1;
nsXULPrototypeAttribute* mAttributes; // [OWNER]
bool mHasIdAttribute:1;
bool mHasClassAttribute:1;
bool mHasStyleAttribute:1;
bool mHoldsScriptObject:1;
};
class nsXULDocument;
@ -409,23 +358,6 @@ public:
bool aCompileEventHandlers);
virtual void UnbindFromTree(bool aDeep, bool aNullParent);
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
virtual bool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAString& aResult) const;
virtual bool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const;
virtual bool AttrValueIs(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString& aValue,
nsCaseTreatment aCaseSensitive) const;
virtual bool AttrValueIs(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aValue,
nsCaseTreatment aCaseSensitive) const;
virtual PRInt32 FindAttrValueIn(PRInt32 aNameSpaceID,
nsIAtom* aName,
AttrValuesArray* aValues,
nsCaseTreatment aCaseSensitive) const;
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
bool aNotify);
virtual const nsAttrName* GetAttrNameAt(PRUint32 aIndex) const;
virtual PRUint32 GetAttrCount() const;
virtual void DestroyContent();
#ifdef DEBUG
@ -442,11 +374,8 @@ public:
virtual nsIContent *GetBindingParent() const;
virtual bool IsNodeOfType(PRUint32 aFlags) const;
virtual bool IsFocusable(PRInt32 *aTabIndex = nsnull, bool aWithMouse = false);
virtual nsIAtom* DoGetID() const;
virtual const nsAttrValue* DoGetClasses() const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
virtual mozilla::css::StyleRule* GetInlineStyleRule();
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -472,8 +401,6 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsEventStates IntrinsicState() const;
nsresult EnsureLocalStyle();
nsresult GetFrameLoader(nsIFrameLoader** aFrameLoader);
already_AddRefed<nsFrameLoader> GetFrameLoader();
nsresult SwapFrameLoaders(nsIFrameLoaderOwner* aOtherOwner);
@ -488,22 +415,10 @@ public:
mBindingParent = aBindingParent;
}
const nsAttrValue* GetAttrValue(const nsAString& aName);
/**
* Get the attr info for the given namespace ID and attribute name.
* The namespace ID must not be kNameSpaceID_Unknown and the name
* must not be null.
*/
virtual nsAttrInfo GetAttrInfo(PRInt32 aNamespaceID, nsIAtom* aName) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
// XXX This can be removed when nsNodeUtils::CloneAndAdopt doesn't need
// access to mPrototype anymore.
friend class nsNodeUtils;
// This can be removed if EnsureContentsGenerated dies.
friend class nsNSElementTearoff;
@ -536,9 +451,6 @@ protected:
nsresult LoadSrc();
// Required fields
nsRefPtr<nsXULPrototypeElement> mPrototype;
/**
* The nearest enclosing content node with a binding
* that created us. [Weak]
@ -548,12 +460,7 @@ protected:
/**
* Abandon our prototype linkage, and copy all attributes locally
*/
nsresult MakeHeavyweight();
const nsAttrValue* FindLocalOrProtoAttr(PRInt32 aNameSpaceID,
nsIAtom *aName) const {
return nsXULElement::GetAttrInfo(aNameSpaceID, aName).mValue;
}
nsresult MakeHeavyweight(nsXULPrototypeElement* aPrototype);
virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAttrValueOrString* aValue,
@ -571,11 +478,6 @@ protected:
virtual nsEventListenerManager*
GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer);
/**
* Return our prototype's attribute, if one exists.
*/
nsXULPrototypeAttribute *FindPrototypeAttribute(PRInt32 aNameSpaceID,
nsIAtom *aName) const;
/**
* Add a listener for the specified attribute, if appropriate.
*/
@ -593,8 +495,6 @@ protected:
void SetDrawsInTitlebar(bool aState);
const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const;
void RemoveBroadcaster(const nsAString & broadcasterId);
protected:
@ -617,8 +517,6 @@ protected:
Create(nsXULPrototypeElement* aPrototype, nsINodeInfo *aNodeInfo,
bool aIsScriptable);
friend class nsScriptEventHandlerOwnerTearoff;
bool IsReadWriteTextElement() const
{
const nsIAtom* tag = Tag();

View File

@ -56,7 +56,6 @@ EXPORTS = \
nsIScriptGlobalObject.h \
nsIScriptGlobalObjectOwner.h \
nsIScriptNameSpaceManager.h \
nsIScriptEventHandlerOwner.h \
nsIScriptObjectPrincipal.h \
nsIScriptRuntime.h \
nsIScriptTimeoutHandler.h \

View File

@ -85,7 +85,6 @@
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsScriptNameSpaceManager.h"
#include "nsIScriptEventHandlerOwner.h"
#include "nsIJSNativeInitializer.h"
#include "nsJSEnvironment.h"

View File

@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsIScriptEventHandlerOwner_h__
#define nsIScriptEventHandlerOwner_h__
#include "nsISupports.h"
#include "nsIScriptContext.h"
#include "nsAString.h"
template<class> class nsScriptObjectHolder;
class nsIAtom;
#define NS_ISCRIPTEVENTHANDLEROWNER_IID \
{ 0xc8f35f71, 0x07d1, 0x4ff3, \
{ 0xa3, 0x2f, 0x65, 0xcb, 0x35, 0x64, 0xac, 0xe0 } }
/**
* Associate a compiled event handler with its target object, which owns it
* This is an adjunct to nsIScriptObjectOwner that nsEventListenerManager's
* implementation queries for, in order to avoid recompiling a recurrent or
* prototype-inherited event handler.
*/
class nsIScriptEventHandlerOwner : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTEVENTHANDLEROWNER_IID)
/**
* Compile the specified event handler. This does NOT bind it to
* anything. That's the caller's responsibility.
*
* @param aContext the context to use when creating event handler
* @param aName the name of the handler
* @param aBody the handler script body
* @param aURL the URL or filename for error messages
* @param aLineNo the starting line number of the script for error messages
* @param aHandler the holder for the compiled handler object
*/
virtual nsresult CompileEventHandler(nsIScriptContext* aContext,
nsIAtom *aName,
const nsAString& aBody,
const char* aURL,
PRUint32 aLineNo,
nsScriptObjectHolder<JSObject>& aHandler) = 0;
/**
* Retrieve an already-compiled event handler that can be bound to a
* target object using a script context.
*
* @param aName the name of the event handler to retrieve
* @param aHandler the holder for the compiled event handler.
*/
virtual nsresult GetCompiledEventHandler(nsIAtom *aName,
nsScriptObjectHolder<JSObject>& aHandler) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptEventHandlerOwner,
NS_ISCRIPTEVENTHANDLEROWNER_IID)
#endif // nsIScriptEventHandlerOwner_h__

View File

@ -37,6 +37,7 @@
#include "nsITextToSubURI.h"
#include "nsJSUtils.h"
#include "jsfriendapi.h"
#include "nsContentUtils.h"
static nsresult
GetContextFromStack(nsIJSContextStack *aStack, JSContext **aContext)
@ -168,6 +169,14 @@ nsresult
nsLocation::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo)
{
*aLoadInfo = nsnull;
JSContext* cx;
if ((cx = nsContentUtils::GetCurrentJSContext())) {
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
NS_ENSURE_STATE(ssm);
// Check to see if URI is allowed.
nsresult rv = ssm->CheckLoadURIFromScript(cx, aURI);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell));
NS_ENSURE_TRUE(docShell, NS_ERROR_NOT_AVAILABLE);
@ -178,8 +187,6 @@ nsLocation::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo)
stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv));
NS_ENSURE_SUCCESS(rv, rv);
JSContext *cx;
NS_ENSURE_SUCCESS(GetContextFromStack(stack, &cx), NS_ERROR_FAILURE);
nsCOMPtr<nsISupports> owner;

View File

@ -36,4 +36,6 @@ private:
} /* namespace plugins */
} /* namespace mozilla */
#undef slots
#endif

View File

@ -13,6 +13,7 @@
#ifdef MOZ_WIDGET_QT
#include <QtCore/QCoreApplication>
#include <QtCore/QEventLoop>
#include "NestedLoopTimer.h"
#endif
#include "base/process_util.h"