Beginnings of massive landing of joki changes.

Relevant nsbeta3+ bugs 43309, 44503, 2634, 2504,5981, 24698, 25758, 33577,
36062, 36217, 41191, 41491, 42356, 42829, 43016
r=saari (joki code). also been tested by heikki and bryner
This commit is contained in:
saari%netscape.com 2000-08-08 21:19:03 +00:00
Родитель 51ea7f2136
Коммит 77a47fdee1
10 изменённых файлов: 65 добавлений и 13 удалений

Просмотреть файл

@ -138,6 +138,8 @@ public:
NS_IMETHOD GetScrollY(PRInt32* aScrollY)=0;
NS_IMETHOD GetLength(PRUint32* aLength)=0;
NS_IMETHOD Dump(const nsString& aStr)=0;
NS_IMETHOD Alert(JSContext* cx, jsval* argv, PRUint32 argc)=0;
@ -266,6 +268,7 @@ public:
NS_IMETHOD SetPageYOffset(PRInt32 aPageYOffset); \
NS_IMETHOD GetScrollX(PRInt32* aScrollX); \
NS_IMETHOD GetScrollY(PRInt32* aScrollY); \
NS_IMETHOD GetLength(PRUint32* aLength); \
NS_IMETHOD Dump(const nsString& aStr); \
NS_IMETHOD Alert(JSContext* cx, jsval* argv, PRUint32 argc); \
NS_IMETHOD Confirm(JSContext* cx, jsval* argv, PRUint32 argc, PRBool* aReturn); \
@ -357,6 +360,7 @@ public:
NS_IMETHOD SetPageYOffset(PRInt32 aPageYOffset) { return _to SetPageYOffset(aPageYOffset); } \
NS_IMETHOD GetScrollX(PRInt32* aScrollX) { return _to GetScrollX(aScrollX); } \
NS_IMETHOD GetScrollY(PRInt32* aScrollY) { return _to GetScrollY(aScrollY); } \
NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \
NS_IMETHOD Dump(const nsString& aStr) { return _to Dump(aStr); } \
NS_IMETHOD Alert(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Alert(cx, argv, argc); } \
NS_IMETHOD Confirm(JSContext* cx, jsval* argv, PRUint32 argc, PRBool* aReturn) { return _to Confirm(cx, argv, argc, aReturn); } \

Просмотреть файл

@ -956,6 +956,7 @@ enum nsDOMProp {
NS_DOM_PROP_WINDOW_HOME,
NS_DOM_PROP_WINDOW_INNERHEIGHT,
NS_DOM_PROP_WINDOW_INNERWIDTH,
NS_DOM_PROP_WINDOW_LENGTH,
NS_DOM_PROP_WINDOW_LOCATIONBAR,
NS_DOM_PROP_WINDOW_MENUBAR,
NS_DOM_PROP_WINDOW_MOVEBY,

Просмотреть файл

@ -954,6 +954,7 @@
"window.home", \
"window.innerheight", \
"window.innerwidth", \
"window.length", \
"window.locationbar", \
"window.menubar", \
"window.moveby", \

Просмотреть файл

@ -44,8 +44,12 @@ public:
/**
* Checks equality of internal script function pointer with the one passed in.
*/
NS_IMETHOD CheckIfEqual(nsIScriptEventListener *aListener, PRBool* aResult) = 0;
virtual nsresult CheckIfEqual(nsIScriptEventListener *aListener) = 0;
/**
* Gets internal data for equality checking..
*/
NS_IMETHOD GetInternals(void** aTarget, void** aHandler) = 0;
};

Просмотреть файл

@ -55,7 +55,7 @@ public:
NS_IMETHOD IntersectsNode(nsIDOMNode* aN, PRBool* aReturn)=0;
NS_IMETHOD CompareNode(nsIDOMNode* aN, PRInt16* aReturn)=0;
NS_IMETHOD CompareNode(nsIDOMNode* aN, PRUint16* aReturn)=0;
};
@ -65,7 +65,7 @@ public:
NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aReturn); \
NS_IMETHOD ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aReturn); \
NS_IMETHOD IntersectsNode(nsIDOMNode* aN, PRBool* aReturn); \
NS_IMETHOD CompareNode(nsIDOMNode* aN, PRInt16* aReturn); \
NS_IMETHOD CompareNode(nsIDOMNode* aN, PRUint16* aReturn); \
@ -75,7 +75,7 @@ public:
NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aReturn) { return _to IsPointInRange(aParent, aOffset, aReturn); } \
NS_IMETHOD ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aReturn) { return _to ComparePoint(aParent, aOffset, aReturn); } \
NS_IMETHOD IntersectsNode(nsIDOMNode* aN, PRBool* aReturn) { return _to IntersectsNode(aN, aReturn); } \
NS_IMETHOD CompareNode(nsIDOMNode* aN, PRInt16* aReturn) { return _to CompareNode(aN, aReturn); } \
NS_IMETHOD CompareNode(nsIDOMNode* aN, PRUint16* aReturn) { return _to CompareNode(aN, aReturn); } \
#endif // nsIDOMNSRange_h__

