зеркало из https://github.com/mozilla/gecko-dev.git
Files:
caps/idl/nsICertificatePrincipal.idl caps/idl/nsIPrincipal.idl caps/src/nsBasePrincipal.cpp Implement the ability to manipulate multiple capabilties simultaneously. r=mstoltz@netscape.com Files: caps/src/nsCodebasePrincipal.cpp Codebase equality should be based upon origin, not full path. r=mstoltz@netscape.com Files: caps/src/nsScriptSecurityManager.cpp Change URI checking to deny based upon scheme rather than allow based upon scheme for greater flexibility. r=mstoltz@netscape.com Files: dom/public/nsDOMPropEnums.h dom/public/nsDOMPropNames.h dom/src/base/nsGlobalWindow.cpp modules/libpref/src/init/all.js Fix bug 20469 Seeing JS functions and global variables from arbitrary host r=vidur@netscape.com Files: dom/src/base/nsJSUtils.cpp dom/src/base/nsJSUtils.h dom/src/base/nsJSEnvironment.cpp dom/tools/JSStubGen.cpp layout/base/src/nsDocument.cpp layout/html/content/src/nsGenericHTMLElement.cpp Improve performance by removing NS_WITH_SERVICE call for every DOM access. Propagate XPCOM failure codes out properly. r=vidur@netscape.com Files: layout/html/document/src/nsFrameFrame.cpp Fix 27387 Circumventing Same Origin security policy using setAttribute r=vidur@netscape.com
This commit is contained in:
Родитель
eef56ae4c6
Коммит
060e388a6b
|
@ -14,10 +14,11 @@
|
|||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Copyright (C) 1999-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Norris Boyd
|
||||
*/
|
||||
/* Defines an interface for certificate principals. */
|
||||
#include "nsIPrincipal.idl"
|
||||
|
|
|
@ -36,10 +36,13 @@ interface nsIPref;
|
|||
[uuid(ff9313d0-25e1-11d2-8160-006008119d7a)]
|
||||
interface nsIPrincipal : nsISupports {
|
||||
|
||||
const short ENABLE_UNKNOWN = 0;
|
||||
const short ENABLE_GRANTED = 1;
|
||||
const short ENABLE_DENIED = 2;
|
||||
// Values of capabilities for each principal. Order is
|
||||
// significant: if an operation is performed on a set
|
||||
// of capabilities, the minimum is computed.
|
||||
const short ENABLE_DENIED = 1;
|
||||
const short ENABLE_UNKNOWN = 2;
|
||||
const short ENABLE_WITH_USER_PERMISSION = 3;
|
||||
const short ENABLE_GRANTED = 4;
|
||||
|
||||
string ToString();
|
||||
|
||||
|
|
|
@ -67,11 +67,22 @@ nsBasePrincipal::CanEnableCapability(const char *capability, PRInt16 *result)
|
|||
*result = nsIPrincipal::ENABLE_UNKNOWN;
|
||||
return NS_OK;
|
||||
}
|
||||
nsStringKey key(capability);
|
||||
*result = (PRInt16)(PRInt32)mCapabilities->Get(&key);
|
||||
if (!*result)
|
||||
*result = nsIPrincipal::ENABLE_UNKNOWN;
|
||||
return NS_OK;
|
||||
const char *start = capability;
|
||||
*result = nsIPrincipal::ENABLE_GRANTED;
|
||||
for(;;) {
|
||||
const char *space = PL_strchr(start, ' ');
|
||||
int len = space ? space - start : nsCRT::strlen(start);
|
||||
nsCAutoString capString(start, len);
|
||||
nsStringKey key(capString);
|
||||
PRInt16 value = (PRInt16)(PRInt32)mCapabilities->Get(&key);
|
||||
if (value == 0)
|
||||
value = nsIPrincipal::ENABLE_UNKNOWN;
|
||||
if (value < *result)
|
||||
*result = value;
|
||||
if (!space)
|
||||
return NS_OK;
|
||||
start = space + 1;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -83,9 +94,17 @@ nsBasePrincipal::SetCanEnableCapability(const char *capability,
|
|||
if (!mCapabilities)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsStringKey key(capability);
|
||||
mCapabilities->Put(&key, (void *) canEnable);
|
||||
return NS_OK;
|
||||
const char *start = capability;
|
||||
for(;;) {
|
||||
const char *space = PL_strchr(start, ' ');
|
||||
int len = space ? space - start : nsCRT::strlen(start);
|
||||
nsCAutoString capString(start, len);
|
||||
nsStringKey key(capString);
|
||||
mCapabilities->Put(&key, (void *) canEnable);
|
||||
if (!space)
|
||||
return NS_OK;
|
||||
start = space + 1;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -94,10 +113,24 @@ nsBasePrincipal::IsCapabilityEnabled(const char *capability, void *annotation,
|
|||
{
|
||||
*result = PR_FALSE;
|
||||
nsHashtable *ht = (nsHashtable *) annotation;
|
||||
if (ht) {
|
||||
nsStringKey key(capability);
|
||||
if (!ht) {
|
||||
return NS_OK;
|
||||
}
|
||||
const char *start = capability;
|
||||
for(;;) {
|
||||
const char *space = PL_strchr(start, ' ');
|
||||
int len = space ? space - start : nsCRT::strlen(start);
|
||||
nsCAutoString capString(start, len);
|
||||
nsStringKey key(capString);
|
||||
*result = (ht->Get(&key) == (void *) AnnotationEnabled);
|
||||
}
|
||||
if (!*result) {
|
||||
// If any single capability is not enabled, then return false.
|
||||
return NS_OK;
|
||||
}
|
||||
if (!space)
|
||||
return NS_OK;
|
||||
start = space + 1;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -118,8 +151,17 @@ nsBasePrincipal::RevertCapability(const char *capability, void **annotation)
|
|||
{
|
||||
if (*annotation) {
|
||||
nsHashtable *ht = (nsHashtable *) *annotation;
|
||||
nsStringKey key(capability);
|
||||
ht->Remove(&key);
|
||||
const char *start = capability;
|
||||
for(;;) {
|
||||
const char *space = PL_strchr(start, ' ');
|
||||
int len = space ? space - start : nsCRT::strlen(start);
|
||||
nsCAutoString capString(start, len);
|
||||
nsStringKey key(capString);
|
||||
ht->Remove(&key);
|
||||
if (!space)
|
||||
return NS_OK;
|
||||
start = space + 1;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -136,10 +178,19 @@ nsBasePrincipal::SetCapability(const char *capability, void **annotation,
|
|||
// them when we destroy this object.
|
||||
mAnnotations.AppendElement(*annotation);
|
||||
}
|
||||
nsHashtable *ht = (nsHashtable *) *annotation;
|
||||
nsStringKey key(capability);
|
||||
ht->Put(&key, (void *) value);
|
||||
return NS_OK;
|
||||
|
||||
const char *start = capability;
|
||||
for(;;) {
|
||||
const char *space = PL_strchr(start, ' ');
|
||||
int len = space ? space - start : nsCRT::strlen(start);
|
||||
nsCAutoString capString(start, len);
|
||||
nsStringKey key(capString);
|
||||
nsHashtable *ht = (nsHashtable *) *annotation;
|
||||
ht->Put(&key, (void *) value);
|
||||
if (!space)
|
||||
return NS_OK;
|
||||
start = space + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int nsBasePrincipal::mCapabilitiesOrdinal = 0;
|
||||
|
|
|
@ -46,10 +46,10 @@ nsCodebasePrincipal::ToString(char **result)
|
|||
{
|
||||
nsAutoString buf;
|
||||
buf += "[Codebase ";
|
||||
nsXPIDLCString spec;
|
||||
if (NS_FAILED(mURI->GetSpec(getter_Copies(spec))))
|
||||
nsXPIDLCString origin;
|
||||
if (NS_FAILED(GetOrigin(getter_Copies(origin))))
|
||||
return NS_ERROR_FAILURE;
|
||||
buf += spec;
|
||||
buf += origin;
|
||||
buf += ']';
|
||||
*result = buf.ToNewCString();
|
||||
return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -64,10 +64,10 @@ nsCodebasePrincipal::ToUserVisibleString(char **result)
|
|||
NS_IMETHODIMP
|
||||
nsCodebasePrincipal::HashValue(PRUint32 *result)
|
||||
{
|
||||
nsXPIDLCString spec;
|
||||
if (NS_FAILED(mURI->GetSpec(getter_Copies(spec))))
|
||||
nsXPIDLCString origin;
|
||||
if (NS_FAILED(GetOrigin(getter_Copies(origin))))
|
||||
return NS_ERROR_FAILURE;
|
||||
*result = nsCRT::HashValue(spec);
|
||||
*result = nsCRT::HashValue(origin);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -83,19 +83,7 @@ nsCodebasePrincipal::Equals(nsIPrincipal *other, PRBool *result)
|
|||
*result = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsICodebasePrincipal> otherCodebase;
|
||||
if (NS_FAILED(other->QueryInterface(
|
||||
NS_GET_IID(nsICodebasePrincipal),
|
||||
(void **) getter_AddRefs(otherCodebase))))
|
||||
{
|
||||
*result = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIURI> otherURI;
|
||||
if (NS_FAILED(otherCodebase->GetURI(getter_AddRefs(otherURI)))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!mURI || NS_FAILED(otherURI->Equals(mURI, result))) {
|
||||
if (NS_FAILED(SameOrigin(other, result))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -485,34 +485,65 @@ nsScriptSecurityManager::CheckLoadURI(nsIURI *aFromURI, nsIURI *aURI,
|
|||
nsXPIDLCString scheme;
|
||||
if (NS_FAILED(aURI->GetScheme(getter_Copies(scheme))))
|
||||
return NS_ERROR_FAILURE;
|
||||
if (nsCRT::strcasecmp(scheme, "http") == 0 ||
|
||||
nsCRT::strcasecmp(scheme, "https") == 0 ||
|
||||
nsCRT::strcasecmp(scheme, "javascript") == 0 ||
|
||||
nsCRT::strcasecmp(scheme, "ftp") == 0 ||
|
||||
nsCRT::strcasecmp(scheme, "mailto") == 0 ||
|
||||
nsCRT::strcasecmp(scheme, "finger") == 0 ||
|
||||
nsCRT::strcasecmp(scheme, "news") == 0)
|
||||
{
|
||||
// everyone can access these schemes.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsXPIDLCString scheme2;
|
||||
if (nsCRT::strcasecmp(scheme, fromScheme) == 0) {
|
||||
// every scheme can access another URI from the same scheme
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (nsCRT::strcasecmp(scheme, "about") == 0) {
|
||||
nsXPIDLCString spec;
|
||||
if (NS_FAILED(aURI->GetSpec(getter_Copies(spec))))
|
||||
return NS_ERROR_FAILURE;
|
||||
if (nsCRT::strcasecmp(spec, "about:blank") == 0) {
|
||||
return NS_OK;
|
||||
enum Action { AllowProtocol, DenyProtocol, AboutProtocol };
|
||||
struct {
|
||||
const char *name;
|
||||
Action action;
|
||||
} protocolList[] = {
|
||||
"about", AboutProtocol,
|
||||
"data", AllowProtocol,
|
||||
"file", DenyProtocol,
|
||||
"ftp", AllowProtocol,
|
||||
"http", AllowProtocol,
|
||||
"https", AllowProtocol,
|
||||
"jar", AllowProtocol,
|
||||
"keyword", DenyProtocol,
|
||||
"res", DenyProtocol,
|
||||
"resource", DenyProtocol,
|
||||
"datetime", DenyProtocol,
|
||||
"finger", AllowProtocol,
|
||||
"chrome", DenyProtocol,
|
||||
"javascript", AllowProtocol,
|
||||
"mailto", AllowProtocol,
|
||||
"imap", DenyProtocol,
|
||||
"mailbox", DenyProtocol,
|
||||
"pop3", DenyProtocol,
|
||||
"news", AllowProtocol,
|
||||
};
|
||||
|
||||
for (int i=0; i < sizeof(protocolList)/sizeof(protocolList[0]); i++) {
|
||||
if (nsCRT::strcasecmp(scheme, protocolList[i].name) == 0) {
|
||||
switch (protocolList[i].action) {
|
||||
case AllowProtocol:
|
||||
// everyone can access these schemes.
|
||||
return NS_OK;
|
||||
case DenyProtocol:
|
||||
// Deny access
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
case AboutProtocol:
|
||||
// Allow for about:blank, deny for others.
|
||||
nsXPIDLCString spec;
|
||||
if (NS_FAILED(aURI->GetSpec(getter_Copies(spec))))
|
||||
return NS_ERROR_FAILURE;
|
||||
if (nsCRT::strcasecmp(spec, "about:blank") == 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
// If we reach here, we have an unknown protocol. Warn, but allow.
|
||||
// This is risky from a security standpoint, but allows flexibility
|
||||
// in installing new protocol handlers after initial ship.
|
||||
NS_WARN_IF_FALSE(PR_FALSE, "unknown protocol");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1664,18 +1664,21 @@ nsDocument::AttributeChanged(nsIContent* aChild,
|
|||
PRInt32 aHint)
|
||||
{
|
||||
PRInt32 i;
|
||||
nsresult result = NS_OK;
|
||||
// Get new value of count for every iteration in case
|
||||
// observers remove themselves during the loop.
|
||||
for (i = 0; i < mObservers.Count(); i++) {
|
||||
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
|
||||
observer->AttributeChanged(this, aChild, aNameSpaceID, aAttribute, aHint);
|
||||
nsresult rv = observer->AttributeChanged(this, aChild, aNameSpaceID, aAttribute, aHint);
|
||||
if (NS_FAILED(rv) && NS_SUCCEEDED(result))
|
||||
result = rv;
|
||||
// Make sure that the observer didn't remove itself during the
|
||||
// notification. If it did, update our index and count.
|
||||
if (observer != (nsIDocumentObserver*)mObservers[i]) {
|
||||
i--;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1057,7 +1057,7 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID,
|
|||
NS_RELEASE(htmlContent);
|
||||
|
||||
if (aNotify && (nsnull != mDocument)) {
|
||||
mDocument->AttributeChanged(mContent, aNameSpaceID, aAttribute, NS_STYLE_HINT_UNKNOWN);
|
||||
result = mDocument->AttributeChanged(mContent, aNameSpaceID, aAttribute, NS_STYLE_HINT_UNKNOWN);
|
||||
mDocument->EndUpdate();
|
||||
}
|
||||
|
||||
|
|
|
@ -867,6 +867,7 @@ enum nsDOMProp {
|
|||
NS_DOM_PROP_WINDOW_SCREEN,
|
||||
NS_DOM_PROP_WINDOW_SCREENX,
|
||||
NS_DOM_PROP_WINDOW_SCREENY,
|
||||
NS_DOM_PROP_WINDOW_SCRIPTGLOBALS,
|
||||
NS_DOM_PROP_WINDOW_SCROLL,
|
||||
NS_DOM_PROP_WINDOW_SCROLLBARS,
|
||||
NS_DOM_PROP_WINDOW_SCROLLBY,
|
||||
|
|
|
@ -866,6 +866,7 @@
|
|||
"window.screen", \
|
||||
"window.screenx", \
|
||||
"window.screeny", \
|
||||
"window.scriptglobals", \
|
||||
"window.scroll", \
|
||||
"window.scrollbars", \
|
||||
"window.scrollby", \
|
||||
|
|
|
@ -1852,6 +1852,14 @@ PRBool GlobalWindowImpl::GetProperty(JSContext* aContext, JSObject* aObj,
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nsIScriptSecurityManager * securityManager =
|
||||
nsJSUtils::nsGetSecurityManager(aContext, aObj);
|
||||
if(NS_FAILED(securityManager->CheckScriptAccess(aContext, aObj,
|
||||
NS_DOM_PROP_WINDOW_SCRIPTGLOBALS, PR_FALSE)))
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -2397,7 +2405,7 @@ NS_IMETHODIMP GlobalWindowImpl::OpenInternal(JSContext* cx, jsval* argv,
|
|||
nsCOMPtr<nsIURI> newUrl;
|
||||
nsCOMPtr<nsIScriptContext> scriptCX;
|
||||
nsJSUtils::nsGetStaticScriptContext(cx, (JSObject*)mScriptObject,
|
||||
getter_AddRefs(scriptCX));
|
||||
getter_AddRefs(scriptCX));
|
||||
if(!scriptCX ||
|
||||
NS_FAILED(scriptCX->GetSecurityManager(getter_AddRefs(secMan))) ||
|
||||
NS_FAILED(NS_NewURI(getter_AddRefs(newUrl), mAbsURL)) ||
|
||||
|
|
|
@ -63,28 +63,21 @@ GetBarPropProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case BARPROP_VISIBLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_BARPROP_VISIBLE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetVisible(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetVisible(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,6 +89,8 @@ GetBarPropProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -113,27 +108,24 @@ SetBarPropProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case BARPROP_VISIBLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_BARPROP_VISIBLE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetVisible(prop);
|
||||
|
||||
rv = a->SetVisible(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -144,6 +136,8 @@ SetBarPropProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,79 +66,57 @@ GetDOMExceptionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case DOMEXCEPTION_CODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOMEXCEPTION_CODE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCode(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetCode(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DOMEXCEPTION_RESULT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOMEXCEPTION_RESULT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetResult(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetResult(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DOMEXCEPTION_MESSAGE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOMEXCEPTION_MESSAGE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMessage(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMessage(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DOMEXCEPTION_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOMEXCEPTION_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -150,6 +128,8 @@ GetDOMExceptionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -167,13 +147,11 @@ SetDOMExceptionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -184,6 +162,8 @@ SetDOMExceptionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -233,21 +213,14 @@ DOMExceptionToString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOMEXCEPTION_TOSTRING, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOMEXCEPTION_TOSTRING, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->ToString(nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -860,6 +860,7 @@ nsJSEnvironment::GetScriptingEnvironment()
|
|||
}
|
||||
|
||||
const char kJSRuntimeServiceProgID[] = "nsJSRuntimeService";
|
||||
static int globalCount;
|
||||
|
||||
nsJSEnvironment::nsJSEnvironment()
|
||||
{
|
||||
|
@ -883,10 +884,14 @@ nsJSEnvironment::nsJSEnvironment()
|
|||
PRBool started = PR_FALSE;
|
||||
rv = manager->StartupLiveConnect(mRuntime, started);
|
||||
}
|
||||
|
||||
globalCount++;
|
||||
}
|
||||
|
||||
nsJSEnvironment::~nsJSEnvironment()
|
||||
{
|
||||
if (--globalCount == 0)
|
||||
nsJSUtils::nsClearCachedSecurityManager();
|
||||
if (mRuntimeService)
|
||||
nsServiceManager::ReleaseService(kJSRuntimeServiceProgID, mRuntimeService);
|
||||
}
|
||||
|
|
|
@ -66,79 +66,57 @@ GetHistoryProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HISTORY_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HISTORY_CURRENT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_CURRENT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCurrent(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCurrent(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HISTORY_PREVIOUS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_PREVIOUS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPrevious(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetPrevious(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HISTORY_NEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_NEXT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNext(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetNext(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -150,6 +128,8 @@ GetHistoryProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -167,13 +147,11 @@ SetHistoryProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -184,6 +162,8 @@ SetHistoryProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -232,21 +212,14 @@ HistoryBack(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_BACK, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_BACK, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Back();
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -274,21 +247,14 @@ HistoryForward(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_FORWARD, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_FORWARD, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Forward();
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -316,21 +282,14 @@ HistoryGo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_GO, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HISTORY_GO, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Go(cx, argv+0, argc-0);
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -71,130 +71,93 @@ GetLocationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case LOCATION_HASH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_HASH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHash(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHash(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_HOST:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_HOST, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHost(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHost(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_HOSTNAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_HOSTNAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHostname(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHostname(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_PATHNAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_PATHNAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPathname(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetPathname(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_PORT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_PORT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPort(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetPort(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_PROTOCOL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_PROTOCOL, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetProtocol(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetProtocol(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_SEARCH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_SEARCH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSearch(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSearch(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -206,6 +169,8 @@ GetLocationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -223,103 +188,94 @@ SetLocationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case LOCATION_HASH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_HASH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHash(prop);
|
||||
|
||||
rv = a->SetHash(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_HOST:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_HOST, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHost(prop);
|
||||
|
||||
rv = a->SetHost(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_HOSTNAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_HOSTNAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHostname(prop);
|
||||
|
||||
rv = a->SetHostname(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_PATHNAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_PATHNAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetPathname(prop);
|
||||
|
||||
rv = a->SetPathname(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_PORT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_PORT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetPort(prop);
|
||||
|
||||
rv = a->SetPort(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_PROTOCOL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_PROTOCOL, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetProtocol(prop);
|
||||
|
||||
rv = a->SetProtocol(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCATION_SEARCH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_SEARCH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetSearch(prop);
|
||||
|
||||
rv = a->SetSearch(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -330,6 +286,8 @@ SetLocationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -379,21 +337,14 @@ LocationToString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_TOSTRING, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_LOCATION_TOSTRING, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->ToString(nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -426,21 +377,14 @@ NSLocationReload(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSLOCATION_RELOAD, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSLOCATION_RELOAD, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Reload(cx, argv+0, argc-0);
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -473,21 +417,14 @@ NSLocationReplace(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSLOCATION_REPLACE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSLOCATION_REPLACE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Replace(cx, argv+0, argc-0);
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -68,80 +68,58 @@ GetMimeTypeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case MIMETYPE_DESCRIPTION:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MIMETYPE_DESCRIPTION, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDescription(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetDescription(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MIMETYPE_ENABLEDPLUGIN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MIMETYPE_ENABLEDPLUGIN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMPlugin* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetEnabledPlugin(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMPlugin* prop;
|
||||
rv = a->GetEnabledPlugin(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MIMETYPE_SUFFIXES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MIMETYPE_SUFFIXES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSuffixes(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSuffixes(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MIMETYPE_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MIMETYPE_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -153,6 +131,8 @@ GetMimeTypeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -170,13 +150,11 @@ SetMimeTypeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -187,6 +165,8 @@ SetMimeTypeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,43 +66,32 @@ GetMimeTypeArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case MIMETYPEARRAY_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MIMETYPEARRAY_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMMimeType* prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,8 +113,8 @@ GetMimeTypeArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
result = a->NamedItem(name, &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
if (NULL != prop) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
|
@ -139,6 +128,8 @@ GetMimeTypeArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -157,13 +148,11 @@ SetMimeTypeArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
|
@ -175,6 +164,8 @@ SetMimeTypeArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -225,21 +216,14 @@ MimeTypeArrayItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MIMETYPEARRAY_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MIMETYPEARRAY_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -276,21 +260,14 @@ MimeTypeArrayNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MIMETYPEARRAY_NAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MIMETYPEARRAY_NAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -76,183 +76,131 @@ GetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case NAVIGATOR_APPCODENAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_APPCODENAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAppCodeName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAppCodeName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAVIGATOR_APPNAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_APPNAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAppName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAppName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAVIGATOR_APPVERSION:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_APPVERSION, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAppVersion(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAppVersion(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAVIGATOR_LANGUAGE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_LANGUAGE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLanguage(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetLanguage(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAVIGATOR_MIMETYPES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_MIMETYPES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMMimeTypeArray* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMimeTypes(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMMimeTypeArray* prop;
|
||||
rv = a->GetMimeTypes(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAVIGATOR_PLATFORM:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_PLATFORM, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPlatform(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetPlatform(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAVIGATOR_PLUGINS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_PLUGINS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMPluginArray* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPlugins(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMPluginArray* prop;
|
||||
rv = a->GetPlugins(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAVIGATOR_SECURITYPOLICY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_SECURITYPOLICY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSecurityPolicy(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSecurityPolicy(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAVIGATOR_USERAGENT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_USERAGENT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetUserAgent(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetUserAgent(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAVIGATOR_COOKIEENABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_COOKIEENABLED, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCookieEnabled(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetCookieEnabled(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -264,6 +212,8 @@ GetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -281,13 +231,11 @@ SetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -298,6 +246,8 @@ SetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -347,21 +297,14 @@ NavigatorJavaEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_JAVAENABLED, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_JAVAENABLED, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->JavaEnabled(&nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -390,21 +333,14 @@ NavigatorTaintEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_TAINTENABLED, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_TAINTENABLED, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->TaintEnabled(&nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -433,21 +369,14 @@ NavigatorPreference(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_PREFERENCE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAVIGATOR_PREFERENCE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Preference(cx, argv+0, argc-0, &nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -69,94 +69,68 @@ GetPluginProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case PLUGIN_DESCRIPTION:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGIN_DESCRIPTION, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDescription(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetDescription(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PLUGIN_FILENAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGIN_FILENAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetFilename(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetFilename(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PLUGIN_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGIN_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PLUGIN_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGIN_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMMimeType* prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -178,8 +152,8 @@ GetPluginProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
result = a->NamedItem(name, &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
if (NULL != prop) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
|
@ -193,6 +167,8 @@ GetPluginProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -211,13 +187,11 @@ SetPluginProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
|
@ -229,6 +203,8 @@ SetPluginProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -279,21 +255,14 @@ PluginItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGIN_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGIN_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -330,21 +299,14 @@ PluginNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGIN_NAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGIN_NAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -66,43 +66,32 @@ GetPluginArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case PLUGINARRAY_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGINARRAY_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMPlugin* prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,8 +113,8 @@ GetPluginArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
result = a->NamedItem(name, &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
if (NULL != prop) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
|
@ -139,6 +128,8 @@ GetPluginArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -157,13 +148,11 @@ SetPluginArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
|
@ -175,6 +164,8 @@ SetPluginArrayProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -225,21 +216,14 @@ PluginArrayItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGINARRAY_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGINARRAY_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -276,21 +260,14 @@ PluginArrayNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGINARRAY_NAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGINARRAY_NAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -324,21 +301,14 @@ PluginArrayRefresh(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGINARRAY_REFRESH, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PLUGINARRAY_REFRESH, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -70,147 +70,105 @@ GetScreenProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case SCREEN_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_SCREEN_WIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetWidth(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetWidth(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCREEN_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_SCREEN_HEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHeight(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetHeight(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCREEN_PIXELDEPTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_SCREEN_PIXELDEPTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPixelDepth(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetPixelDepth(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCREEN_COLORDEPTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_SCREEN_COLORDEPTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetColorDepth(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetColorDepth(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCREEN_AVAILWIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_SCREEN_AVAILWIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAvailWidth(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetAvailWidth(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCREEN_AVAILHEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_SCREEN_AVAILHEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAvailHeight(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetAvailHeight(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCREEN_AVAILLEFT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_SCREEN_AVAILLEFT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAvailLeft(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetAvailLeft(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCREEN_AVAILTOP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_SCREEN_AVAILTOP, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAvailTop(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetAvailTop(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -222,6 +180,8 @@ GetScreenProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -239,13 +199,11 @@ SetScreenProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -256,6 +214,8 @@ SetScreenProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "nsIDOMDOMException.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
|
||||
|
@ -670,4 +671,30 @@ nsJSUtils::nsCheckAccess(JSContext *cx, JSObject *obj,
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_EXPORT nsIScriptSecurityManager *
|
||||
nsJSUtils::nsGetSecurityManager(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
if (!mCachedSecurityManager) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
return nsnull;
|
||||
}
|
||||
mCachedSecurityManager = secMan;
|
||||
NS_ADDREF(mCachedSecurityManager);
|
||||
}
|
||||
return mCachedSecurityManager;
|
||||
}
|
||||
|
||||
NS_EXPORT void
|
||||
nsJSUtils::nsClearCachedSecurityManager()
|
||||
{
|
||||
if (mCachedSecurityManager) {
|
||||
NS_RELEASE(mCachedSecurityManager);
|
||||
mCachedSecurityManager = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsIScriptSecurityManager *nsJSUtils::mCachedSecurityManager;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
class nsIDOMEventListener;
|
||||
class nsIScriptContext;
|
||||
class nsIScriptGlobalObject;
|
||||
class nsIScriptSecurityManager;
|
||||
|
||||
class nsJSUtils {
|
||||
public:
|
||||
|
@ -141,11 +142,17 @@ public:
|
|||
jsid id, JSAccessMode mode,
|
||||
jsval *vp);
|
||||
|
||||
static NS_EXPORT nsIScriptSecurityManager *
|
||||
nsGetSecurityManager(JSContext *cx, JSObject *obj);
|
||||
|
||||
static NS_EXPORT void nsClearCachedSecurityManager();
|
||||
|
||||
protected:
|
||||
static PRBool NameAndFormatForNSResult(nsresult rv,
|
||||
const char** name,
|
||||
const char** format);
|
||||
|
||||
static nsIScriptSecurityManager *mCachedSecurityManager;
|
||||
};
|
||||
|
||||
#endif /* nsJSUtils_h__ */
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -66,43 +66,32 @@ GetWindowCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case WINDOWCOLLECTION_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWCOLLECTION_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMWindow* prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,8 +113,8 @@ GetWindowCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
result = a->NamedItem(name, &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
if (NULL != prop) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
|
@ -139,6 +128,8 @@ GetWindowCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -157,13 +148,11 @@ SetWindowCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
|
@ -175,6 +164,8 @@ SetWindowCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -225,21 +216,14 @@ WindowCollectionItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWCOLLECTION_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWCOLLECTION_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -276,21 +260,14 @@ WindowCollectionNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWCOLLECTION_NAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWCOLLECTION_NAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -65,62 +65,45 @@ GetAttrProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case ATTR_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ATTR_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ATTR_SPECIFIED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ATTR_SPECIFIED, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSpecified(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetSpecified(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ATTR_VALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ATTR_VALUE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetValue(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetValue(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -132,6 +115,8 @@ GetAttrProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -149,25 +134,22 @@ SetAttrProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case ATTR_VALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ATTR_VALUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetValue(prop);
|
||||
|
||||
rv = a->SetValue(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -178,6 +160,8 @@ SetAttrProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,13 +57,11 @@ GetCDATASectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -74,6 +72,8 @@ GetCDATASectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,11 @@ SetCDATASectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -108,6 +106,8 @@ SetCDATASectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,45 +64,33 @@ GetCharacterDataProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CHARACTERDATA_DATA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_DATA, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetData(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetData(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CHARACTERDATA_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -114,6 +102,8 @@ GetCharacterDataProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -131,25 +121,22 @@ SetCharacterDataProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CHARACTERDATA_DATA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_DATA, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetData(prop);
|
||||
|
||||
rv = a->SetData(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -160,6 +147,8 @@ SetCharacterDataProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -211,21 +200,14 @@ CharacterDataSubstringData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_SUBSTRINGDATA, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_SUBSTRINGDATA, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -264,21 +246,14 @@ CharacterDataAppendData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_APPENDDATA, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_APPENDDATA, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -313,21 +288,14 @@ CharacterDataInsertData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_INSERTDATA, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_INSERTDATA, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -365,21 +333,14 @@ CharacterDataDeleteData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_DELETEDATA, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_DELETEDATA, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -420,21 +381,14 @@ CharacterDataReplaceData(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_REPLACEDATA, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CHARACTERDATA_REPLACEDATA, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 3) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -57,13 +57,11 @@ GetCommentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -74,6 +72,8 @@ GetCommentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,11 @@ SetCommentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -108,6 +106,8 @@ SetCommentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,13 +57,11 @@ GetDOMImplementationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -74,6 +72,8 @@ GetDOMImplementationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,11 @@ SetDOMImplementationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -108,6 +106,8 @@ SetDOMImplementationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -159,21 +159,14 @@ DOMImplementationHasFeature(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOMIMPLEMENTATION_HASFEATURE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOMIMPLEMENTATION_HASFEATURE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -97,167 +97,126 @@ GetDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case DOCUMENT_DOCTYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_DOCTYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMDocumentType* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDoctype(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMDocumentType* prop;
|
||||
rv = a->GetDoctype(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DOCUMENT_IMPLEMENTATION:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_IMPLEMENTATION, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMDOMImplementation* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetImplementation(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMDOMImplementation* prop;
|
||||
rv = a->GetImplementation(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DOCUMENT_DOCUMENTELEMENT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_DOCUMENTELEMENT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMElement* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDocumentElement(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMElement* prop;
|
||||
rv = a->GetDocumentElement(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSDOCUMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_WIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetWidth(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
rv = b->GetWidth(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSDOCUMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetHeight(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
rv = b->GetHeight(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSDOCUMENT_STYLESHEETS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_STYLESHEETS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMStyleSheetCollection* prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetStyleSheets(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMStyleSheetCollection* prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
rv = b->GetStyleSheets(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSDOCUMENT_CHARACTERSET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_CHARACTERSET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetCharacterSet(prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsIDOMNSDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSDocumentIID, (void **)&b)) {
|
||||
rv = b->GetCharacterSet(prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -268,6 +227,8 @@ GetDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -285,13 +246,11 @@ SetDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -302,6 +261,8 @@ SetDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -352,21 +313,14 @@ DocumentCreateElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEELEMENT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEELEMENT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -400,21 +354,14 @@ DocumentCreateDocumentFragment(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEDOCUMENTFRAGMENT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEDOCUMENTFRAGMENT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->CreateDocumentFragment(&nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -444,21 +391,14 @@ DocumentCreateTextNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATETEXTNODE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATETEXTNODE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -493,21 +433,14 @@ DocumentCreateComment(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATECOMMENT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATECOMMENT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -542,21 +475,14 @@ DocumentCreateCDATASection(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATECDATASECTION, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATECDATASECTION, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -592,21 +518,14 @@ DocumentCreateProcessingInstruction(JSContext *cx, JSObject *obj, uintN argc, js
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEPROCESSINGINSTRUCTION, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEPROCESSINGINSTRUCTION, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -642,21 +561,14 @@ DocumentCreateAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEATTRIBUTE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEATTRIBUTE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -691,21 +603,14 @@ DocumentCreateEntityReference(JSContext *cx, JSObject *obj, uintN argc, jsval *a
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEENTITYREFERENCE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEENTITYREFERENCE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -740,21 +645,14 @@ DocumentGetElementsByTagName(JSContext *cx, JSObject *obj, uintN argc, jsval *ar
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_GETELEMENTSBYTAGNAME, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_GETELEMENTSBYTAGNAME, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -795,21 +693,14 @@ NSDocumentCreateElementWithNameSpace(JSContext *cx, JSObject *obj, uintN argc, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_CREATEELEMENTWITHNAMESPACE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_CREATEELEMENTWITHNAMESPACE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -849,21 +740,14 @@ NSDocumentCreateRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_CREATERANGE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSDOCUMENT_CREATERANGE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->CreateRange(&nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -57,13 +57,11 @@ GetDocumentFragmentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -74,6 +72,8 @@ GetDocumentFragmentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,11 @@ SetDocumentFragmentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -108,6 +106,8 @@ SetDocumentFragmentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,64 +67,47 @@ GetDocumentTypeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case DOCUMENTTYPE_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENTTYPE_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DOCUMENTTYPE_ENTITIES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENTTYPE_ENTITIES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNamedNodeMap* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetEntities(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNamedNodeMap* prop;
|
||||
rv = a->GetEntities(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DOCUMENTTYPE_NOTATIONS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENTTYPE_NOTATIONS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNamedNodeMap* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNotations(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNamedNodeMap* prop;
|
||||
rv = a->GetNotations(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -136,6 +119,8 @@ GetDocumentTypeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -153,13 +138,11 @@ SetDocumentTypeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -170,6 +153,8 @@ SetDocumentTypeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,28 +67,21 @@ GetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case ELEMENT_TAGNAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_TAGNAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTagName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetTagName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -100,6 +93,8 @@ GetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -117,13 +112,11 @@ SetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -134,6 +127,8 @@ SetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -184,21 +179,14 @@ ElementGetAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_GETATTRIBUTE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_GETATTRIBUTE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -233,21 +221,14 @@ ElementSetAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_SETATTRIBUTE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_SETATTRIBUTE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -282,21 +263,14 @@ ElementRemoveAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_REMOVEATTRIBUTE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_REMOVEATTRIBUTE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -331,21 +305,14 @@ ElementGetAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_GETATTRIBUTENODE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_GETATTRIBUTENODE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -380,21 +347,14 @@ ElementSetAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_SETATTRIBUTENODE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_SETATTRIBUTENODE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -435,21 +395,14 @@ ElementRemoveAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_REMOVEATTRIBUTENODE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_REMOVEATTRIBUTENODE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -490,21 +443,14 @@ ElementGetElementsByTagName(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_GETELEMENTSBYTAGNAME, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_GETELEMENTSBYTAGNAME, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -537,21 +483,14 @@ ElementNormalize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_NORMALIZE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ELEMENT_NORMALIZE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Normalize();
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -65,62 +65,45 @@ GetEntityProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case ENTITY_PUBLICID:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ENTITY_PUBLICID, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPublicId(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetPublicId(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ENTITY_SYSTEMID:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ENTITY_SYSTEMID, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSystemId(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSystemId(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ENTITY_NOTATIONNAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ENTITY_NOTATIONNAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNotationName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetNotationName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -132,6 +115,8 @@ GetEntityProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -149,13 +134,11 @@ SetEntityProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -166,6 +149,8 @@ SetEntityProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,13 +57,11 @@ GetEntityReferenceProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -74,6 +72,8 @@ GetEntityReferenceProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,11 @@ SetEntityReferenceProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -108,6 +106,8 @@ SetEntityReferenceProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,42 +65,31 @@ GetNamedNodeMapProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case NAMEDNODEMAP_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMNode* prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +98,8 @@ GetNamedNodeMapProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -126,13 +117,11 @@ SetNamedNodeMapProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -143,6 +132,8 @@ SetNamedNodeMapProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -193,21 +184,14 @@ NamedNodeMapGetNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_GETNAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_GETNAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -242,21 +226,14 @@ NamedNodeMapSetNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_SETNAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_SETNAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -297,21 +274,14 @@ NamedNodeMapRemoveNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_REMOVENAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_REMOVENAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -346,21 +316,14 @@ NamedNodeMapItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NAMEDNODEMAP_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -83,206 +83,149 @@ GetNodeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case NODE_NODENAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_NODENAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNodeName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetNodeName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_NODEVALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_NODEVALUE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNodeValue(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetNodeValue(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_NODETYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_NODETYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint16 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNodeType(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint16 prop;
|
||||
rv = a->GetNodeType(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_PARENTNODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_PARENTNODE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetParentNode(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
rv = a->GetParentNode(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_CHILDNODES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_CHILDNODES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNodeList* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetChildNodes(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNodeList* prop;
|
||||
rv = a->GetChildNodes(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_FIRSTCHILD:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_FIRSTCHILD, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetFirstChild(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
rv = a->GetFirstChild(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_LASTCHILD:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_LASTCHILD, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLastChild(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
rv = a->GetLastChild(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_PREVIOUSSIBLING:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_PREVIOUSSIBLING, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPreviousSibling(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
rv = a->GetPreviousSibling(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_NEXTSIBLING:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_NEXTSIBLING, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNextSibling(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
rv = a->GetNextSibling(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_ATTRIBUTES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_ATTRIBUTES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNamedNodeMap* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAttributes(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNamedNodeMap* prop;
|
||||
rv = a->GetAttributes(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NODE_OWNERDOCUMENT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_OWNERDOCUMENT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMDocument* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetOwnerDocument(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMDocument* prop;
|
||||
rv = a->GetOwnerDocument(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -294,6 +237,8 @@ GetNodeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -311,25 +256,22 @@ SetNodeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case NODE_NODEVALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_NODEVALUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetNodeValue(prop);
|
||||
|
||||
rv = a->SetNodeValue(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -340,6 +282,8 @@ SetNodeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -391,21 +335,14 @@ NodeInsertBefore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_INSERTBEFORE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_INSERTBEFORE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -454,21 +391,14 @@ NodeReplaceChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_REPLACECHILD, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_REPLACECHILD, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -516,21 +446,14 @@ NodeRemoveChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_REMOVECHILD, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_REMOVECHILD, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -571,21 +494,14 @@ NodeAppendChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_APPENDCHILD, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_APPENDCHILD, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -625,21 +541,14 @@ NodeHasChildNodes(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_HASCHILDNODES, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_HASCHILDNODES, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->HasChildNodes(&nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -669,21 +578,14 @@ NodeCloneNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_CLONENODE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_CLONENODE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -726,21 +628,14 @@ EventTargetAddEventListener(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENTTARGET_ADDEVENTLISTENER, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENTTARGET_ADDEVENTLISTENER, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 3) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -790,21 +685,14 @@ EventTargetRemoveEventListener(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENTTARGET_REMOVEEVENTLISTENER, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENTTARGET_REMOVEEVENTLISTENER, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 3) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -65,42 +65,31 @@ GetNodeListProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case NODELIST_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODELIST_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMNode* prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +98,8 @@ GetNodeListProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -126,13 +117,11 @@ SetNodeListProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -143,6 +132,8 @@ SetNodeListProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -193,21 +184,14 @@ NodeListItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODELIST_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODELIST_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -64,45 +64,33 @@ GetNotationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case NOTATION_PUBLICID:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NOTATION_PUBLICID, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPublicId(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetPublicId(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NOTATION_SYSTEMID:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NOTATION_SYSTEMID, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSystemId(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSystemId(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -114,6 +102,8 @@ GetNotationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -131,13 +121,11 @@ SetNotationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -148,6 +136,8 @@ SetNotationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,45 +64,33 @@ GetProcessingInstructionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case PROCESSINGINSTRUCTION_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PROCESSINGINSTRUCTION_TARGET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PROCESSINGINSTRUCTION_DATA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PROCESSINGINSTRUCTION_DATA, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetData(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetData(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -114,6 +102,8 @@ GetProcessingInstructionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -131,25 +121,22 @@ SetProcessingInstructionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case PROCESSINGINSTRUCTION_DATA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_PROCESSINGINSTRUCTION_DATA, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetData(prop);
|
||||
|
||||
rv = a->SetData(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -160,6 +147,8 @@ SetProcessingInstructionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,62 +65,45 @@ GetStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case STYLESHEET_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case STYLESHEET_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_DISABLED, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case STYLESHEET_READONLY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_READONLY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetReadOnly(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetReadOnly(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -132,6 +115,8 @@ GetStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -149,27 +134,24 @@ SetStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case STYLESHEET_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEET_DISABLED, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetDisabled(prop);
|
||||
|
||||
rv = a->SetDisabled(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -180,6 +162,8 @@ SetStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,42 +65,31 @@ GetStyleSheetCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case STYLESHEETCOLLECTION_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEETCOLLECTION_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMStyleSheet* prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +98,8 @@ GetStyleSheetCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -126,13 +117,11 @@ SetStyleSheetCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -143,6 +132,8 @@ SetStyleSheetCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -193,21 +184,14 @@ StyleSheetCollectionItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEETCOLLECTION_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_STYLESHEETCOLLECTION_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -57,13 +57,11 @@ GetTextProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -74,6 +72,8 @@ GetTextProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,11 @@ SetTextProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -108,6 +106,8 @@ SetTextProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -158,21 +158,14 @@ TextSplitText(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_TEXT_SPLITTEXT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_TEXT_SPLITTEXT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -65,29 +65,22 @@ GetCSSFontFaceRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSFONTFACERULE_STYLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSFONTFACERULE_STYLE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetStyle(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
rv = a->GetStyle(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -99,6 +92,8 @@ GetCSSFontFaceRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -116,29 +111,26 @@ SetCSSFontFaceRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSFONTFACERULE_STYLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSFONTFACERULE_STYLE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
kICSSStyleDeclarationIID, "CSSStyleDeclaration",
|
||||
cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_OBJECT_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
kICSSStyleDeclarationIID, "CSSStyleDeclaration",
|
||||
cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_OBJECT_ERR;
|
||||
}
|
||||
|
||||
a->SetStyle(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
rv = a->SetStyle(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -149,6 +141,8 @@ SetCSSFontFaceRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,63 +67,46 @@ GetCSSImportRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSIMPORTRULE_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSIMPORTRULE_HREF, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSIMPORTRULE_MEDIA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSIMPORTRULE_MEDIA, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMedia(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMedia(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSIMPORTRULE_STYLESHEET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSIMPORTRULE_STYLESHEET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleSheet* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetStyleSheet(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleSheet* prop;
|
||||
rv = a->GetStyleSheet(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -135,6 +118,8 @@ GetCSSImportRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -152,38 +137,34 @@ SetCSSImportRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSIMPORTRULE_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSIMPORTRULE_HREF, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHref(prop);
|
||||
|
||||
rv = a->SetHref(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSIMPORTRULE_MEDIA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSIMPORTRULE_MEDIA, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetMedia(prop);
|
||||
|
||||
rv = a->SetMedia(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -194,6 +175,8 @@ SetCSSImportRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,46 +66,34 @@ GetCSSMediaRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSMEDIARULE_MEDIATYPES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_MEDIATYPES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMediaTypes(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMediaTypes(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSMEDIARULE_CSSRULES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_CSSRULES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleRuleCollection* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCssRules(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleRuleCollection* prop;
|
||||
rv = a->GetCssRules(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -117,6 +105,8 @@ GetCSSMediaRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -134,25 +124,22 @@ SetCSSMediaRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSMEDIARULE_MEDIATYPES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_MEDIATYPES, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetMediaTypes(prop);
|
||||
|
||||
rv = a->SetMediaTypes(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -163,6 +150,8 @@ SetCSSMediaRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -214,21 +203,14 @@ CSSMediaRuleInsertRule(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_INSERTRULE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_INSERTRULE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -265,21 +247,14 @@ CSSMediaRuleDeleteRule(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_DELETERULE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSMEDIARULE_DELETERULE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -66,46 +66,34 @@ GetCSSPageRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSPAGERULE_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSPAGERULE_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSPAGERULE_STYLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSPAGERULE_STYLE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetStyle(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
rv = a->GetStyle(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -117,6 +105,8 @@ GetCSSPageRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -134,42 +124,38 @@ SetCSSPageRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSPAGERULE_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSPAGERULE_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSPAGERULE_STYLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSPAGERULE_STYLE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
kICSSStyleDeclarationIID, "CSSStyleDeclaration",
|
||||
cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_OBJECT_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
kICSSStyleDeclarationIID, "CSSStyleDeclaration",
|
||||
cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_OBJECT_ERR;
|
||||
}
|
||||
|
||||
a->SetStyle(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
rv = a->SetStyle(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -180,6 +166,8 @@ SetCSSPageRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,63 +67,46 @@ GetCSSRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSRULE_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSRULE_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint16 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint16 prop;
|
||||
rv = a->GetType(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSRULE_CSSTEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSRULE_CSSTEXT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCssText(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCssText(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSRULE_SHEET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSRULE_SHEET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleSheet* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSheet(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleSheet* prop;
|
||||
rv = a->GetSheet(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -135,6 +118,8 @@ GetCSSRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -152,25 +137,22 @@ SetCSSRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSRULE_CSSTEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSRULE_CSSTEXT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCssText(prop);
|
||||
|
||||
rv = a->SetCssText(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -181,6 +163,8 @@ SetCSSRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,58 +64,42 @@ GetCSSStyleDeclarationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSSTYLEDECLARATION_CSSTEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_CSSTEXT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCssText(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCssText(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSSTYLEDECLARATION_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsAutoString prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +108,8 @@ GetCSSStyleDeclarationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -141,25 +127,22 @@ SetCSSStyleDeclarationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSSTYLEDECLARATION_CSSTEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_CSSTEXT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCssText(prop);
|
||||
|
||||
rv = a->SetCssText(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -170,6 +153,8 @@ SetCSSStyleDeclarationProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -220,21 +205,14 @@ CSSStyleDeclarationGetPropertyValue(JSContext *cx, JSObject *obj, uintN argc, js
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_GETPROPERTYVALUE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_GETPROPERTYVALUE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -269,21 +247,14 @@ CSSStyleDeclarationGetPropertyPriority(JSContext *cx, JSObject *obj, uintN argc,
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_GETPROPERTYPRIORITY, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_GETPROPERTYPRIORITY, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -319,21 +290,14 @@ CSSStyleDeclarationSetProperty(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_SETPROPERTY, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_SETPROPERTY, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 3) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -370,21 +334,14 @@ CSSStyleDeclarationItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLEDECLARATION_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -66,46 +66,34 @@ GetCSSStyleRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSSTYLERULE_SELECTORTEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLERULE_SELECTORTEXT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSelectorText(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSelectorText(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSSTYLERULE_STYLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLERULE_STYLE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetStyle(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
rv = a->GetStyle(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -117,6 +105,8 @@ GetCSSStyleRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -134,42 +124,38 @@ SetCSSStyleRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSSTYLERULE_SELECTORTEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLERULE_SELECTORTEXT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetSelectorText(prop);
|
||||
|
||||
rv = a->SetSelectorText(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSSTYLERULE_STYLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLERULE_STYLE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
kICSSStyleDeclarationIID, "CSSStyleDeclaration",
|
||||
cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_OBJECT_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
|
||||
kICSSStyleDeclarationIID, "CSSStyleDeclaration",
|
||||
cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_OBJECT_ERR;
|
||||
}
|
||||
|
||||
a->SetStyle(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
rv = a->SetStyle(prop);
|
||||
NS_IF_RELEASE(prop);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -180,6 +166,8 @@ SetCSSStyleRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,42 +65,31 @@ GetCSSStyleRuleCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSSTYLERULECOLLECTION_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLERULECOLLECTION_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMCSSStyleRule* prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +98,8 @@ GetCSSStyleRuleCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -126,13 +117,11 @@ SetCSSStyleRuleCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -143,6 +132,8 @@ SetCSSStyleRuleCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -193,21 +184,14 @@ CSSStyleRuleCollectionItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLERULECOLLECTION_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLERULECOLLECTION_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -74,116 +74,84 @@ GetCSSStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case CSSSTYLESHEET_OWNINGNODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_OWNINGNODE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetOwningNode(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
rv = a->GetOwningNode(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSSTYLESHEET_PARENTSTYLESHEET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_PARENTSTYLESHEET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMStyleSheet* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetParentStyleSheet(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMStyleSheet* prop;
|
||||
rv = a->GetParentStyleSheet(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSSTYLESHEET_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_HREF, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSSTYLESHEET_TITLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_TITLE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTitle(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetTitle(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSSTYLESHEET_MEDIA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_MEDIA, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMedia(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMedia(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSSSTYLESHEET_CSSRULES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_CSSRULES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleRuleCollection* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCssRules(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleRuleCollection* prop;
|
||||
rv = a->GetCssRules(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -195,6 +163,8 @@ GetCSSStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -212,13 +182,11 @@ SetCSSStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -229,6 +197,8 @@ SetCSSStyleSheetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -280,21 +250,14 @@ CSSStyleSheetInsertRule(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_INSERTRULE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_INSERTRULE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -331,21 +294,14 @@ CSSStyleSheetDeleteRule(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_DELETERULE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_CSSSTYLESHEET_DELETERULE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -57,13 +57,11 @@ GetCSSUnknownRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -74,6 +72,8 @@ GetCSSUnknownRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -91,13 +91,11 @@ SetCSSUnknownRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -108,6 +106,8 @@ SetCSSUnknownRuleProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,115 +70,83 @@ GetEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case EVENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_TARGET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTarget(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
rv = a->GetTarget(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_CURRENTNODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_CURRENTNODE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCurrentNode(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
rv = a->GetCurrentNode(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_EVENTPHASE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_EVENTPHASE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint16 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetEventPhase(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint16 prop;
|
||||
rv = a->GetEventPhase(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_BUBBLES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_BUBBLES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetBubbles(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetBubbles(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_CANCELABLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_CANCELABLE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCancelable(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetCancelable(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -190,6 +158,8 @@ GetEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -207,13 +177,11 @@ SetEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -224,6 +192,8 @@ SetEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -272,21 +242,14 @@ EventPreventBubble(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_PREVENTBUBBLE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_PREVENTBUBBLE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->PreventBubble();
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -314,21 +277,14 @@ EventPreventCapture(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_PREVENTCAPTURE, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_PREVENTCAPTURE, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->PreventCapture();
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -356,21 +312,14 @@ EventPreventDefault(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_PREVENTDEFAULT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_PREVENTDEFAULT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->PreventDefault();
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -401,21 +350,14 @@ EventInitEvent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_INITEVENT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_EVENT_INITEVENT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 3) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -81,290 +81,216 @@ GetKeyEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case KEYEVENT_CHARCODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_KEYEVENT_CHARCODE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCharCode(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetCharCode(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEYEVENT_KEYCODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_KEYEVENT_KEYCODE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetKeyCode(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetKeyCode(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEYEVENT_ALTKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_KEYEVENT_ALTKEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAltKey(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetAltKey(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEYEVENT_CTRLKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_KEYEVENT_CTRLKEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCtrlKey(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetCtrlKey(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEYEVENT_SHIFTKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_KEYEVENT_SHIFTKEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetShiftKey(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetShiftKey(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEYEVENT_METAKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_KEYEVENT_METAKEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMetaKey(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetMetaKey(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MOUSEEVENT_SCREENX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MOUSEEVENT_SCREENX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetScreenX(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
rv = b->GetScreenX(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MOUSEEVENT_SCREENY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MOUSEEVENT_SCREENY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetScreenY(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
rv = b->GetScreenY(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MOUSEEVENT_CLIENTX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MOUSEEVENT_CLIENTX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetClientX(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
rv = b->GetClientX(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MOUSEEVENT_CLIENTY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MOUSEEVENT_CLIENTY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetClientY(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
rv = b->GetClientY(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MOUSEEVENT_BUTTON:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MOUSEEVENT_BUTTON, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint16 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetButton(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint16 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
rv = b->GetButton(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MOUSEEVENT_CLICKCOUNT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MOUSEEVENT_CLICKCOUNT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint16 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetClickCount(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint16 prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
rv = b->GetClickCount(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MOUSEEVENT_RELATEDNODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MOUSEEVENT_RELATEDNODE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetRelatedNode(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
nsIDOMMouseEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kIMouseEventIID, (void **)&b)) {
|
||||
rv = b->GetRelatedNode(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -375,6 +301,8 @@ GetKeyEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -392,13 +320,11 @@ SetKeyEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -409,6 +335,8 @@ SetKeyEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -467,21 +395,14 @@ KeyEventInitKeyEvent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_KEYEVENT_INITKEYEVENT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_KEYEVENT_INITKEYEVENT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 10) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -561,21 +482,14 @@ MouseEventInitMouseEvent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MOUSEEVENT_INITMOUSEEVENT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_MOUSEEVENT_INITMOUSEEVENT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 11) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -79,273 +79,207 @@ GetUIEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case UIEVENT_VIEW:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_UIEVENT_VIEW, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMAbstractView* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetView(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMAbstractView* prop;
|
||||
rv = a->GetView(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UIEVENT_DETAIL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_UIEVENT_DETAIL, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDetail(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetDetail(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSUIEVENT_LAYERX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_LAYERX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetLayerX(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
rv = b->GetLayerX(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSUIEVENT_LAYERY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_LAYERY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetLayerY(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
rv = b->GetLayerY(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSUIEVENT_PAGEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_PAGEX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetPageX(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
rv = b->GetPageX(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSUIEVENT_PAGEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_PAGEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetPageY(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
rv = b->GetPageY(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSUIEVENT_WHICH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_WHICH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetWhich(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
rv = b->GetWhich(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSUIEVENT_RANGEPARENT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_RANGEPARENT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMNode* prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetRangeParent(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMNode* prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
rv = b->GetRangeParent(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSUIEVENT_RANGEOFFSET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_RANGEOFFSET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetRangeOffset(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
rv = b->GetRangeOffset(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSUIEVENT_CANCELBUBBLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_CANCELBUBBLE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetCancelBubble(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
rv = b->GetCancelBubble(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSUIEVENT_ISCHAR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_ISCHAR, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetIsChar(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
nsIDOMNSUIEvent* b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
rv = b->GetIsChar(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -356,6 +290,8 @@ GetUIEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -373,35 +309,32 @@ SetUIEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case NSUIEVENT_CANCELBUBBLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_CANCELBUBBLE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
nsIDOMNSUIEvent *b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
b->SetCancelBubble(prop);
|
||||
NS_RELEASE(b);
|
||||
nsIDOMNSUIEvent *b;
|
||||
if (NS_OK == a->QueryInterface(kINSUIEventIID, (void **)&b)) {
|
||||
b->SetCancelBubble(prop);
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -412,6 +345,8 @@ SetUIEventProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -465,21 +400,14 @@ UIEventInitUIEvent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_UIEVENT_INITUIEVENT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_UIEVENT_INITUIEVENT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 5) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -534,21 +462,14 @@ NSUIEventGetPreventDefault(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_GETPREVENTDEFAULT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSUIEVENT_GETPREVENTDEFAULT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->GetPreventDefault(&nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -74,215 +74,153 @@ GetHTMLAnchorElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLANCHORELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_ACCESSKEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_CHARSET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_CHARSET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCharset(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCharset(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_COORDS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_COORDS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCoords(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCoords(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_HREF, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_HREFLANG:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_HREFLANG, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHreflang(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHreflang(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_REL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_REL, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetRel(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetRel(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_REV:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_REV, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetRev(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetRev(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_SHAPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_SHAPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetShape(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetShape(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_TABINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_TABINDEX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTabIndex(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetTabIndex(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_TARGET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -294,6 +232,8 @@ GetHTMLAnchorElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -311,174 +251,160 @@ SetHTMLAnchorElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLANCHORELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_ACCESSKEY, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAccessKey(prop);
|
||||
|
||||
rv = a->SetAccessKey(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_CHARSET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_CHARSET, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCharset(prop);
|
||||
|
||||
rv = a->SetCharset(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_COORDS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_COORDS, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCoords(prop);
|
||||
|
||||
rv = a->SetCoords(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_HREF, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHref(prop);
|
||||
|
||||
rv = a->SetHref(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_HREFLANG:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_HREFLANG, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHreflang(prop);
|
||||
|
||||
rv = a->SetHreflang(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_REL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_REL, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetRel(prop);
|
||||
|
||||
rv = a->SetRel(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_REV:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_REV, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetRev(prop);
|
||||
|
||||
rv = a->SetRev(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_SHAPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_SHAPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetShape(prop);
|
||||
|
||||
rv = a->SetShape(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_TABINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_TABINDEX, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetTabIndex(prop);
|
||||
|
||||
rv = a->SetTabIndex(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_TARGET, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetTarget(prop);
|
||||
|
||||
rv = a->SetTarget(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLANCHORELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_TYPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetType(prop);
|
||||
|
||||
rv = a->SetType(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -489,6 +415,8 @@ SetHTMLAnchorElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -537,21 +465,14 @@ HTMLAnchorElementBlur(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_BLUR, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_BLUR, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Blur();
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -579,21 +500,14 @@ HTMLAnchorElementFocus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_FOCUS, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLANCHORELEMENT_FOCUS, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Focus();
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -73,198 +73,141 @@ GetHTMLAppletElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLAPPLETELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_ALIGN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_ALT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_ALT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlt(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlt(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_ARCHIVE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_ARCHIVE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetArchive(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetArchive(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_CODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_CODE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCode(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCode(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_CODEBASE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_CODEBASE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCodeBase(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCodeBase(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_HSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_HSPACE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHspace(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHspace(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_OBJECT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_OBJECT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetObject(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetObject(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_VSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_VSPACE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetVspace(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetVspace(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_WIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -276,6 +219,8 @@ GetHTMLAppletElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -293,155 +238,142 @@ SetHTMLAppletElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLAPPLETELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_ALIGN, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlign(prop);
|
||||
|
||||
rv = a->SetAlign(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_ALT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_ALT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlt(prop);
|
||||
|
||||
rv = a->SetAlt(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_ARCHIVE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_ARCHIVE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetArchive(prop);
|
||||
|
||||
rv = a->SetArchive(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_CODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_CODE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCode(prop);
|
||||
|
||||
rv = a->SetCode(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_CODEBASE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_CODEBASE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCodeBase(prop);
|
||||
|
||||
rv = a->SetCodeBase(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_HEIGHT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHeight(prop);
|
||||
|
||||
rv = a->SetHeight(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_HSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_HSPACE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHspace(prop);
|
||||
|
||||
rv = a->SetHspace(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_OBJECT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_OBJECT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetObject(prop);
|
||||
|
||||
rv = a->SetObject(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_VSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_VSPACE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetVspace(prop);
|
||||
|
||||
rv = a->SetVspace(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAPPLETELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAPPLETELEMENT_WIDTH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetWidth(prop);
|
||||
|
||||
rv = a->SetWidth(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -452,6 +384,8 @@ SetHTMLAppletElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,147 +70,105 @@ GetHTMLAreaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLAREAELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_ACCESSKEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_ALT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_ALT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlt(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlt(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_COORDS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_COORDS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCoords(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCoords(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_HREF, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_NOHREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_NOHREF, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNoHref(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetNoHref(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_SHAPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_SHAPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetShape(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetShape(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_TABINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_TABINDEX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTabIndex(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetTabIndex(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_TARGET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -222,6 +180,8 @@ GetHTMLAreaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -239,124 +199,114 @@ SetHTMLAreaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLAREAELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_ACCESSKEY, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAccessKey(prop);
|
||||
|
||||
rv = a->SetAccessKey(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_ALT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_ALT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlt(prop);
|
||||
|
||||
rv = a->SetAlt(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_COORDS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_COORDS, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCoords(prop);
|
||||
|
||||
rv = a->SetCoords(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_HREF, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHref(prop);
|
||||
|
||||
rv = a->SetHref(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_NOHREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_NOHREF, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetNoHref(prop);
|
||||
|
||||
rv = a->SetNoHref(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_SHAPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_SHAPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetShape(prop);
|
||||
|
||||
rv = a->SetShape(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_TABINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_TABINDEX, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetTabIndex(prop);
|
||||
|
||||
rv = a->SetTabIndex(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLAREAELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLAREAELEMENT_TARGET, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetTarget(prop);
|
||||
|
||||
rv = a->SetTarget(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -367,6 +317,8 @@ SetHTMLAreaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,28 +63,21 @@ GetHTMLBRElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBRELEMENT_CLEAR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBRELEMENT_CLEAR, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetClear(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetClear(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,6 +89,8 @@ GetHTMLBRElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -113,25 +108,22 @@ SetHTMLBRElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBRELEMENT_CLEAR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBRELEMENT_CLEAR, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetClear(prop);
|
||||
|
||||
rv = a->SetClear(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -142,6 +134,8 @@ SetHTMLBRElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,45 +64,33 @@ GetHTMLBaseElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBASEELEMENT_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEELEMENT_HREF, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBASEELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEELEMENT_TARGET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -114,6 +102,8 @@ GetHTMLBaseElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -131,38 +121,34 @@ SetHTMLBaseElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBASEELEMENT_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEELEMENT_HREF, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHref(prop);
|
||||
|
||||
rv = a->SetHref(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBASEELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEELEMENT_TARGET, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetTarget(prop);
|
||||
|
||||
rv = a->SetTarget(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -173,6 +159,8 @@ SetHTMLBaseElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,62 +65,45 @@ GetHTMLBaseFontElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBASEFONTELEMENT_COLOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEFONTELEMENT_COLOR, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetColor(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetColor(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBASEFONTELEMENT_FACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEFONTELEMENT_FACE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetFace(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetFace(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBASEFONTELEMENT_SIZE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEFONTELEMENT_SIZE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSize(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSize(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -132,6 +115,8 @@ GetHTMLBaseFontElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -149,51 +134,46 @@ SetHTMLBaseFontElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBASEFONTELEMENT_COLOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEFONTELEMENT_COLOR, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetColor(prop);
|
||||
|
||||
rv = a->SetColor(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBASEFONTELEMENT_FACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEFONTELEMENT_FACE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetFace(prop);
|
||||
|
||||
rv = a->SetFace(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBASEFONTELEMENT_SIZE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBASEFONTELEMENT_SIZE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetSize(prop);
|
||||
|
||||
rv = a->SetSize(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -204,6 +184,8 @@ SetHTMLBaseFontElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,113 +68,81 @@ GetHTMLBodyElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBODYELEMENT_ALINK:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_ALINK, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetALink(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetALink(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_BACKGROUND:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_BACKGROUND, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetBackground(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetBackground(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_BGCOLOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_BGCOLOR, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetBgColor(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetBgColor(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_LINK:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_LINK, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLink(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetLink(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_TEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_TEXT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetText(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetText(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_VLINK:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_VLINK, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetVLink(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetVLink(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -186,6 +154,8 @@ GetHTMLBodyElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -203,90 +173,82 @@ SetHTMLBodyElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBODYELEMENT_ALINK:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_ALINK, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetALink(prop);
|
||||
|
||||
rv = a->SetALink(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_BACKGROUND:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_BACKGROUND, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetBackground(prop);
|
||||
|
||||
rv = a->SetBackground(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_BGCOLOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_BGCOLOR, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetBgColor(prop);
|
||||
|
||||
rv = a->SetBgColor(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_LINK:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_LINK, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetLink(prop);
|
||||
|
||||
rv = a->SetLink(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_TEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_TEXT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetText(prop);
|
||||
|
||||
rv = a->SetText(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBODYELEMENT_VLINK:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBODYELEMENT_VLINK, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetVLink(prop);
|
||||
|
||||
rv = a->SetVLink(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -297,6 +259,8 @@ SetHTMLBodyElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,131 +73,94 @@ GetHTMLButtonElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBUTTONELEMENT_FORM:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_FORM, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
rv = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_ACCESSKEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_DISABLED, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_TABINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_TABINDEX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTabIndex(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetTabIndex(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_VALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_VALUE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetValue(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetValue(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -209,6 +172,8 @@ GetHTMLButtonElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -226,85 +191,78 @@ SetHTMLButtonElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLBUTTONELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_ACCESSKEY, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAccessKey(prop);
|
||||
|
||||
rv = a->SetAccessKey(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_DISABLED, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetDisabled(prop);
|
||||
|
||||
rv = a->SetDisabled(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_TABINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_TABINDEX, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetTabIndex(prop);
|
||||
|
||||
rv = a->SetTabIndex(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLBUTTONELEMENT_VALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLBUTTONELEMENT_VALUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetValue(prop);
|
||||
|
||||
rv = a->SetValue(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -315,6 +273,8 @@ SetHTMLButtonElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -368,21 +328,14 @@ NSHTMLButtonElementBlur(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLBUTTONELEMENT_BLUR, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLBUTTONELEMENT_BLUR, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Blur();
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -415,21 +368,14 @@ NSHTMLButtonElementFocus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLBUTTONELEMENT_FOCUS, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLBUTTONELEMENT_FOCUS, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Focus();
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -66,43 +66,32 @@ GetHTMLCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLCOLLECTION_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLCOLLECTION_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMNode* prop;
|
||||
result = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = a->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,8 +113,8 @@ GetHTMLCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
result = a->NamedItem(name, &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
if (NULL != prop) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
|
@ -139,6 +128,8 @@ GetHTMLCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -157,13 +148,11 @@ SetHTMLCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
|
@ -175,6 +164,8 @@ SetHTMLCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -225,21 +216,14 @@ HTMLCollectionItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLCOLLECTION_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLCOLLECTION_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
@ -276,21 +260,14 @@ HTMLCollectionNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLCOLLECTION_NAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLCOLLECTION_NAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -63,28 +63,21 @@ GetHTMLDListElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLDLISTELEMENT_COMPACT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLDLISTELEMENT_COMPACT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCompact(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetCompact(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,6 +89,8 @@ GetHTMLDListElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -113,27 +108,24 @@ SetHTMLDListElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLDLISTELEMENT_COMPACT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLDLISTELEMENT_COMPACT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetCompact(prop);
|
||||
|
||||
rv = a->SetCompact(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -144,6 +136,8 @@ SetHTMLDListElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,28 +63,21 @@ GetHTMLDirectoryElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLDIRECTORYELEMENT_COMPACT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLDIRECTORYELEMENT_COMPACT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCompact(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetCompact(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,6 +89,8 @@ GetHTMLDirectoryElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -113,27 +108,24 @@ SetHTMLDirectoryElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLDIRECTORYELEMENT_COMPACT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLDIRECTORYELEMENT_COMPACT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetCompact(prop);
|
||||
|
||||
rv = a->SetCompact(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -144,6 +136,8 @@ SetHTMLDirectoryElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *v
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,28 +63,21 @@ GetHTMLDivElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLDIVELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLDIVELEMENT_ALIGN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,6 +89,8 @@ GetHTMLDivElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -113,25 +108,22 @@ SetHTMLDivElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLDIVELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLDIVELEMENT_ALIGN, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlign(prop);
|
||||
|
||||
rv = a->SetAlign(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -142,6 +134,8 @@ SetHTMLDivElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -77,200 +77,143 @@ GetHTMLElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLELEMENT_ID:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_ID, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetId(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetId(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_TITLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_TITLE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTitle(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetTitle(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_LANG:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_LANG, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLang(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetLang(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_DIR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_DIR, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDir(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetDir(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_CLASSNAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_CLASSNAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetClassName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetClassName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_STYLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_STYLE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetStyle(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMCSSStyleDeclaration* prop;
|
||||
rv = a->GetStyle(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_OFFSETTOP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_OFFSETTOP, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetOffsetTop(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetOffsetTop(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_OFFSETLEFT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_OFFSETLEFT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetOffsetLeft(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetOffsetLeft(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_OFFSETWIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_OFFSETWIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetOffsetWidth(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetOffsetWidth(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_OFFSETHEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_OFFSETHEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetOffsetHeight(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetOffsetHeight(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_OFFSETPARENT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_OFFSETPARENT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMElement* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetOffsetParent(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMElement* prop;
|
||||
rv = a->GetOffsetParent(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -282,6 +225,8 @@ GetHTMLElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -299,77 +244,70 @@ SetHTMLElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLELEMENT_ID:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_ID, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetId(prop);
|
||||
|
||||
rv = a->SetId(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_TITLE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_TITLE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetTitle(prop);
|
||||
|
||||
rv = a->SetTitle(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_LANG:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_LANG, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetLang(prop);
|
||||
|
||||
rv = a->SetLang(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_DIR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_DIR, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetDir(prop);
|
||||
|
||||
rv = a->SetDir(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLELEMENT_CLASSNAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLELEMENT_CLASSNAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetClassName(prop);
|
||||
|
||||
rv = a->SetClassName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -380,6 +318,8 @@ SetHTMLElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,113 +74,81 @@ GetHTMLEmbedElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLEMBEDELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_ALIGN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_SRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_SRC, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSrc(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSrc(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_WIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -192,6 +160,8 @@ GetHTMLEmbedElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -209,90 +179,82 @@ SetHTMLEmbedElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLEMBEDELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_ALIGN, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlign(prop);
|
||||
|
||||
rv = a->SetAlign(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_HEIGHT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHeight(prop);
|
||||
|
||||
rv = a->SetHeight(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_SRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_SRC, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetSrc(prop);
|
||||
|
||||
rv = a->SetSrc(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_TYPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetType(prop);
|
||||
|
||||
rv = a->SetType(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLEMBEDELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLEMBEDELEMENT_WIDTH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetWidth(prop);
|
||||
|
||||
rv = a->SetWidth(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -303,6 +265,8 @@ SetHTMLEmbedElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,29 +65,22 @@ GetHTMLFieldSetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLFIELDSETELEMENT_FORM:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFIELDSETELEMENT_FORM, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
rv = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -99,6 +92,8 @@ GetHTMLFieldSetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -116,13 +111,11 @@ SetHTMLFieldSetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
|
@ -133,6 +126,8 @@ SetHTMLFieldSetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,62 +65,45 @@ GetHTMLFontElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLFONTELEMENT_COLOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFONTELEMENT_COLOR, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetColor(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetColor(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFONTELEMENT_FACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFONTELEMENT_FACE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetFace(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetFace(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFONTELEMENT_SIZE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFONTELEMENT_SIZE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSize(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSize(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -132,6 +115,8 @@ GetHTMLFontElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -149,51 +134,46 @@ SetHTMLFontElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLFONTELEMENT_COLOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFONTELEMENT_COLOR, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetColor(prop);
|
||||
|
||||
rv = a->SetColor(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFONTELEMENT_FACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFONTELEMENT_FACE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetFace(prop);
|
||||
|
||||
rv = a->SetFace(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFONTELEMENT_SIZE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFONTELEMENT_SIZE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetSize(prop);
|
||||
|
||||
rv = a->SetSize(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -204,6 +184,8 @@ SetHTMLFontElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,37 +58,30 @@ GetHTMLFormControlListProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
result = a->Item(cx, &id, 1, vp);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
rv = a->Item(cx, &id, 1, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (checkNamedItem) {
|
||||
nsresult result = a->NamedItem(cx, &id, 1, vp);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
rv = a->NamedItem(cx, &id, 1, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -107,13 +100,11 @@ SetHTMLFormControlListProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
|
@ -125,6 +116,8 @@ SetHTMLFormControlListProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -174,21 +167,14 @@ HTMLFormControlListNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *ar
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMCONTROLLIST_NAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMCONTROLLIST_NAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->NamedItem(cx, argv+0, argc-0, &nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -217,21 +203,14 @@ HTMLFormControlListItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMCONTROLLIST_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMCONTROLLIST_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Item(cx, argv+0, argc-0, &nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
|
@ -78,175 +78,127 @@ GetHTMLFormElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLFORMELEMENT_ELEMENTS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_ELEMENTS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMHTMLCollection* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetElements(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMHTMLCollection* prop;
|
||||
rv = a->GetElements(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_LENGTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_LENGTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRUint32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRUint32 prop;
|
||||
rv = a->GetLength(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_ACCEPTCHARSET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_ACCEPTCHARSET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAcceptCharset(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAcceptCharset(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_ACTION:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_ACTION, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAction(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAction(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_ENCTYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_ENCTYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetEnctype(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetEnctype(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_METHOD:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_METHOD, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMethod(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMethod(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_TARGET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSHTMLFORMELEMENT_ENCODING:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLFORMELEMENT_ENCODING, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsIDOMNSHTMLFormElement* b;
|
||||
if (NS_OK == a->QueryInterface(kINSHTMLFormElementIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetEncoding(prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsIDOMNSHTMLFormElement* b;
|
||||
if (NS_OK == a->QueryInterface(kINSHTMLFormElementIID, (void **)&b)) {
|
||||
rv = b->GetEncoding(prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -255,19 +207,15 @@ GetHTMLFormElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
nsIDOMNSHTMLFormElement* b;
|
||||
if (NS_OK == a->QueryInterface(kINSHTMLFormElementIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = b->Item(JSVAL_TO_INT(id), &prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,6 +239,8 @@ GetHTMLFormElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -309,91 +259,83 @@ SetHTMLFormElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
|
||||
PRBool checkNamedItem = PR_TRUE;
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
checkNamedItem = PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLFORMELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_ACCEPTCHARSET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_ACCEPTCHARSET, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAcceptCharset(prop);
|
||||
|
||||
rv = a->SetAcceptCharset(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_ACTION:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_ACTION, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAction(prop);
|
||||
|
||||
rv = a->SetAction(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_ENCTYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_ENCTYPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetEnctype(prop);
|
||||
|
||||
rv = a->SetEnctype(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_METHOD:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_METHOD, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetMethod(prop);
|
||||
|
||||
rv = a->SetMethod(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFORMELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_TARGET, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetTarget(prop);
|
||||
|
||||
rv = a->SetTarget(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -404,6 +346,8 @@ SetHTMLFormElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -452,21 +396,14 @@ HTMLFormElementSubmit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_SUBMIT, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_SUBMIT, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Submit();
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -494,21 +431,14 @@ HTMLFormElementReset(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_RESET, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFORMELEMENT_RESET, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->Reset();
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -542,21 +472,14 @@ NSHTMLFormElementNamedItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLFORMELEMENT_NAMEDITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLFORMELEMENT_NAMEDITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = nativeThis->NamedItem(cx, argv+0, argc-0, &nativeRet);
|
||||
if (NS_FAILED(result)) {
|
||||
|
@ -591,21 +514,14 @@ NSHTMLFormElementItem(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
}
|
||||
|
||||
{
|
||||
|
||||
*rval = JSVAL_NULL;
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLFORMELEMENT_ITEM, PR_FALSE);
|
||||
*rval = JSVAL_NULL;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLFORMELEMENT_ITEM, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
|
||||
}
|
||||
|
|
|
@ -70,147 +70,105 @@ GetHTMLFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLFRAMEELEMENT_FRAMEBORDER:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_FRAMEBORDER, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetFrameBorder(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetFrameBorder(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_LONGDESC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_LONGDESC, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLongDesc(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetLongDesc(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_MARGINHEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_MARGINHEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMarginHeight(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMarginHeight(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_MARGINWIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_MARGINWIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMarginWidth(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMarginWidth(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_NORESIZE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_NORESIZE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNoResize(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetNoResize(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_SCROLLING:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_SCROLLING, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetScrolling(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetScrolling(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_SRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_SRC, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSrc(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSrc(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -222,6 +180,8 @@ GetHTMLFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -239,118 +199,108 @@ SetHTMLFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLFRAMEELEMENT_FRAMEBORDER:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_FRAMEBORDER, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetFrameBorder(prop);
|
||||
|
||||
rv = a->SetFrameBorder(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_LONGDESC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_LONGDESC, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetLongDesc(prop);
|
||||
|
||||
rv = a->SetLongDesc(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_MARGINHEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_MARGINHEIGHT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetMarginHeight(prop);
|
||||
|
||||
rv = a->SetMarginHeight(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_MARGINWIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_MARGINWIDTH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetMarginWidth(prop);
|
||||
|
||||
rv = a->SetMarginWidth(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_NORESIZE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_NORESIZE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetNoResize(prop);
|
||||
|
||||
rv = a->SetNoResize(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_SCROLLING:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_SCROLLING, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetScrolling(prop);
|
||||
|
||||
rv = a->SetScrolling(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMEELEMENT_SRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMEELEMENT_SRC, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetSrc(prop);
|
||||
|
||||
rv = a->SetSrc(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -361,6 +311,8 @@ SetHTMLFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,45 +64,33 @@ GetHTMLFrameSetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLFRAMESETELEMENT_COLS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMESETELEMENT_COLS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCols(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCols(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMESETELEMENT_ROWS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMESETELEMENT_ROWS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetRows(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetRows(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -114,6 +102,8 @@ GetHTMLFrameSetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -131,38 +121,34 @@ SetHTMLFrameSetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLFRAMESETELEMENT_COLS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMESETELEMENT_COLS, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCols(prop);
|
||||
|
||||
rv = a->SetCols(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLFRAMESETELEMENT_ROWS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLFRAMESETELEMENT_ROWS, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetRows(prop);
|
||||
|
||||
rv = a->SetRows(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -173,6 +159,8 @@ SetHTMLFrameSetElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,79 +66,57 @@ GetHTMLHRElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLHRELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHRELEMENT_ALIGN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLHRELEMENT_NOSHADE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHRELEMENT_NOSHADE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetNoShade(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetNoShade(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLHRELEMENT_SIZE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHRELEMENT_SIZE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSize(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSize(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLHRELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHRELEMENT_WIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -150,6 +128,8 @@ GetHTMLHRElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -167,66 +147,60 @@ SetHTMLHRElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLHRELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHRELEMENT_ALIGN, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlign(prop);
|
||||
|
||||
rv = a->SetAlign(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLHRELEMENT_NOSHADE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHRELEMENT_NOSHADE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetNoShade(prop);
|
||||
|
||||
rv = a->SetNoShade(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLHRELEMENT_SIZE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHRELEMENT_SIZE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetSize(prop);
|
||||
|
||||
rv = a->SetSize(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLHRELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHRELEMENT_WIDTH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetWidth(prop);
|
||||
|
||||
rv = a->SetWidth(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -237,6 +211,8 @@ SetHTMLHRElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,28 +63,21 @@ GetHTMLHeadElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLHEADELEMENT_PROFILE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHEADELEMENT_PROFILE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetProfile(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetProfile(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,6 +89,8 @@ GetHTMLHeadElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -113,25 +108,22 @@ SetHTMLHeadElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLHEADELEMENT_PROFILE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHEADELEMENT_PROFILE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetProfile(prop);
|
||||
|
||||
rv = a->SetProfile(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -142,6 +134,8 @@ SetHTMLHeadElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,28 +63,21 @@ GetHTMLHeadingElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLHEADINGELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHEADINGELEMENT_ALIGN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,6 +89,8 @@ GetHTMLHeadingElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -113,25 +108,22 @@ SetHTMLHeadingElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLHEADINGELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHEADINGELEMENT_ALIGN, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlign(prop);
|
||||
|
||||
rv = a->SetAlign(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -142,6 +134,8 @@ SetHTMLHeadingElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,28 +63,21 @@ GetHTMLHtmlElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLHTMLELEMENT_VERSION:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHTMLELEMENT_VERSION, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetVersion(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetVersion(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,6 +89,8 @@ GetHTMLHtmlElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -113,25 +108,22 @@ SetHTMLHtmlElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLHTMLELEMENT_VERSION:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLHTMLELEMENT_VERSION, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetVersion(prop);
|
||||
|
||||
rv = a->SetVersion(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -142,6 +134,8 @@ SetHTMLHtmlElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,181 +72,129 @@ GetHTMLIFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLIFRAMEELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_ALIGN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_FRAMEBORDER:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_FRAMEBORDER, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetFrameBorder(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetFrameBorder(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_LONGDESC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_LONGDESC, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLongDesc(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetLongDesc(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_MARGINHEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_MARGINHEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMarginHeight(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMarginHeight(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_MARGINWIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_MARGINWIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMarginWidth(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMarginWidth(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_SCROLLING:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_SCROLLING, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetScrolling(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetScrolling(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_SRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_SRC, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSrc(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetSrc(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_WIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -258,6 +206,8 @@ GetHTMLIFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -275,142 +225,130 @@ SetHTMLIFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLIFRAMEELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_ALIGN, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlign(prop);
|
||||
|
||||
rv = a->SetAlign(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_FRAMEBORDER:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_FRAMEBORDER, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetFrameBorder(prop);
|
||||
|
||||
rv = a->SetFrameBorder(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_HEIGHT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHeight(prop);
|
||||
|
||||
rv = a->SetHeight(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_LONGDESC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_LONGDESC, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetLongDesc(prop);
|
||||
|
||||
rv = a->SetLongDesc(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_MARGINHEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_MARGINHEIGHT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetMarginHeight(prop);
|
||||
|
||||
rv = a->SetMarginHeight(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_MARGINWIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_MARGINWIDTH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetMarginWidth(prop);
|
||||
|
||||
rv = a->SetMarginWidth(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_SCROLLING:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_SCROLLING, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetScrolling(prop);
|
||||
|
||||
rv = a->SetScrolling(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_SRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_SRC, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetSrc(prop);
|
||||
|
||||
rv = a->SetSrc(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIFRAMEELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIFRAMEELEMENT_WIDTH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetWidth(prop);
|
||||
|
||||
rv = a->SetWidth(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -421,6 +359,8 @@ SetHTMLIFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,266 +82,192 @@ GetHTMLImageElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLIMAGEELEMENT_LOWSRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_LOWSRC, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLowSrc(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetLowSrc(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALIGN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_ALT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlt(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlt(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_BORDER:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_BORDER, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetBorder(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetBorder(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_HSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HSPACE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHspace(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHspace(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_ISMAP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ISMAP, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetIsMap(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetIsMap(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_LONGDESC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_LONGDESC, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLongDesc(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetLongDesc(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_USEMAP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_USEMAP, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetUseMap(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetUseMap(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_VSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_VSPACE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetVspace(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetVspace(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_WIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IMAGE_LOWSRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_IMAGE_LOWSRC, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsIDOMImage* b;
|
||||
if (NS_OK == a->QueryInterface(kIImageIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetLowsrc(prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsIDOMImage* b;
|
||||
if (NS_OK == a->QueryInterface(kIImageIID, (void **)&b)) {
|
||||
rv = b->GetLowsrc(prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IMAGE_COMPLETE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_IMAGE_COMPLETE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsIDOMImage* b;
|
||||
if (NS_OK == a->QueryInterface(kIImageIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetComplete(&prop);
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
nsIDOMImage* b;
|
||||
if (NS_OK == a->QueryInterface(kIImageIID, (void **)&b)) {
|
||||
rv = b->GetComplete(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(b);
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -352,6 +278,8 @@ GetHTMLImageElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -369,191 +297,176 @@ SetHTMLImageElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLIMAGEELEMENT_LOWSRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_LOWSRC, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetLowSrc(prop);
|
||||
|
||||
rv = a->SetLowSrc(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALIGN, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlign(prop);
|
||||
|
||||
rv = a->SetAlign(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_ALT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlt(prop);
|
||||
|
||||
rv = a->SetAlt(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_BORDER:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_BORDER, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetBorder(prop);
|
||||
|
||||
rv = a->SetBorder(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HEIGHT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHeight(prop);
|
||||
|
||||
rv = a->SetHeight(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_HSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HSPACE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHspace(prop);
|
||||
|
||||
rv = a->SetHspace(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_ISMAP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ISMAP, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetIsMap(prop);
|
||||
|
||||
rv = a->SetIsMap(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_LONGDESC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_LONGDESC, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetLongDesc(prop);
|
||||
|
||||
rv = a->SetLongDesc(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_USEMAP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_USEMAP, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetUseMap(prop);
|
||||
|
||||
rv = a->SetUseMap(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_VSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_VSPACE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetVspace(prop);
|
||||
|
||||
rv = a->SetVspace(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLIMAGEELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_WIDTH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetWidth(prop);
|
||||
|
||||
rv = a->SetWidth(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IMAGE_LOWSRC:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_IMAGE_LOWSRC, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
nsIDOMImage *b;
|
||||
if (NS_OK == a->QueryInterface(kIImageIID, (void **)&b)) {
|
||||
b->SetLowsrc(prop);
|
||||
NS_RELEASE(b);
|
||||
nsIDOMImage *b;
|
||||
if (NS_OK == a->QueryInterface(kIImageIID, (void **)&b)) {
|
||||
b->SetLowsrc(prop);
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -564,6 +477,8 @@ SetHTMLImageElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -66,46 +66,34 @@ GetHTMLIsIndexElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLISINDEXELEMENT_FORM:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLISINDEXELEMENT_FORM, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
rv = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLISINDEXELEMENT_PROMPT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLISINDEXELEMENT_PROMPT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetPrompt(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetPrompt(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -117,6 +105,8 @@ GetHTMLIsIndexElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -134,25 +124,22 @@ SetHTMLIsIndexElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLISINDEXELEMENT_PROMPT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLISINDEXELEMENT_PROMPT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetPrompt(prop);
|
||||
|
||||
rv = a->SetPrompt(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -163,6 +150,8 @@ SetHTMLIsIndexElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,45 +64,33 @@ GetHTMLLIElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLIELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLIELEMENT_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLIELEMENT_VALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLIELEMENT_VALUE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetValue(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetValue(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -114,6 +102,8 @@ GetHTMLLIElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -131,44 +121,40 @@ SetHTMLLIElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLIELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLIELEMENT_TYPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetType(prop);
|
||||
|
||||
rv = a->SetType(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLIELEMENT_VALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLIELEMENT_VALUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetValue(prop);
|
||||
|
||||
rv = a->SetValue(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -179,6 +165,8 @@ SetHTMLLIElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,63 +67,46 @@ GetHTMLLabelElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLABELELEMENT_FORM:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLABELELEMENT_FORM, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
rv = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLABELELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLABELELEMENT_ACCESSKEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLABELELEMENT_HTMLFOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLABELELEMENT_HTMLFOR, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHtmlFor(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHtmlFor(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -135,6 +118,8 @@ GetHTMLLabelElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -152,38 +137,34 @@ SetHTMLLabelElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLABELELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLABELELEMENT_ACCESSKEY, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAccessKey(prop);
|
||||
|
||||
rv = a->SetAccessKey(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLABELELEMENT_HTMLFOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLABELELEMENT_HTMLFOR, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHtmlFor(prop);
|
||||
|
||||
rv = a->SetHtmlFor(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -194,6 +175,8 @@ SetHTMLLabelElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,148 +72,106 @@ GetHTMLLayerElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLAYERELEMENT_TOP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_TOP, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTop(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetTop(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_LEFT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_LEFT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLeft(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetLeft(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_VISIBILITY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_VISIBILITY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetVisibility(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetVisibility(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_BACKGROUND:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_BACKGROUND, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetBackground(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetBackground(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_BGCOLOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_BGCOLOR, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetBgColor(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetBgColor(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_ZINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_ZINDEX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetZIndex(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetZIndex(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_DOCUMENT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_DOCUMENT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMDocument* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDocument(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMDocument* prop;
|
||||
rv = a->GetDocument(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -225,6 +183,8 @@ GetHTMLLayerElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -242,121 +202,112 @@ SetHTMLLayerElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLAYERELEMENT_TOP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_TOP, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetTop(prop);
|
||||
|
||||
rv = a->SetTop(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_LEFT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_LEFT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetLeft(prop);
|
||||
|
||||
rv = a->SetLeft(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_VISIBILITY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_VISIBILITY, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetVisibility(prop);
|
||||
|
||||
rv = a->SetVisibility(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_BACKGROUND:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_BACKGROUND, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetBackground(prop);
|
||||
|
||||
rv = a->SetBackground(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_BGCOLOR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_BGCOLOR, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetBgColor(prop);
|
||||
|
||||
rv = a->SetBgColor(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLAYERELEMENT_ZINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLAYERELEMENT_ZINDEX, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetZIndex(prop);
|
||||
|
||||
rv = a->SetZIndex(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -367,6 +318,8 @@ SetHTMLLayerElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,63 +67,46 @@ GetHTMLLegendElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLEGENDELEMENT_FORM:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLEGENDELEMENT_FORM, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
rv = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLEGENDELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLEGENDELEMENT_ACCESSKEY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAccessKey(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLEGENDELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLEGENDELEMENT_ALIGN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -135,6 +118,8 @@ GetHTMLLegendElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -152,38 +137,34 @@ SetHTMLLegendElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLEGENDELEMENT_ACCESSKEY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLEGENDELEMENT_ACCESSKEY, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAccessKey(prop);
|
||||
|
||||
rv = a->SetAccessKey(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLEGENDELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLEGENDELEMENT_ALIGN, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlign(prop);
|
||||
|
||||
rv = a->SetAlign(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -194,6 +175,8 @@ SetHTMLLegendElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,164 +71,117 @@ GetHTMLLinkElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLINKELEMENT_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_DISABLED, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_CHARSET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_CHARSET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCharset(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCharset(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_HREF, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHref(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_HREFLANG:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_HREFLANG, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHreflang(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHreflang(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_MEDIA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_MEDIA, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetMedia(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetMedia(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_REL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_REL, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetRel(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetRel(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_REV:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_REV, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetRev(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetRev(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_TARGET, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetTarget(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -240,6 +193,8 @@ GetHTMLLinkElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -257,131 +212,120 @@ SetHTMLLinkElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLLINKELEMENT_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_DISABLED, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetDisabled(prop);
|
||||
|
||||
rv = a->SetDisabled(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_CHARSET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_CHARSET, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCharset(prop);
|
||||
|
||||
rv = a->SetCharset(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_HREF:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_HREF, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHref(prop);
|
||||
|
||||
rv = a->SetHref(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_HREFLANG:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_HREFLANG, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHreflang(prop);
|
||||
|
||||
rv = a->SetHreflang(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_MEDIA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_MEDIA, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetMedia(prop);
|
||||
|
||||
rv = a->SetMedia(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_REL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_REL, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetRel(prop);
|
||||
|
||||
rv = a->SetRel(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_REV:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_REV, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetRev(prop);
|
||||
|
||||
rv = a->SetRev(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_TARGET:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_TARGET, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetTarget(prop);
|
||||
|
||||
rv = a->SetTarget(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLLINKELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLLINKELEMENT_TYPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetType(prop);
|
||||
|
||||
rv = a->SetType(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -392,6 +336,8 @@ SetHTMLLinkElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,46 +66,34 @@ GetHTMLMapElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLMAPELEMENT_AREAS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMAPELEMENT_AREAS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMHTMLCollection* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAreas(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMHTMLCollection* prop;
|
||||
rv = a->GetAreas(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLMAPELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMAPELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -117,6 +105,8 @@ GetHTMLMapElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -134,25 +124,22 @@ SetHTMLMapElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLMAPELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMAPELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -163,6 +150,8 @@ SetHTMLMapElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,28 +63,21 @@ GetHTMLMenuElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLMENUELEMENT_COMPACT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMENUELEMENT_COMPACT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCompact(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetCompact(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -96,6 +89,8 @@ GetHTMLMenuElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -113,27 +108,24 @@ SetHTMLMenuElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLMENUELEMENT_COMPACT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMENUELEMENT_COMPACT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetCompact(prop);
|
||||
|
||||
rv = a->SetCompact(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -144,6 +136,8 @@ SetHTMLMenuElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,79 +66,57 @@ GetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLMETAELEMENT_CONTENT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMETAELEMENT_CONTENT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetContent(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetContent(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLMETAELEMENT_HTTPEQUIV:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMETAELEMENT_HTTPEQUIV, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHttpEquiv(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHttpEquiv(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLMETAELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMETAELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLMETAELEMENT_SCHEME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMETAELEMENT_SCHEME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetScheme(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetScheme(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -150,6 +128,8 @@ GetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -167,64 +147,58 @@ SetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLMETAELEMENT_CONTENT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMETAELEMENT_CONTENT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetContent(prop);
|
||||
|
||||
rv = a->SetContent(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLMETAELEMENT_HTTPEQUIV:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMETAELEMENT_HTTPEQUIV, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHttpEquiv(prop);
|
||||
|
||||
rv = a->SetHttpEquiv(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLMETAELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMETAELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLMETAELEMENT_SCHEME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMETAELEMENT_SCHEME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetScheme(prop);
|
||||
|
||||
rv = a->SetScheme(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -235,6 +209,8 @@ SetHTMLMetaElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,45 +64,33 @@ GetHTMLModElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLMODELEMENT_CITE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMODELEMENT_CITE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCite(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCite(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLMODELEMENT_DATETIME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMODELEMENT_DATETIME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDateTime(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetDateTime(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -114,6 +102,8 @@ GetHTMLModElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -131,38 +121,34 @@ SetHTMLModElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLMODELEMENT_CITE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMODELEMENT_CITE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCite(prop);
|
||||
|
||||
rv = a->SetCite(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLMODELEMENT_DATETIME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLMODELEMENT_DATETIME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetDateTime(prop);
|
||||
|
||||
rv = a->SetDateTime(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -173,6 +159,8 @@ SetHTMLModElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,62 +65,45 @@ GetHTMLOListElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLOLISTELEMENT_COMPACT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOLISTELEMENT_COMPACT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCompact(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetCompact(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOLISTELEMENT_START:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOLISTELEMENT_START, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetStart(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetStart(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOLISTELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOLISTELEMENT_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -132,6 +115,8 @@ GetHTMLOListElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -149,59 +134,54 @@ SetHTMLOListElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLOLISTELEMENT_COMPACT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOLISTELEMENT_COMPACT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetCompact(prop);
|
||||
|
||||
rv = a->SetCompact(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOLISTELEMENT_START:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOLISTELEMENT_START, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetStart(prop);
|
||||
|
||||
rv = a->SetStart(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOLISTELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOLISTELEMENT_TYPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetType(prop);
|
||||
|
||||
rv = a->SetType(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -212,6 +192,8 @@ SetHTMLOListElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,318 +82,226 @@ GetHTMLObjectElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLOBJECTELEMENT_FORM:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_FORM, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
rv = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_CODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_CODE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCode(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCode(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_ALIGN, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetAlign(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_ARCHIVE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_ARCHIVE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetArchive(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetArchive(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_BORDER:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_BORDER, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetBorder(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetBorder(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_CODEBASE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_CODEBASE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCodeBase(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCodeBase(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_CODETYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_CODETYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetCodeType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetCodeType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_DATA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_DATA, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetData(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetData(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_DECLARE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_DECLARE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDeclare(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetDeclare(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_HEIGHT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHeight(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_HSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_HSPACE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetHspace(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetHspace(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_NAME, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetName(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_STANDBY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_STANDBY, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetStandby(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetStandby(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_TABINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_TABINDEX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetTabIndex(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetTabIndex(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_TYPE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetType(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_USEMAP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_USEMAP, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetUseMap(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetUseMap(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_VSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_VSPACE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetVspace(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetVspace(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_WIDTH, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetWidth(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -405,6 +313,8 @@ GetHTMLObjectElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -422,241 +332,222 @@ SetHTMLObjectElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLOBJECTELEMENT_CODE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_CODE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCode(prop);
|
||||
|
||||
rv = a->SetCode(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_ALIGN:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_ALIGN, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAlign(prop);
|
||||
|
||||
rv = a->SetAlign(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_ARCHIVE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_ARCHIVE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetArchive(prop);
|
||||
|
||||
rv = a->SetArchive(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_BORDER:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_BORDER, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetBorder(prop);
|
||||
|
||||
rv = a->SetBorder(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_CODEBASE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_CODEBASE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCodeBase(prop);
|
||||
|
||||
rv = a->SetCodeBase(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_CODETYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_CODETYPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetCodeType(prop);
|
||||
|
||||
rv = a->SetCodeType(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_DATA:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_DATA, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetData(prop);
|
||||
|
||||
rv = a->SetData(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_DECLARE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_DECLARE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetDeclare(prop);
|
||||
|
||||
rv = a->SetDeclare(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_HEIGHT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_HEIGHT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHeight(prop);
|
||||
|
||||
rv = a->SetHeight(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_HSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_HSPACE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetHspace(prop);
|
||||
|
||||
rv = a->SetHspace(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_NAME:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_NAME, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetName(prop);
|
||||
|
||||
rv = a->SetName(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_STANDBY:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_STANDBY, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetStandby(prop);
|
||||
|
||||
rv = a->SetStandby(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_TABINDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_TABINDEX, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetTabIndex(prop);
|
||||
|
||||
rv = a->SetTabIndex(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_TYPE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_TYPE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetType(prop);
|
||||
|
||||
rv = a->SetType(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_USEMAP:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_USEMAP, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetUseMap(prop);
|
||||
|
||||
rv = a->SetUseMap(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_VSPACE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_VSPACE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetVspace(prop);
|
||||
|
||||
rv = a->SetVspace(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOBJECTELEMENT_WIDTH:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_WIDTH, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetWidth(prop);
|
||||
|
||||
rv = a->SetWidth(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -667,6 +558,8 @@ SetHTMLObjectElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,45 +64,33 @@ GetHTMLOptGroupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLOPTGROUPELEMENT_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTGROUPELEMENT_DISABLED, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTGROUPELEMENT_LABEL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTGROUPELEMENT_LABEL, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLabel(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetLabel(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -114,6 +102,8 @@ GetHTMLOptGroupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -131,40 +121,36 @@ SetHTMLOptGroupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLOPTGROUPELEMENT_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTGROUPELEMENT_DISABLED, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetDisabled(prop);
|
||||
|
||||
rv = a->SetDisabled(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTGROUPELEMENT_LABEL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTGROUPELEMENT_LABEL, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetLabel(prop);
|
||||
|
||||
rv = a->SetLabel(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -175,6 +161,8 @@ SetHTMLOptGroupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,148 +78,106 @@ GetHTMLOptionElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLOPTIONELEMENT_FORM:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_FORM, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMHTMLFormElement* prop;
|
||||
rv = a->GetForm(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_DEFAULTSELECTED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_DEFAULTSELECTED, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDefaultSelected(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetDefaultSelected(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_TEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_TEXT, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetText(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetText(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_INDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_INDEX, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetIndex(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
rv = a->GetIndex(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_DISABLED, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetDisabled(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_LABEL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_LABEL, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetLabel(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetLabel(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_SELECTED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_SELECTED, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetSelected(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
rv = a->GetSelected(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*vp = BOOLEAN_TO_JSVAL(prop);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_VALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_VALUE, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetValue(prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
rv = a->GetValue(prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -231,6 +189,8 @@ GetHTMLOptionElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -248,115 +208,106 @@ SetHTMLOptionElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case HTMLOPTIONELEMENT_DEFAULTSELECTED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_DEFAULTSELECTED, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetDefaultSelected(prop);
|
||||
|
||||
rv = a->SetDefaultSelected(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_TEXT:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_TEXT, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetText(prop);
|
||||
|
||||
rv = a->SetText(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_INDEX:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_INDEX, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_NOT_NUMBER_ERR;
|
||||
}
|
||||
|
||||
a->SetIndex(prop);
|
||||
|
||||
rv = a->SetIndex(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_DISABLED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_DISABLED, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetDisabled(prop);
|
||||
|
||||
rv = a->SetDisabled(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_LABEL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_LABEL, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetLabel(prop);
|
||||
|
||||
rv = a->SetLabel(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_SELECTED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_SELECTED, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool prop;
|
||||
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
||||
rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;
|
||||
}
|
||||
|
||||
a->SetSelected(prop);
|
||||
|
||||
rv = a->SetSelected(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HTMLOPTIONELEMENT_VALUE:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOPTIONELEMENT_VALUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetValue(prop);
|
||||
|
||||
rv = a->SetValue(prop);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -367,6 +318,8 @@ SetHTMLOptionElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче