From 449408d6229c967211488f729302e6b803fa1ec3 Mon Sep 17 00:00:00 2001 From: "allan%beaufour.dk" Date: Tue, 23 May 2006 08:27:18 +0000 Subject: [PATCH] [XForms] fetching blocked by cross-domain checks should trigger xforms-link-error. Bug 338788, r=smaug+aaronr git-svn-id: svn://10.0.0.236/trunk@198253 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/extensions/xforms/nsXFormsMessageElement.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mozilla/extensions/xforms/nsXFormsMessageElement.cpp b/mozilla/extensions/xforms/nsXFormsMessageElement.cpp index e51e7a9c344..9552b6dea1e 100644 --- a/mozilla/extensions/xforms/nsXFormsMessageElement.cpp +++ b/mozilla/extensions/xforms/nsXFormsMessageElement.cpp @@ -420,7 +420,9 @@ nsXFormsMessageElement::HandleAction(nsIDOMEvent* aEvent, // to use that we can't reach right now. If it won't load, then might as // well stop here. We don't want to be popping up empty windows // or windows that will just end up showing 404 messages. - if (mStopType == eStopType_LinkError) { + // We also stop if we were not allowed to access the given resource. + if (mStopType == eStopType_LinkError || + mStopType == eStopType_Security) { // we couldn't successfully link to our external resource. Better throw // the xforms-link-error event nsCOMPtr modelPriv = @@ -430,12 +432,6 @@ nsXFormsMessageElement::HandleAction(nsIDOMEvent* aEvent, return NS_OK; } - // If we couldn't test the external link due to it not living in an - // acceptable domain, then no sense going any further down this path. - if (mStopType == eStopType_Security) { - return NS_OK; - } - // If there is still a channel, then someone must have changed the value of // the src attribute since the document finished loading and we haven't yet // determined whether the new link is valid or not. For now we'll assume @@ -1033,6 +1029,7 @@ nsXFormsMessageElement::OnChannelRedirect(nsIChannel *OldChannel, const PRUnichar *strings[] = { tagName.get() }; nsXFormsUtils::ReportError(NS_LITERAL_STRING("externalLinkLoadOrigin"), strings, 1, mElement, mElement); + mStopType = eStopType_Security; return NS_ERROR_ABORT; }