diff --git a/mozilla/dom/src/base/nsJSEnvironment.cpp b/mozilla/dom/src/base/nsJSEnvironment.cpp index b552a6704e0..c9bef57ece9 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.cpp +++ b/mozilla/dom/src/base/nsJSEnvironment.cpp @@ -38,8 +38,13 @@ static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID); void PR_CALLBACK NS_ScriptErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) { - printf("JavaScript error: %s\nURL :%s, LineNo :%u\nLine text: '%s', Error text: '%s'\n", message, - report->filename, report->lineno, report->linebuf, report->tokenptr); + if (nsnull != report) { + printf("JavaScript error: %s\nURL :%s, LineNo :%u\nLine text: '%s', Error text: '%s'\n", message, + report->filename, report->lineno, report->linebuf, report->tokenptr); + } + else { + printf("JavaScript error: %s\n", message); + } } nsJSContext::nsJSContext(JSRuntime *aRuntime) diff --git a/mozilla/dom/src/html/nsJSHTMLCollection.cpp b/mozilla/dom/src/html/nsJSHTMLCollection.cpp index 4bc3dc52d9d..f5ad6f2d334 100644 --- a/mozilla/dom/src/html/nsJSHTMLCollection.cpp +++ b/mozilla/dom/src/html/nsJSHTMLCollection.cpp @@ -132,6 +132,15 @@ GetHTMLCollectionProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) *vp = JSVAL_NULL; } } + else { + nsIJSScriptObject *object; + if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) { + PRBool rval; + rval = object->GetProperty(cx, id, vp); + NS_RELEASE(object); + return rval; + } + } } else { return JS_FALSE; diff --git a/mozilla/dom/src/html/nsJSHTMLDocument.cpp b/mozilla/dom/src/html/nsJSHTMLDocument.cpp index 156b86cc9b0..307343f9937 100644 --- a/mozilla/dom/src/html/nsJSHTMLDocument.cpp +++ b/mozilla/dom/src/html/nsJSHTMLDocument.cpp @@ -642,6 +642,7 @@ GetHTMLDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) if (NS_OK == a->QueryInterface(kINSHTMLDocumentIID, (void **)&b)) { if (NS_OK == b->NamedItem(name, &prop)) { + NS_RELEASE(b); if (NULL != prop) { // get the js object if (prop != nsnull) { @@ -661,7 +662,15 @@ GetHTMLDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) *vp = JSVAL_NULL; } } - NS_RELEASE(b); + else { + nsIJSScriptObject *object; + if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) { + PRBool rval; + rval = object->GetProperty(cx, id, vp); + NS_RELEASE(object); + return rval; + } + } } else { NS_RELEASE(b); diff --git a/mozilla/dom/src/html/nsJSHTMLFormElement.cpp b/mozilla/dom/src/html/nsJSHTMLFormElement.cpp index 7cd21c538b1..cb388d5da7b 100644 --- a/mozilla/dom/src/html/nsJSHTMLFormElement.cpp +++ b/mozilla/dom/src/html/nsJSHTMLFormElement.cpp @@ -249,6 +249,7 @@ GetHTMLFormElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) if (NS_OK == a->QueryInterface(kINSHTMLFormElementIID, (void **)&b)) { if (NS_OK == b->NamedItem(name, &prop)) { + NS_RELEASE(b); if (NULL != prop) { // get the js object if (prop != nsnull) { @@ -268,7 +269,15 @@ GetHTMLFormElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) *vp = JSVAL_NULL; } } - NS_RELEASE(b); + else { + nsIJSScriptObject *object; + if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) { + PRBool rval; + rval = object->GetProperty(cx, id, vp); + NS_RELEASE(object); + return rval; + } + } } else { NS_RELEASE(b); diff --git a/mozilla/dom/tools/JSStubGen.cpp b/mozilla/dom/tools/JSStubGen.cpp index 8e0172ffcb8..7e613307f66 100644 --- a/mozilla/dom/tools/JSStubGen.cpp +++ b/mozilla/dom/tools/JSStubGen.cpp @@ -315,6 +315,15 @@ static const char *kPropFuncNamedItemStr = " if (NULL != prop) {\n" "%s" " }\n" +" else {\n" +" nsIJSScriptObject *object;\n" +" if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {\n" +" PRBool rval;\n" +" rval = object->%sProperty(cx, id, vp);\n" +" NS_RELEASE(object);\n" +" return rval;\n" +" }\n" +" }\n" " }\n" " else {\n" " return JS_FALSE;\n" @@ -337,10 +346,19 @@ static const char *kPropFuncNamedItemNonPrimaryStr = "\n" " if (NS_OK == a->QueryInterface(kI%sIID, (void **)&b)) {\n" " if (NS_OK == b->NamedItem(name, %sprop)) {\n" +" NS_RELEASE(b);\n" " if (NULL != prop) {\n" "%s" " }\n" -" NS_RELEASE(b);\n" +" else {\n" +" nsIJSScriptObject *object;\n" +" if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {\n" +" PRBool rval;\n" +" rval = object->%sProperty(cx, id, vp);\n" +" NS_RELEASE(object);\n" +" return rval;\n" +" }\n" +" }\n" " }\n" " else {\n" " NS_RELEASE(b);\n" @@ -601,13 +619,13 @@ JSStubGen::GeneratePropGetter(ofstream *file, else if (JSSTUBGEN_NAMED_ITEM == aType) { sprintf(buf, kPropFuncNamedItemStr, attr_type, aAttribute.GetType() == TYPE_STRING ? "" : "&", - case_str); + case_str, "Get"); } else if (JSSTUBGEN_NAMED_ITEM_NONPRIMARY == aType) { sprintf(buf, kPropFuncNamedItemNonPrimaryStr, attr_type, aInterface.GetName(), aInterface.GetName(), aAttribute.GetType() == TYPE_STRING ? "" : "&", - case_str, aInterface.GetName()); + case_str, "Get", aInterface.GetName()); } *file << buf;