зеркало из https://github.com/mozilla/pjs.git
[XForms] Better logging of MDG loop errors. Bug 332125, r=doronr+smaug
This commit is contained in:
Родитель
f88b5512af
Коммит
43074aebaf
|
@ -45,9 +45,10 @@
|
|||
#include "nsIDOMNSXPathExpression.h"
|
||||
#include "nsIDOMXPathResult.h"
|
||||
#include "nsDeque.h"
|
||||
#include "nsIModelElementPrivate.h"
|
||||
#include "nsXFormsUtils.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsXFormsModelElement.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
//# define DEBUG_XF_MDG
|
||||
|
@ -136,7 +137,7 @@ nsXFormsMDGEngine::~nsXFormsMDGEngine()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsMDGEngine::Init(nsIModelElementPrivate *aModel)
|
||||
nsXFormsMDGEngine::Init(nsXFormsModelElement *aModel)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (mNodeStates.Init() && mNodeToMDG.Init()) {
|
||||
|
@ -555,7 +556,11 @@ nsXFormsMDGEngine::Rebuild()
|
|||
#endif
|
||||
|
||||
if (mGraph.Count() != mNodesInGraph) {
|
||||
NS_WARNING("XForms: There are loops in the MDG\n");
|
||||
nsCOMPtr<nsIDOMElement> modelElement;
|
||||
if (mModel) {
|
||||
modelElement = mModel->GetDOMElement();
|
||||
}
|
||||
nsXFormsUtils::ReportError(NS_LITERAL_STRING("MDGLoopError"), modelElement);
|
||||
rv = NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
|
||||
#include "nsXFormsTypes.h"
|
||||
#include "nsXFormsNodeState.h"
|
||||
#include "nsIModelElementPrivate.h"
|
||||
|
||||
class nsIDOMNSXPathExpression;
|
||||
class nsXFormsModelElement;
|
||||
|
||||
/**
|
||||
* Data structure for nodes in the graph.
|
||||
|
@ -174,7 +174,7 @@ protected:
|
|||
nsVoidArray mGraph;
|
||||
|
||||
/** The model that created the MDG */
|
||||
nsIModelElementPrivate *mModel;
|
||||
nsXFormsModelElement *mModel;
|
||||
|
||||
/**
|
||||
* Nodes that are marked as changed, and should be included in recalculation
|
||||
|
@ -343,7 +343,7 @@ public:
|
|||
*
|
||||
* @param aModel The model that created this MDGEngine instance.
|
||||
*/
|
||||
nsresult Init(nsIModelElementPrivate *aModel);
|
||||
nsresult Init(nsXFormsModelElement *aModel);
|
||||
|
||||
/**
|
||||
* Insert new MIP (Model Item Property) into graph.
|
||||
|
|
|
@ -887,10 +887,8 @@ nsXFormsModelElement::HandleDefault(nsIDOMEvent *aEvent, PRBool *aHandled)
|
|||
*aHandled = PR_FALSE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (NS_FAILED(rv))
|
||||
printf("nsXFormsModelElement::HandleDefault() failed!\n");
|
||||
#endif
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
|
||||
"nsXFormsModelElement::HandleDefault() failed!\n");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -2252,6 +2250,14 @@ nsXFormsModelElement::Startup()
|
|||
sModelPropsList[eModel_p3ptype] = nsXFormsAtoms::p3ptype;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMElement>
|
||||
nsXFormsModelElement::GetDOMElement()
|
||||
{
|
||||
nsIDOMElement* element = nsnull;
|
||||
NS_IF_ADDREF(element = mElement);
|
||||
return element;
|
||||
}
|
||||
|
||||
static void
|
||||
DeleteBindList(void *aObject,
|
||||
nsIAtom *aPropertyName,
|
||||
|
|
|
@ -269,6 +269,12 @@ public:
|
|||
|
||||
static nsresult NeedsPostRefresh(nsIXFormsControl* aControl);
|
||||
static void CancelPostRefresh(nsIXFormsControl* aControl);
|
||||
|
||||
/**
|
||||
* Returns the DOM element for the model.
|
||||
*/
|
||||
already_AddRefed<nsIDOMElement> GetDOMElement();
|
||||
|
||||
private:
|
||||
|
||||
NS_HIDDEN_(already_AddRefed<nsIDOMDocument>)
|
||||
|
|
|
@ -70,6 +70,7 @@ externalLink2Error = XForms Error (31): Failed to load %S element from externa
|
|||
externalLinkLoadOrigin = XForms Error (32): Security check failed! Trying to load %S data from a different domain than document
|
||||
instanceNotFound = XForms Error (33): Could not find instance with id == '%S'
|
||||
defInstanceNotFound = XForms Error (34): Could not find default instance
|
||||
MDGLoopError = XForms Error (35): There are loops in the bindings of the model!
|
||||
|
||||
# Warning Messages:
|
||||
warnSOAP = XForms Warning (1): You are using the SOAP post feature, which is an experimental feature! Beware that the functionality might change, and forms may stop working at any time.
|
||||
|
|
Загрузка…
Ссылка в новой задаче