зеркало из https://github.com/mozilla/pjs.git
Fixing bug 37258. Making the window properties scrollbars, statusbar and directories replaceable to be compatible with NS 4.x. r&a=vidur&brendan
This commit is contained in:
Родитель
fd94078a97
Коммит
e9a674e851
|
@ -1,159 +0,0 @@
|
|||
|
||||
interface Window {
|
||||
/* IID: { 0xa6cf906b, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
|
||||
readonly attribute Document document;
|
||||
readonly attribute Window parent;
|
||||
readonly replaceable attribute Window top;
|
||||
readonly attribute BarProp scrollbars;
|
||||
readonly attribute WindowCollection frames;
|
||||
attribute wstring name;
|
||||
readonly attribute long scrollX;
|
||||
readonly attribute long scrollY;
|
||||
void scrollTo(in long xScroll, in long yScroll);
|
||||
void scrollBy(in long xScrollDif, in long yScrollDif);
|
||||
xpidl nsISelection getSelection();
|
||||
void scrollByLines(in long numLines);
|
||||
void scrollByPages(in long numPages);
|
||||
};
|
||||
|
||||
interface WindowInternal : Window {
|
||||
/* IID: { 0x9c911860, 0x7dd9, 0x11d4, \
|
||||
{ 0x9a, 0x83, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 } } */
|
||||
|
||||
readonly attribute WindowInternal window;
|
||||
readonly attribute WindowInternal self;
|
||||
readonly attribute Navigator navigator;
|
||||
readonly attribute Screen screen;
|
||||
readonly attribute History history;
|
||||
readonly replaceable attribute WindowInternal _content;
|
||||
readonly replaceable attribute xpidl nsISidebar sidebar;
|
||||
readonly replaceable attribute xpidl nsIPrompt prompter;
|
||||
|
||||
readonly replaceable attribute BarProp menubar;
|
||||
readonly replaceable attribute BarProp toolbar;
|
||||
readonly replaceable attribute BarProp locationbar;
|
||||
readonly replaceable attribute BarProp personalbar;
|
||||
readonly attribute BarProp statusbar;
|
||||
readonly attribute BarProp directories;
|
||||
readonly attribute boolean closed;
|
||||
readonly attribute Crypto crypto;
|
||||
readonly attribute Pkcs11 pkcs11;
|
||||
readonly replaceable attribute xpidl nsIControllers controllers;
|
||||
attribute WindowInternal opener;
|
||||
attribute wstring status;
|
||||
attribute wstring defaultStatus;
|
||||
attribute jsval location;
|
||||
attribute DOMString title;
|
||||
attribute long innerWidth;
|
||||
attribute long innerHeight;
|
||||
attribute long outerWidth;
|
||||
attribute long outerHeight;
|
||||
attribute long screenX;
|
||||
attribute long screenY;
|
||||
attribute long pageXOffset;
|
||||
attribute long pageYOffset;
|
||||
readonly replaceable attribute unsigned long length;
|
||||
|
||||
void dump(in wstring str);
|
||||
void alert(/* ... */);
|
||||
boolean confirm(/* ... */);
|
||||
// XXX prompt() should be changed back to return a string once
|
||||
// the DOM APIs allow us to return null js values for a string.
|
||||
// in the meantime, this is the only way to do that:
|
||||
jsval prompt(/* ... */);
|
||||
void focus();
|
||||
void blur();
|
||||
void back();
|
||||
void forward();
|
||||
void home();
|
||||
void stop();
|
||||
void print();
|
||||
|
||||
void moveTo(in long xPos, in long yPos);
|
||||
void moveBy(in long xDif, in long yDif);
|
||||
void resizeTo(in long width, in long height);
|
||||
void resizeBy(in long widthDif, in long heightDif);
|
||||
void sizeToContent();
|
||||
void GetAttention();
|
||||
void scroll(in long xScroll, in long yScroll);
|
||||
|
||||
void clearTimeout(in long timerID);
|
||||
void clearInterval(in long timerID);
|
||||
long setTimeout(/* ... */);
|
||||
long setInterval(/* ... */);
|
||||
|
||||
void captureEvents(in long eventFlags);
|
||||
void releaseEvents(in long eventFlags);
|
||||
void routeEvent(in Event evt);
|
||||
void enableExternalCapture();
|
||||
void disableExternalCapture();
|
||||
void setCursor(in DOMString cursor);
|
||||
|
||||
WindowInternal open(/* ... */);
|
||||
WindowInternal openDialog(/* ... */);
|
||||
noscript void close();
|
||||
void close(/* ... */);
|
||||
|
||||
void updateCommands(in DOMString action);
|
||||
|
||||
DOMString escape(in DOMString str);
|
||||
DOMString unescape(in DOMString str);
|
||||
|
||||
};
|
||||
|
||||
interface WindowEventOwner {
|
||||
/* IID: { 0xef1876f0, 0x7881, 0x11d4, \
|
||||
{ 0x9a, 0x80, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 } } */
|
||||
|
||||
attribute jsval onmousedown;
|
||||
attribute jsval onmouseup;
|
||||
attribute jsval onclick;
|
||||
attribute jsval onmouseover;
|
||||
attribute jsval onmouseout;
|
||||
attribute jsval onkeydown;
|
||||
attribute jsval onkeyup;
|
||||
attribute jsval onkeypress;
|
||||
attribute jsval onmousemove;
|
||||
attribute jsval onfocus;
|
||||
attribute jsval onblur;
|
||||
attribute jsval onsubmit;
|
||||
attribute jsval onreset;
|
||||
attribute jsval onchange;
|
||||
attribute jsval onselect;
|
||||
attribute jsval onload;
|
||||
attribute jsval onunload;
|
||||
attribute jsval onclose;
|
||||
attribute jsval onabort;
|
||||
attribute jsval onerror;
|
||||
attribute jsval onpaint;
|
||||
attribute jsval ondragdrop;
|
||||
attribute jsval onresize;
|
||||
attribute jsval onscroll;
|
||||
};
|
||||
|
||||
interface EventTarget {
|
||||
/* IID: { 0x1c773b30, 0xd1cf, 0x11d2, \
|
||||
{ 0xbd, 0x95, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4 } } */
|
||||
|
||||
void addEventListener(in DOMString type, in function EventListener listener, in boolean useCapture);
|
||||
void removeEventListener(in DOMString type, in function EventListener listener, in boolean useCapture);
|
||||
void dispatchEvent(in Event evt);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
interface AbstractView {
|
||||
/* IID: { 0xf51ebade, 0x8b1a, 0x11d3, \
|
||||
{ 0xaa, 0xe7, 0x00, 0x10, 0x83, 0x01, 0x23, 0xb4 } } */
|
||||
|
||||
readonly attribute DocumentView document;
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
interface ViewCSS : AbstractView {
|
||||
/* IID: { 0x0b9341f3, 0x95d4, 0x4fa4, \
|
||||
{ 0xad, 0xcd, 0xe1, 0x19, 0xe0, 0xdb, 0x28, 0x89 } } */
|
||||
|
||||
CSSStyleDeclaration getComputedStyle(in Element elt,
|
||||
in DOMString pseudoElt);
|
||||
};
|
|
@ -92,59 +92,56 @@ static NS_DEFINE_IID(kIWindowEventOwnerIID, NS_IDOMWINDOWEVENTOWNER_IID);
|
|||
enum Window_slots {
|
||||
WINDOW_DOCUMENT = -1,
|
||||
WINDOW_PARENT = -2,
|
||||
WINDOW_SCROLLBARS = -3,
|
||||
WINDOW_FRAMES = -4,
|
||||
WINDOW_NAME = -5,
|
||||
WINDOW_SCROLLX = -6,
|
||||
WINDOW_SCROLLY = -7,
|
||||
WINDOWINTERNAL_WINDOW = -8,
|
||||
WINDOWINTERNAL_SELF = -9,
|
||||
WINDOWINTERNAL_NAVIGATOR = -10,
|
||||
WINDOWINTERNAL_SCREEN = -11,
|
||||
WINDOWINTERNAL_HISTORY = -12,
|
||||
WINDOWINTERNAL_STATUSBAR = -13,
|
||||
WINDOWINTERNAL_DIRECTORIES = -14,
|
||||
WINDOWINTERNAL_CLOSED = -15,
|
||||
WINDOWINTERNAL_CRYPTO = -16,
|
||||
WINDOWINTERNAL_PKCS11 = -17,
|
||||
WINDOWINTERNAL_OPENER = -18,
|
||||
WINDOWINTERNAL_STATUS = -19,
|
||||
WINDOWINTERNAL_DEFAULTSTATUS = -20,
|
||||
WINDOWINTERNAL_LOCATION = -21,
|
||||
WINDOWINTERNAL_TITLE = -22,
|
||||
WINDOWINTERNAL_INNERWIDTH = -23,
|
||||
WINDOWINTERNAL_INNERHEIGHT = -24,
|
||||
WINDOWINTERNAL_OUTERWIDTH = -25,
|
||||
WINDOWINTERNAL_OUTERHEIGHT = -26,
|
||||
WINDOWINTERNAL_SCREENX = -27,
|
||||
WINDOWINTERNAL_SCREENY = -28,
|
||||
WINDOWINTERNAL_PAGEXOFFSET = -29,
|
||||
WINDOWINTERNAL_PAGEYOFFSET = -30,
|
||||
WINDOWEVENTOWNER_ONMOUSEDOWN = -31,
|
||||
WINDOWEVENTOWNER_ONMOUSEUP = -32,
|
||||
WINDOWEVENTOWNER_ONCLICK = -33,
|
||||
WINDOWEVENTOWNER_ONMOUSEOVER = -34,
|
||||
WINDOWEVENTOWNER_ONMOUSEOUT = -35,
|
||||
WINDOWEVENTOWNER_ONKEYDOWN = -36,
|
||||
WINDOWEVENTOWNER_ONKEYUP = -37,
|
||||
WINDOWEVENTOWNER_ONKEYPRESS = -38,
|
||||
WINDOWEVENTOWNER_ONMOUSEMOVE = -39,
|
||||
WINDOWEVENTOWNER_ONFOCUS = -40,
|
||||
WINDOWEVENTOWNER_ONBLUR = -41,
|
||||
WINDOWEVENTOWNER_ONSUBMIT = -42,
|
||||
WINDOWEVENTOWNER_ONRESET = -43,
|
||||
WINDOWEVENTOWNER_ONCHANGE = -44,
|
||||
WINDOWEVENTOWNER_ONSELECT = -45,
|
||||
WINDOWEVENTOWNER_ONLOAD = -46,
|
||||
WINDOWEVENTOWNER_ONUNLOAD = -47,
|
||||
WINDOWEVENTOWNER_ONCLOSE = -48,
|
||||
WINDOWEVENTOWNER_ONABORT = -49,
|
||||
WINDOWEVENTOWNER_ONERROR = -50,
|
||||
WINDOWEVENTOWNER_ONPAINT = -51,
|
||||
WINDOWEVENTOWNER_ONDRAGDROP = -52,
|
||||
WINDOWEVENTOWNER_ONRESIZE = -53,
|
||||
WINDOWEVENTOWNER_ONSCROLL = -54,
|
||||
ABSTRACTVIEW_DOCUMENT = -55
|
||||
WINDOW_FRAMES = -3,
|
||||
WINDOW_NAME = -4,
|
||||
WINDOW_SCROLLX = -5,
|
||||
WINDOW_SCROLLY = -6,
|
||||
WINDOWINTERNAL_WINDOW = -7,
|
||||
WINDOWINTERNAL_SELF = -8,
|
||||
WINDOWINTERNAL_NAVIGATOR = -9,
|
||||
WINDOWINTERNAL_SCREEN = -10,
|
||||
WINDOWINTERNAL_HISTORY = -11,
|
||||
WINDOWINTERNAL_CLOSED = -12,
|
||||
WINDOWINTERNAL_CRYPTO = -13,
|
||||
WINDOWINTERNAL_PKCS11 = -14,
|
||||
WINDOWINTERNAL_OPENER = -15,
|
||||
WINDOWINTERNAL_STATUS = -16,
|
||||
WINDOWINTERNAL_DEFAULTSTATUS = -17,
|
||||
WINDOWINTERNAL_LOCATION = -18,
|
||||
WINDOWINTERNAL_TITLE = -19,
|
||||
WINDOWINTERNAL_INNERWIDTH = -20,
|
||||
WINDOWINTERNAL_INNERHEIGHT = -21,
|
||||
WINDOWINTERNAL_OUTERWIDTH = -22,
|
||||
WINDOWINTERNAL_OUTERHEIGHT = -23,
|
||||
WINDOWINTERNAL_SCREENX = -24,
|
||||
WINDOWINTERNAL_SCREENY = -25,
|
||||
WINDOWINTERNAL_PAGEXOFFSET = -26,
|
||||
WINDOWINTERNAL_PAGEYOFFSET = -27,
|
||||
WINDOWEVENTOWNER_ONMOUSEDOWN = -28,
|
||||
WINDOWEVENTOWNER_ONMOUSEUP = -29,
|
||||
WINDOWEVENTOWNER_ONCLICK = -30,
|
||||
WINDOWEVENTOWNER_ONMOUSEOVER = -31,
|
||||
WINDOWEVENTOWNER_ONMOUSEOUT = -32,
|
||||
WINDOWEVENTOWNER_ONKEYDOWN = -33,
|
||||
WINDOWEVENTOWNER_ONKEYUP = -34,
|
||||
WINDOWEVENTOWNER_ONKEYPRESS = -35,
|
||||
WINDOWEVENTOWNER_ONMOUSEMOVE = -36,
|
||||
WINDOWEVENTOWNER_ONFOCUS = -37,
|
||||
WINDOWEVENTOWNER_ONBLUR = -38,
|
||||
WINDOWEVENTOWNER_ONSUBMIT = -39,
|
||||
WINDOWEVENTOWNER_ONRESET = -40,
|
||||
WINDOWEVENTOWNER_ONCHANGE = -41,
|
||||
WINDOWEVENTOWNER_ONSELECT = -42,
|
||||
WINDOWEVENTOWNER_ONLOAD = -43,
|
||||
WINDOWEVENTOWNER_ONUNLOAD = -44,
|
||||
WINDOWEVENTOWNER_ONCLOSE = -45,
|
||||
WINDOWEVENTOWNER_ONABORT = -46,
|
||||
WINDOWEVENTOWNER_ONERROR = -47,
|
||||
WINDOWEVENTOWNER_ONPAINT = -48,
|
||||
WINDOWEVENTOWNER_ONDRAGDROP = -49,
|
||||
WINDOWEVENTOWNER_ONRESIZE = -50,
|
||||
WINDOWEVENTOWNER_ONSCROLL = -51,
|
||||
ABSTRACTVIEW_DOCUMENT = -52
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -194,19 +191,6 @@ GetWindowProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case WINDOW_SCROLLBARS:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SCROLLBARS, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMBarProp* prop;
|
||||
rv = a->GetScrollbars(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WINDOW_FRAMES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_FRAMES, PR_FALSE);
|
||||
|
@ -356,46 +340,6 @@ GetWindowProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case WINDOWINTERNAL_STATUSBAR:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWINTERNAL_STATUSBAR, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMBarProp* prop;
|
||||
nsIDOMWindowInternal* b;
|
||||
if (NS_OK == a->QueryInterface(kIWindowInternalIID, (void **)&b)) {
|
||||
rv = b->GetStatusbar(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WINDOWINTERNAL_DIRECTORIES:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWINTERNAL_DIRECTORIES, PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIDOMBarProp* prop;
|
||||
nsIDOMWindowInternal* b;
|
||||
if (NS_OK == a->QueryInterface(kIWindowInternalIID, (void **)&b)) {
|
||||
rv = b->GetDirectories(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WINDOWINTERNAL_CLOSED:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWINTERNAL_CLOSED, PR_FALSE);
|
||||
|
@ -2028,6 +1972,67 @@ WindowtopSetter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// scrollbars Property Getter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
WindowscrollbarsGetter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMWindow *a = (nsIDOMWindow*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SCROLLBARS, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
|
||||
nsIDOMBarProp* prop;
|
||||
rv = a->GetScrollbars(&prop);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// scrollbars Property Setter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
WindowscrollbarsSetter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMWindow *a = (nsIDOMWindow*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOW_SCROLLBARS, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
|
||||
|
||||
JS_DefineProperty(cx, obj, "scrollbars", *vp, nsnull, nsnull, JSPROP_ENUMERATE);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// _content Property Getter
|
||||
|
@ -2504,6 +2509,142 @@ WindowInternalpersonalbarSetter(JSContext *cx, JSObject *obj, jsval id, jsval *v
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// statusbar Property Getter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
WindowInternalstatusbarGetter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMWindowInternal *a = (nsIDOMWindowInternal*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWINTERNAL_STATUSBAR, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
|
||||
nsIDOMBarProp* prop;
|
||||
nsIDOMWindowInternal* b;
|
||||
if (NS_OK == a->QueryInterface(kIWindowInternalIID, (void **)&b)) {
|
||||
rv = b->GetStatusbar(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// statusbar Property Setter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
WindowInternalstatusbarSetter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMWindowInternal *a = (nsIDOMWindowInternal*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWINTERNAL_STATUSBAR, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
|
||||
|
||||
JS_DefineProperty(cx, obj, "statusbar", *vp, nsnull, nsnull, JSPROP_ENUMERATE);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// directories Property Getter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
WindowInternaldirectoriesGetter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMWindowInternal *a = (nsIDOMWindowInternal*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWINTERNAL_DIRECTORIES, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
|
||||
nsIDOMBarProp* prop;
|
||||
nsIDOMWindowInternal* b;
|
||||
if (NS_OK == a->QueryInterface(kIWindowInternalIID, (void **)&b)) {
|
||||
rv = b->GetDirectories(&prop);
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
// get the js object
|
||||
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
|
||||
}
|
||||
NS_RELEASE(b);
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_DOM_WRONG_TYPE_ERR;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// directories Property Setter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
WindowInternaldirectoriesSetter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMWindowInternal *a = (nsIDOMWindowInternal*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
|
||||
if (!secMan)
|
||||
return PR_FALSE;
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_WINDOWINTERNAL_DIRECTORIES, PR_TRUE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
|
||||
|
||||
JS_DefineProperty(cx, obj, "directories", *vp, nsnull, nsnull, JSPROP_ENUMERATE);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// controllers Property Getter
|
||||
|
@ -2647,7 +2788,6 @@ static JSPropertySpec WindowProperties[] =
|
|||
{
|
||||
{"document", WINDOW_DOCUMENT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"parent", WINDOW_PARENT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"scrollbars", WINDOW_SCROLLBARS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"frames", WINDOW_FRAMES, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"name", WINDOW_NAME, JSPROP_ENUMERATE},
|
||||
{"scrollX", WINDOW_SCROLLX, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
|
@ -2657,8 +2797,6 @@ static JSPropertySpec WindowProperties[] =
|
|||
{"navigator", WINDOWINTERNAL_NAVIGATOR, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"screen", WINDOWINTERNAL_SCREEN, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"history", WINDOWINTERNAL_HISTORY, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"statusbar", WINDOWINTERNAL_STATUSBAR, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"directories", WINDOWINTERNAL_DIRECTORIES, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"closed", WINDOWINTERNAL_CLOSED, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"crypto", WINDOWINTERNAL_CRYPTO, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"pkcs11", WINDOWINTERNAL_PKCS11, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
|
@ -2710,6 +2848,7 @@ static JSPropertySpec WindowProperties[] =
|
|||
static JSPropertySpec WindowReplaceableProperties[] =
|
||||
{
|
||||
{"top", 0, JSPROP_ENUMERATE, WindowtopGetter, WindowtopSetter},
|
||||
{"scrollbars", 0, JSPROP_ENUMERATE, WindowscrollbarsGetter, WindowscrollbarsSetter},
|
||||
{"_content", 0, JSPROP_ENUMERATE, WindowInternal_contentGetter, WindowInternal_contentSetter},
|
||||
{"sidebar", 0, JSPROP_ENUMERATE, WindowInternalsidebarGetter, WindowInternalsidebarSetter},
|
||||
{"prompter", 0, JSPROP_ENUMERATE, WindowInternalprompterGetter, WindowInternalprompterSetter},
|
||||
|
@ -2717,6 +2856,8 @@ static JSPropertySpec WindowReplaceableProperties[] =
|
|||
{"toolbar", 0, JSPROP_ENUMERATE, WindowInternaltoolbarGetter, WindowInternaltoolbarSetter},
|
||||
{"locationbar", 0, JSPROP_ENUMERATE, WindowInternallocationbarGetter, WindowInternallocationbarSetter},
|
||||
{"personalbar", 0, JSPROP_ENUMERATE, WindowInternalpersonalbarGetter, WindowInternalpersonalbarSetter},
|
||||
{"statusbar", 0, JSPROP_ENUMERATE, WindowInternalstatusbarGetter, WindowInternalstatusbarSetter},
|
||||
{"directories", 0, JSPROP_ENUMERATE, WindowInternaldirectoriesGetter, WindowInternaldirectoriesSetter},
|
||||
{"controllers", 0, JSPROP_ENUMERATE, WindowInternalcontrollersGetter, WindowInternalcontrollersSetter},
|
||||
{"length", 0, JSPROP_ENUMERATE, WindowInternallengthGetter, WindowInternallengthSetter},
|
||||
{0}
|
||||
|
|
Загрузка…
Ссылка в новой задаче