Bug 1363640 Part 3 - Strip whitespaces for files under dom/xbl. r=heycam

MozReview-Commit-ID: 3WBsFIgFZU9

--HG--
extra : rebase_source : 63699a4f10a418171cf9fa3205761c7b53129360
This commit is contained in:
Ting-Yu Lin 2017-05-09 20:45:11 -07:00
parent e28f16e90e
commit 200de4b5fa
15 changed files with 91 additions and 91 deletions

View File

@ -364,7 +364,7 @@ nsBindingManager::PostProcessAttachedQueueEvent()
void
nsBindingManager::PostPAQEventCallback(nsITimer* aTimer, void* aClosure)
{
RefPtr<nsBindingManager> mgr =
RefPtr<nsBindingManager> mgr =
already_AddRefed<nsBindingManager>(static_cast<nsBindingManager*>(aClosure));
mgr->PostProcessAttachedQueueEvent();
NS_RELEASE(aTimer);

View File

@ -166,7 +166,7 @@ nsXBLContentSink::FlushText(bool aReleaseTextNode)
}
NS_IMETHODIMP
nsXBLContentSink::ReportError(const char16_t* aErrorText,
nsXBLContentSink::ReportError(const char16_t* aErrorText,
const char16_t* aSourceText,
nsIScriptError *aError,
bool *_retval)
@ -191,8 +191,8 @@ nsXBLContentSink::ReportError(const char16_t* aErrorText,
// Most of what this does won't be too useful, but whatever...
// nsXMLContentSink::ReportError will handle the console logging.
return nsXMLContentSink::ReportError(aErrorText,
aSourceText,
return nsXMLContentSink::ReportError(aErrorText,
aSourceText,
aError,
_retval);
}
@ -245,10 +245,10 @@ nsXBLContentSink::AddField(nsXBLProtoImplField* aField)
mImplField = aField; // Adjust our pointer to point to the new last field in the chain.
}
NS_IMETHODIMP
nsXBLContentSink::HandleStartElement(const char16_t *aName,
const char16_t **aAtts,
uint32_t aAttsCount,
NS_IMETHODIMP
nsXBLContentSink::HandleStartElement(const char16_t *aName,
const char16_t **aAtts,
uint32_t aAttsCount,
uint32_t aLineNumber)
{
nsresult rv = nsXMLContentSink::HandleStartElement(aName, aAtts, aAttsCount,
@ -260,7 +260,7 @@ nsXBLContentSink::HandleStartElement(const char16_t *aName,
rv = ConstructBinding(aLineNumber);
if (NS_FAILED(rv))
return rv;
// mBinding may still be null, if the binding had no id. If so,
// we'll deal with that later in the sink.
}
@ -268,7 +268,7 @@ nsXBLContentSink::HandleStartElement(const char16_t *aName,
return rv;
}
NS_IMETHODIMP
NS_IMETHODIMP
nsXBLContentSink::HandleEndElement(const char16_t *aName)
{
FlushText();
@ -334,7 +334,7 @@ nsXBLContentSink::HandleEndElement(const char16_t *aName)
localName == nsGkAtoms::bindings) {
mState = eXBL_InDocument;
}
nsresult rv = nsXMLContentSink::HandleEndElement(aName);
if (NS_FAILED(rv))
return rv;
@ -354,8 +354,8 @@ nsXBLContentSink::HandleEndElement(const char16_t *aName)
return nsXMLContentSink::HandleEndElement(aName);
}
NS_IMETHODIMP
nsXBLContentSink::HandleCDataSection(const char16_t *aData,
NS_IMETHODIMP
nsXBLContentSink::HandleCDataSection(const char16_t *aData,
uint32_t aLength)
{
if (mState == eXBL_InHandlers || mState == eXBL_InImplementation)
@ -368,17 +368,17 @@ nsXBLContentSink::HandleCDataSection(const char16_t *aData,
if (!(_cond)) { ReportUnexpectedElement(aTagName, aLineNumber); return true; } \
PR_END_MACRO
bool
nsXBLContentSink::OnOpenContainer(const char16_t **aAtts,
uint32_t aAttsCount,
int32_t aNameSpaceID,
bool
nsXBLContentSink::OnOpenContainer(const char16_t **aAtts,
uint32_t aAttsCount,
int32_t aNameSpaceID,
nsIAtom* aTagName,
uint32_t aLineNumber)
{
if (mState == eXBL_Error) {
return true;
}
if (aNameSpaceID != kNameSpaceID_XBL) {
// Construct non-XBL nodes
return true;
@ -449,7 +449,7 @@ nsXBLContentSink::OnOpenContainer(const char16_t **aAtts,
ENSURE_XBL_STATE(mState == eXBL_InImplementation &&
mSecondaryState == eXBL_None);
NS_ASSERTION(mBinding, "Must have binding here");
mSecondaryState = eXBL_InConstructor;
nsAutoString name;
if (!mCurrentBindingID.IsEmpty()) {
@ -700,7 +700,7 @@ nsXBLContentSink::ConstructImplementation(const char16_t **aAtts)
mImplementation = nullptr;
mImplMember = nullptr;
mImplField = nullptr;
if (!mBinding)
return;
@ -880,7 +880,7 @@ nsXBLContentSink::CreateElement(const char16_t** aAtts, uint32_t aAttsCount,
#endif
}
nsresult
nsresult
nsXBLContentSink::AddAttributes(const char16_t** aAtts,
nsIContent* aContent)
{
@ -892,8 +892,8 @@ nsXBLContentSink::AddAttributes(const char16_t** aAtts,
#ifdef MOZ_XUL
nsresult
nsXBLContentSink::AddAttributesToXULPrototype(const char16_t **aAtts,
uint32_t aAttsCount,
nsXBLContentSink::AddAttributesToXULPrototype(const char16_t **aAtts,
uint32_t aAttsCount,
nsXULPrototypeElement* aElement)
{
// Add tag attributes to the element
@ -911,7 +911,7 @@ nsXBLContentSink::AddAttributesToXULPrototype(const char16_t **aAtts,
// Copy the attributes into the prototype
nsCOMPtr<nsIAtom> prefix, localName;
uint32_t i;
uint32_t i;
for (i = 0; i < aAttsCount; ++i) {
int32_t nameSpaceID;
nsContentUtils::SplitExpatName(aAtts[i * 2], getter_AddRefs(prefix),
@ -926,9 +926,9 @@ nsXBLContentSink::AddAttributesToXULPrototype(const char16_t **aAtts,
nsIDOMNode::ATTRIBUTE_NODE);
attrs[i].mName.SetTo(ni);
}
rv = aElement->SetAttrAt(i, nsDependentString(aAtts[i * 2 + 1]),
mDocumentURI);
mDocumentURI);
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -53,7 +53,7 @@ class nsXBLPrototypeBinding;
// The XBL content sink overrides the XML content sink to
// builds its own lightweight data structures for the <resources>,
// <handlers>, <implementation>, and
// <handlers>, <implementation>, and
class nsXBLContentSink : public nsXMLContentSink {
public:
@ -65,23 +65,23 @@ public:
nsISupports* aContainer);
// nsIContentSink overrides
NS_IMETHOD HandleStartElement(const char16_t *aName,
const char16_t **aAtts,
uint32_t aAttsCount,
NS_IMETHOD HandleStartElement(const char16_t *aName,
const char16_t **aAtts,
uint32_t aAttsCount,
uint32_t aLineNumber) override;
NS_IMETHOD HandleEndElement(const char16_t *aName) override;
NS_IMETHOD HandleCDataSection(const char16_t *aData,
NS_IMETHOD HandleCDataSection(const char16_t *aData,
uint32_t aLength) override;
protected:
// nsXMLContentSink overrides
virtual void MaybeStartLayout(bool aIgnorePendingSheets) override;
bool OnOpenContainer(const char16_t **aAtts,
uint32_t aAttsCount,
int32_t aNameSpaceID,
bool OnOpenContainer(const char16_t **aAtts,
uint32_t aAttsCount,
int32_t aNameSpaceID,
nsIAtom* aTagName,
uint32_t aLineNumber) override;
@ -91,13 +91,13 @@ protected:
mozilla::dom::NodeInfo* aNodeInfo, uint32_t aLineNumber,
nsIContent** aResult, bool* aAppendContent,
mozilla::dom::FromParser aFromParser) override;
nsresult AddAttributes(const char16_t** aAtts,
nsresult AddAttributes(const char16_t** aAtts,
nsIContent* aContent) override;
#ifdef MOZ_XUL
nsresult AddAttributesToXULPrototype(const char16_t **aAtts,
uint32_t aAttsCount,
#ifdef MOZ_XUL
nsresult AddAttributesToXULPrototype(const char16_t **aAtts,
uint32_t aAttsCount,
nsXULPrototypeElement* aElement);
#endif
@ -110,7 +110,7 @@ protected:
void ConstructMethod(const char16_t **aAtts);
void ConstructParameter(const char16_t **aAtts);
void ConstructField(const char16_t **aAtts, uint32_t aLineNumber);
// nsXMLContentSink overrides
nsresult FlushText(bool aReleaseTextNode = true) override;
@ -126,7 +126,7 @@ protected:
void AddMember(nsXBLProtoImplMember* aMember);
void AddField(nsXBLProtoImplField* aField);
XBLPrimaryState mState;
XBLSecondaryState mSecondaryState;
nsXBLDocumentInfo* mDocInfo;

View File

@ -210,7 +210,7 @@ nsXBLDocumentInfo::ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocI
// The file compatibility.ini stores the build id. This is checked in
// nsAppRunner.cpp and will delete the cache if a different build is
// present. However, we check that the version matches here to be safe.
// present. However, we check that the version matches here to be safe.
uint32_t version;
rv = stream->Read32(&version);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -178,9 +178,9 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
return NS_OK;
}
nsresult
nsresult
nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
nsIContent* aBoundElement,
nsIContent* aBoundElement,
JS::MutableHandle<JSObject*> aTargetClassObject,
bool* aTargetIsNew)
{
@ -239,8 +239,8 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
nsresult
nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
{
// We want to pre-compile our implementation's members against a "prototype context". Then when we actually
// bind the prototype to a real xbl instance, we'll clone the pre-compiled JS into the real instance's
// We want to pre-compile our implementation's members against a "prototype context". Then when we actually
// bind the prototype to a real xbl instance, we'll clone the pre-compiled JS into the real instance's
// context.
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(xpc::CompilationScope())))
@ -514,8 +514,8 @@ nsXBLProtoImpl::Write(nsIObjectOutputStream* aStream,
}
void
NS_NewXBLProtoImpl(nsXBLPrototypeBinding* aBinding,
const char16_t* aClassName,
NS_NewXBLProtoImpl(nsXBLPrototypeBinding* aBinding,
const char16_t* aClassName,
nsXBLProtoImpl** aResult)
{
nsXBLProtoImpl* impl = new nsXBLProtoImpl();

View File

@ -36,7 +36,7 @@ nsXBLProtoImplField::nsXBLProtoImplField(const char16_t* aName, const char16_t*
{
MOZ_COUNT_CTOR(nsXBLProtoImplField);
mName = NS_strdup(aName); // XXXbz make more sense to use a stringbuffer?
mJSAttributes = JSPROP_ENUMERATE;
if (aReadOnly) {
nsAutoString readOnly; readOnly.Assign(aReadOnly);
@ -68,7 +68,7 @@ nsXBLProtoImplField::~nsXBLProtoImplField()
NS_CONTENT_DELETE_LIST_MEMBER(nsXBLProtoImplField, this, mNext);
}
void
void
nsXBLProtoImplField::AppendFieldText(const nsAString& aText)
{
if (mFieldText) {

View File

@ -28,7 +28,7 @@ public:
void SetLineNumber(uint32_t aLineNumber) {
mLineNumber = aLineNumber;
}
nsXBLProtoImplField* GetNext() const { return mNext; }
void SetNext(nsXBLProtoImplField* aNext) { mNext = aNext; }

View File

@ -83,7 +83,7 @@ void nsXBLProtoImplProperty::EnsureUncompiledText(PropertyOp& aPropertyOp)
}
}
void
void
nsXBLProtoImplProperty::AppendGetterText(const nsAString& aText)
{
NS_PRECONDITION(!mIsCompiled,
@ -92,7 +92,7 @@ nsXBLProtoImplProperty::AppendGetterText(const nsAString& aText)
mGetter.GetUncompiled()->AppendText(aText);
}
void
void
nsXBLProtoImplProperty::AppendSetterText(const nsAString& aText)
{
NS_PRECONDITION(!mIsCompiled,
@ -210,7 +210,7 @@ nsXBLProtoImplProperty::CompileMember(AutoJSAPI& jsapi, const nsString& aClassSt
deletedGetter = true;
mGetter.SetJSFunction(getterObject);
if (mGetter.GetJSFunction() && NS_SUCCEEDED(rv)) {
mJSAttributes |= JSPROP_GETTER | JSPROP_SHARED;
}
@ -226,7 +226,7 @@ nsXBLProtoImplProperty::CompileMember(AutoJSAPI& jsapi, const nsString& aClassSt
delete getterText;
mGetter.SetJSFunction(nullptr);
}
if (NS_FAILED(rv)) {
// We failed to compile our getter. So either we've set it to null, or
// it's still set to the text object. In either case, it's safe to return

View File

@ -19,13 +19,13 @@ class nsXBLProtoImplProperty: public nsXBLProtoImplMember
{
public:
nsXBLProtoImplProperty(const char16_t* aName,
const char16_t* aGetter,
const char16_t* aGetter,
const char16_t* aSetter,
const char16_t* aReadOnly,
uint32_t aLineNumber);
nsXBLProtoImplProperty(const char16_t* aName, const bool aIsReadOnly);
virtual ~nsXBLProtoImplProperty();
void AppendGetterText(const nsAString& aGetter);
@ -55,7 +55,7 @@ protected:
// The raw text for the setter, or the JS object (after compilation).
PropertyOp mSetter;
unsigned mJSAttributes; // A flag for all our JS properties (getter/setter/readonly/shared/enum)
#ifdef DEBUG

View File

@ -148,7 +148,7 @@ nsXBLPrototypeHandler::GetHandlerElement()
}
void
nsXBLPrototypeHandler::AppendHandlerText(const nsAString& aText)
nsXBLPrototypeHandler::AppendHandlerText(const nsAString& aText)
{
if (mHandlerText) {
// Append our text to the existing text.
@ -216,7 +216,7 @@ nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
if (!trustedEvent)
return NS_OK;
}
if (isXBLCommand) {
return DispatchXBLCommand(aTarget, aEvent);
}
@ -228,7 +228,7 @@ nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
return DispatchXULKeyCommand(aEvent);
}
// Look for a compiled handler on the element.
// Look for a compiled handler on the element.
// Should be compiled and bound with "on" in front of the name.
nsCOMPtr<nsIAtom> onEventAtom = NS_Atomize(NS_LITERAL_STRING("onxbl") +
nsDependentAtomString(mEventName));
@ -493,7 +493,7 @@ nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEv
}
}
}
if (controller)
controller->DoCommand(command.get());
@ -724,14 +724,14 @@ nsXBLPrototypeHandler::GetEventType(nsAString& aEvent)
return;
}
handlerElement->GetAttr(kNameSpaceID_None, nsGkAtoms::event, aEvent);
if (aEvent.IsEmpty() && (mType & NS_HANDLER_TYPE_XUL))
// If no type is specified for a XUL <key> element, let's assume that we're "keypress".
aEvent.AssignLiteral("keypress");
}
void
nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
const char16_t* aEvent,
const char16_t* aPhase,
const char16_t* aAction,
@ -790,18 +790,18 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
}
// Button and clickcount apply only to XBL handlers and don't apply to XUL key
// handlers.
// handlers.
if (aButton && *aButton)
mDetail = *aButton - '0';
if (aClickCount && *aClickCount)
mMisc = *aClickCount - '0';
// Modifiers are supported by both types of handlers (XUL and XBL).
// Modifiers are supported by both types of handlers (XUL and XBL).
nsAutoString modifiers(aModifiers);
if (mType & NS_HANDLER_TYPE_XUL)
aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::modifiers, modifiers);
if (!modifiers.IsEmpty()) {
mKeyMask = cAllModifiers;
char* str = ToNewCString(modifiers);
@ -824,7 +824,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
mKeyMask |= KeyToMask(kMenuAccessKey);
else if (PL_strcmp(token, "any") == 0)
mKeyMask &= ~(mKeyMask << 5);
token = nsCRT::strtok( newStr, ", \t", &newStr );
}
@ -835,7 +835,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
if (key.IsEmpty()) {
if (mType & NS_HANDLER_TYPE_XUL) {
aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::key, key);
if (key.IsEmpty())
if (key.IsEmpty())
aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::charcode, key);
}
}
@ -866,7 +866,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
key.Assign(aKeyCode);
if (mType & NS_HANDLER_TYPE_XUL)
aKeyElement->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, key);
if (!key.IsEmpty()) {
if (mKeyMask == 0)
mKeyMask = cAllModifiers;
@ -969,7 +969,7 @@ nsXBLPrototypeHandler::Read(nsIObjectInputStream* aStream)
rv = aStream->Read32(reinterpret_cast<uint32_t*>(&mKeyMask));
NS_ENSURE_SUCCESS(rv, rv);
uint32_t detail;
uint32_t detail;
rv = aStream->Read32(&detail);
NS_ENSURE_SUCCESS(rv, rv);
mDetail = detail;

View File

@ -216,7 +216,7 @@ protected:
};
uint32_t mLineNumber; // The line number we started at in the XBL file
// The following four values make up 32 bits.
uint8_t mPhase; // The phase (capturing, bubbling)
uint8_t mType; // The type of the handler. The handler is either a XUL key
@ -231,7 +231,7 @@ protected:
int32_t mKeyMask; // Which modifier keys this event handler expects to have down
// in order to be matched.
// The primary filter information for mouse/key events.
int32_t mDetail; // For key events, contains a charcode or keycode. For
// mouse events, stores the button info.

View File

@ -115,7 +115,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
if (curr->mType == nsGkAtoms::image) {
// Now kick off the image load...
// Passing nullptr for pretty much everything -- cause we don't care!
// XXX: initialDocumentURI is nullptr!
// XXX: initialDocumentURI is nullptr!
RefPtr<imgRequestProxy> req;
nsContentUtils::LoadImage(url, doc, doc, docPrincipal, docURL,
doc->GetReferrerPolicy(), nullptr,
@ -156,7 +156,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
*aResult = (mPendingSheets == 0);
mInLoadResourcesFunc = false;
// Destroy our resource list.
delete mResourceList;
mResourceList = nullptr;
@ -172,14 +172,14 @@ nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet,
// Our resources got destroyed -- just bail out
return NS_OK;
}
mResources->AppendStyleSheet(aSheet);
if (!mInLoadResourcesFunc)
mPendingSheets--;
if (mPendingSheets == 0) {
// All stylesheets are loaded.
// All stylesheets are loaded.
mResources->GatherRuleProcessor();
// XXX Check for mPendingScripts when scripts also come online.
@ -189,7 +189,7 @@ nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet,
return NS_OK;
}
void
void
nsXBLResourceLoader::AddResource(nsIAtom* aResourceType, const nsAString& aSrc)
{
nsXBLResource* res = new nsXBLResource(aResourceType, aSrc);
@ -202,7 +202,7 @@ nsXBLResourceLoader::AddResource(nsIAtom* aResourceType, const nsAString& aSrc)
}
void
nsXBLResourceLoader::AddResourceListener(nsIContent* aBoundElement)
nsXBLResourceLoader::AddResourceListener(nsIContent* aBoundElement)
{
if (aBoundElement) {
mBoundElements.AppendObject(aBoundElement);

View File

@ -51,7 +51,7 @@ public:
// information. May be null if the
// resources have already been
// destroyed.
nsXBLResource* mResourceList; // The list of resources we need to load.
nsXBLResource* mLastResource;

View File

@ -54,18 +54,18 @@ typedef uint8_t XBLBindingSerializeDetails;
#define XBLBinding_Serialize_ReadOnly 0x80
// Appears at the end of the list of insertion points to indicate that there
// are no more.
// are no more.
#define XBLBinding_Serialize_NoMoreInsertionPoints 0xFFFFFFFF
// When serializing content nodes, a single-byte namespace id is written out
// first. The special values below can appear in place of a namespace id.
// Indicates that this is not one of the built-in namespaces defined in
// Indicates that this is not one of the built-in namespaces defined in
// nsNameSpaceManager.h. The string form will be serialized immediately
// following.
#define XBLBinding_Serialize_CustomNamespace 0xFE
// Flags to indicate a non-element node. Otherwise, it is an element.
// Flags to indicate a non-element node. Otherwise, it is an element.
#define XBLBinding_Serialize_TextNode 0xFB
#define XBLBinding_Serialize_CDATANode 0xFC
#define XBLBinding_Serialize_CommentNode 0xFD

View File

@ -108,7 +108,7 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
xblService->LoadBindingDocumentInfo(nullptr, nullptr,
bindingURI,
nullptr,
true,
true,
getter_AddRefs(mHTMLBindings));
const nsAdoptingCString& userHTMLBindingStr =
@ -122,7 +122,7 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
xblService->LoadBindingDocumentInfo(nullptr, nullptr,
bindingURI,
nullptr,
true,
true,
getter_AddRefs(mUserHTMLBindings));
}
}
@ -130,14 +130,14 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
//
// GetHandlers
//
//
//
void
nsXBLSpecialDocInfo::GetHandlers(nsXBLDocumentInfo* aInfo,
const nsACString& aRef,
nsXBLPrototypeHandler** aResult)
{
nsXBLPrototypeBinding* binding = aInfo->GetPrototypeBinding(aRef);
NS_ASSERTION(binding, "No binding found for the XBL window key handler.");
if (!binding)
return;
@ -226,7 +226,7 @@ BuildHandlerChain(nsIContent* aContent, nsXBLPrototypeHandler** aResult)
//
// EnsureHandlers
//
//
// Lazily load the XBL handlers. Overridden to handle being attached
// to a particular element rather than the document
//
@ -602,7 +602,7 @@ nsXBLWindowKeyHandler::IsHTMLEditableFieldFocused()
//
bool
nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent,
nsIAtom* aEventType,
nsIAtom* aEventType,
nsXBLPrototypeHandler* aHandler,
bool aExecute,
bool* aOutReservedForChrome)