Просмотреть файл

@ -1275,6 +1275,15 @@ NS_IMETHODIMP GlobalWindowImpl::GetScrollY(PRInt32* aScrollY)
return result;
}
NS_IMETHODIMP GlobalWindowImpl::GetLength(PRUint32* aLength)
{
nsCOMPtr<nsIDOMWindowCollection> frames;
if (NS_SUCCEEDED(GetFrames(getter_AddRefs(frames))) && frames) {
return frames->GetLength(aLength);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP GlobalWindowImpl::Dump(const nsString& aStr)
{
char *cstr = aStr.ToNewUTF8String();

Просмотреть файл

@ -123,7 +123,8 @@ enum Window_slots {
WINDOW_PAGEYOFFSET = -35,
WINDOW_SCROLLX = -36,
WINDOW_SCROLLY = -37,
ABSTRACTVIEW_DOCUMENT = -38
WINDOW_LENGTH = -38,
ABSTRACTVIEW_DOCUMENT = -39
};
/***********************************************************************/
@ -561,6 +562,18 @@ GetWindowProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case WINDOW_LENGTH:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_LENGTH, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
PRUint32 prop;
rv = a->GetLength(&prop);
if (NS_SUCCEEDED(rv)) {
*vp = INT_TO_JSVAL(prop);
}
}
break;
}
case ABSTRACTVIEW_DOCUMENT:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_ABSTRACTVIEW_DOCUMENT, PR_FALSE);
@ -2852,6 +2865,7 @@ static JSPropertySpec WindowProperties[] =
{"pageYOffset", WINDOW_PAGEYOFFSET, JSPROP_ENUMERATE},
{"scrollX", WINDOW_SCROLLX, JSPROP_ENUMERATE | JSPROP_READONLY},
{"scrollY", WINDOW_SCROLLY, JSPROP_ENUMERATE | JSPROP_READONLY},
{"length", WINDOW_LENGTH, JSPROP_ENUMERATE | JSPROP_READONLY},
{"document", ABSTRACTVIEW_DOCUMENT, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

Просмотреть файл

@ -91,13 +91,31 @@ nsresult nsJSDOMEventListener::HandleEvent(nsIDOMEvent* aEvent)
return jsBoolResult ? NS_OK : NS_ERROR_FAILURE;
}
nsresult nsJSDOMEventListener::CheckIfEqual(nsIScriptEventListener *aListener)
NS_IMETHODIMP
nsJSDOMEventListener::CheckIfEqual(nsIScriptEventListener *aListener, PRBool *aResult)
{
/*
* This should be rewritten to use a PRBool out parameter in stead of
* using the return value to show if this equals aListener...
*/
return NS_ERROR_FAILURE;
*aResult = PR_FALSE;
JSObject *otherTarget, *otherHandler;
if (NS_SUCCEEDED(aListener->GetInternals((void**)&otherTarget, (void**)&otherHandler))) {
if (otherTarget == mTarget && otherHandler == mHandler) {
*aResult = PR_TRUE;
}
}
return NS_OK;
}
NS_IMETHODIMP
nsJSDOMEventListener::GetInternals(void** aTarget, void** aHandler)
{
NS_ENSURE_ARG_POINTER(aTarget);
NS_ENSURE_ARG_POINTER(aHandler);
*aTarget = (void*)mTarget;
*aHandler = (void*)mHandler;
return NS_OK;
}
/*

Просмотреть файл

@ -42,7 +42,8 @@ public:
virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
//nsIScriptEventListener interface
virtual nsresult CheckIfEqual(nsIScriptEventListener *aListener);
NS_IMETHOD CheckIfEqual(nsIScriptEventListener *aListener, PRBool* aResult);
NS_IMETHOD GetInternals(void** aTarget, void** aHandler);
protected:
nsCOMPtr<nsIScriptContext> mContext;

Просмотреть файл

@ -1259,7 +1259,7 @@ NSRangeCompareNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
}
PRInt16 nativeRet;
PRUint16 nativeRet;
nsCOMPtr<nsIDOMNode> b0;
// If there's no private data, this must be the prototype, so ignore
if (!nativeThis) {