зеркало из https://github.com/mozilla/pjs.git
[XForms] VC6 fix for bug 315407. r=neil+doronr
This commit is contained in:
Родитель
5358c40f6d
Коммит
6ca1a2bc8f
|
@ -899,7 +899,7 @@ nsXFormsSubmissionElement::CheckSameOrigin(nsIDocument *aBaseDocument,
|
|||
// same origin check.
|
||||
if (!allowSubmission) {
|
||||
// replace instance is both a send and a load
|
||||
PRUint8 mode;
|
||||
nsXFormsUtils::ConnectionType mode;
|
||||
if (mIsReplaceInstance)
|
||||
mode = nsXFormsUtils::kXFormsActionLoadSend;
|
||||
else
|
||||
|
|
|
@ -1302,7 +1302,7 @@ nsXFormsUtils::FindParentContext(nsIDOMElement *aElement,
|
|||
|
||||
/* static */ PRBool
|
||||
nsXFormsUtils::CheckSameOrigin(nsIDocument *aBaseDocument, nsIURI *aTestURI,
|
||||
PRUint8 aType)
|
||||
ConnectionType aType)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -1346,7 +1346,9 @@ nsXFormsUtils::CheckSameOrigin(nsIDocument *aBaseDocument, nsIURI *aTestURI,
|
|||
rv = permMgr->TestPermission(principalURI, "xforms-xd", &perm);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && perm != nsIPermissionManager::UNKNOWN_ACTION) {
|
||||
if (perm == kXFormsActionLoadSend || perm == aType)
|
||||
// Safe cast, as we only have few ConnectionTypes.
|
||||
PRInt32 permSigned = perm;
|
||||
if (permSigned == kXFormsActionLoadSend || permSigned == aType)
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -372,26 +372,30 @@ public:
|
|||
PRInt32 *aContextPosition,
|
||||
PRInt32 *aContextSize);
|
||||
|
||||
/** CheckSameOrigin takes in the connection type. We either:
|
||||
* - Send data, such as doing submission
|
||||
* - Load data, such as getting external instance data
|
||||
* - Send and Load data, which is replace instance
|
||||
*/
|
||||
static const PRUint8 kXFormsActionSend = 1;
|
||||
static const PRUint8 kXFormsActionLoad = 2;
|
||||
static const PRUint8 kXFormsActionLoadSend = 3;
|
||||
/** Connection type used by CheckSameOrigin */
|
||||
enum ConnectionType {
|
||||
/** Send data, such as doing submission */
|
||||
kXFormsActionSend = 1,
|
||||
|
||||
/** Load data, such as getting external instance data */
|
||||
kXFormsActionLoad = 2,
|
||||
|
||||
/** Send and Load data, which is replace=instance */
|
||||
kXFormsActionLoadSend = 3
|
||||
};
|
||||
|
||||
/**
|
||||
* Check whether aTestURI has the same origin as aBaseDocument or the user
|
||||
* has allowed the connection type using the permission manager
|
||||
*
|
||||
* @param aBaseDocument The document the XForms lives in
|
||||
* @param aTestURI The uri we are trying to connect to
|
||||
* @param aType The connection type (see above 3 consts)
|
||||
* @return true if aTestURI has the same origin as aBaseDocument or
|
||||
* the user has allowed the connection type using the permission
|
||||
* manager.
|
||||
* @param aType The type of connection (see ConnectionType)
|
||||
* @return Whether connection is allowed
|
||||
*/
|
||||
static NS_HIDDEN_(PRBool) CheckSameOrigin(nsIDocument *aBaseDocument,
|
||||
nsIURI *aTestURI,
|
||||
PRUint8 aType = kXFormsActionLoad);
|
||||
ConnectionType aType = kXFormsActionLoad);
|
||||
|
||||
/**
|
||||
* @return true if aNode is element, its namespace URI is
|
||||
|
|
Загрузка…
Ссылка в новой задаче