зеркало из https://github.com/mozilla/pjs.git
Fix for bug 9378. document.layers now returns undefined, not null. r=pollmann
This commit is contained in:
Родитель
cc8c8d9c58
Коммит
9679502c54
|
@ -2291,10 +2291,10 @@ nsHTMLDocument::MatchLayers(nsIContent *aContent, nsString* aData)
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef NS_IMPLEMENT_DOCUMENT_LAYERS
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetLayers(nsIDOMHTMLCollection** aLayers)
|
||||
{
|
||||
#ifdef NS_IMPLEMENT_DOCUMENT_LAYERS
|
||||
if (nsnull == mLayers) {
|
||||
mLayers = new nsContentList(this, MatchLayers, nsnull);
|
||||
if (nsnull == mLayers) {
|
||||
|
@ -2305,12 +2305,11 @@ nsHTMLDocument::GetLayers(nsIDOMHTMLCollection** aLayers)
|
|||
|
||||
*aLayers = (nsIDOMHTMLCollection *)mLayers;
|
||||
NS_ADDREF(mLayers);
|
||||
#else
|
||||
*aLayers = nsnull;
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetPlugins(nsIDOMHTMLCollection** aPlugins)
|
||||
|
|
|
@ -60,8 +60,6 @@ public:
|
|||
|
||||
NS_IMETHOD GetEmbeds(nsIDOMHTMLCollection** aEmbeds)=0;
|
||||
|
||||
NS_IMETHOD GetLayers(nsIDOMHTMLCollection** aLayers)=0;
|
||||
|
||||
NS_IMETHOD GetPlugins(nsIDOMHTMLCollection** aPlugins)=0;
|
||||
|
||||
NS_IMETHOD GetSelection(nsString& aReturn)=0;
|
||||
|
@ -97,7 +95,6 @@ public:
|
|||
NS_IMETHOD SetFgColor(const nsString& aFgColor); \
|
||||
NS_IMETHOD GetLastModified(nsString& aLastModified); \
|
||||
NS_IMETHOD GetEmbeds(nsIDOMHTMLCollection** aEmbeds); \
|
||||
NS_IMETHOD GetLayers(nsIDOMHTMLCollection** aLayers); \
|
||||
NS_IMETHOD GetPlugins(nsIDOMHTMLCollection** aPlugins); \
|
||||
NS_IMETHOD GetSelection(nsString& aReturn); \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMElement** aReturn); \
|
||||
|
@ -124,7 +121,6 @@ public:
|
|||
NS_IMETHOD SetFgColor(const nsString& aFgColor) { return _to SetFgColor(aFgColor); } \
|
||||
NS_IMETHOD GetLastModified(nsString& aLastModified) { return _to GetLastModified(aLastModified); } \
|
||||
NS_IMETHOD GetEmbeds(nsIDOMHTMLCollection** aEmbeds) { return _to GetEmbeds(aEmbeds); } \
|
||||
NS_IMETHOD GetLayers(nsIDOMHTMLCollection** aLayers) { return _to GetLayers(aLayers); } \
|
||||
NS_IMETHOD GetPlugins(nsIDOMHTMLCollection** aPlugins) { return _to GetPlugins(aPlugins); } \
|
||||
NS_IMETHOD GetSelection(nsString& aReturn) { return _to GetSelection(aReturn); } \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMElement** aReturn) { return _to NamedItem(aName, aReturn); } \
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
readonly attribute wstring lastModified;
|
||||
|
||||
readonly attribute HTMLCollection embeds;
|
||||
readonly attribute HTMLCollection layers;
|
||||
readonly attribute HTMLCollection plugins;
|
||||
|
||||
wstring getSelection();
|
||||
|
|
|
@ -76,8 +76,7 @@ enum HTMLDocument_slots {
|
|||
NSHTMLDOCUMENT_FGCOLOR = -16,
|
||||
NSHTMLDOCUMENT_LASTMODIFIED = -17,
|
||||
NSHTMLDOCUMENT_EMBEDS = -18,
|
||||
NSHTMLDOCUMENT_LAYERS = -19,
|
||||
NSHTMLDOCUMENT_PLUGINS = -20
|
||||
NSHTMLDOCUMENT_PLUGINS = -19
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -491,33 +490,6 @@ GetHTMLDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case NSHTMLDOCUMENT_LAYERS:
|
||||
{
|
||||
PRBool ok = PR_FALSE;
|
||||
secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NSHTMLDOCUMENT_LAYERS, PR_FALSE, &ok);
|
||||
if (!ok) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);
|
||||
}
|
||||
nsIDOMHTMLCollection* prop;
|
||||
nsIDOMNSHTMLDocument* b;
|
||||
if (NS_OK == a->QueryInterface(kINSHTMLDocumentIID, (void **)&b)) {
|
||||
nsresult result = NS_OK;
|
||||
result = b->GetLayers(&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);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSHTMLDOCUMENT_PLUGINS:
|
||||
{
|
||||
PRBool ok = PR_FALSE;
|
||||
|
@ -1492,7 +1464,6 @@ static JSPropertySpec HTMLDocumentProperties[] =
|
|||
{"fgColor", NSHTMLDOCUMENT_FGCOLOR, JSPROP_ENUMERATE},
|
||||
{"lastModified", NSHTMLDOCUMENT_LASTMODIFIED, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"embeds", NSHTMLDOCUMENT_EMBEDS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"layers", NSHTMLDOCUMENT_LAYERS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"plugins", NSHTMLDOCUMENT_PLUGINS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
|
|
@ -2291,10 +2291,10 @@ nsHTMLDocument::MatchLayers(nsIContent *aContent, nsString* aData)
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef NS_IMPLEMENT_DOCUMENT_LAYERS
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetLayers(nsIDOMHTMLCollection** aLayers)
|
||||
{
|
||||
#ifdef NS_IMPLEMENT_DOCUMENT_LAYERS
|
||||
if (nsnull == mLayers) {
|
||||
mLayers = new nsContentList(this, MatchLayers, nsnull);
|
||||
if (nsnull == mLayers) {
|
||||
|
@ -2305,12 +2305,11 @@ nsHTMLDocument::GetLayers(nsIDOMHTMLCollection** aLayers)
|
|||
|
||||
*aLayers = (nsIDOMHTMLCollection *)mLayers;
|
||||
NS_ADDREF(mLayers);
|
||||
#else
|
||||
*aLayers = nsnull;
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetPlugins(nsIDOMHTMLCollection** aPlugins)
|
||||
|
|
Загрузка…
Ссылка в новой задаче