Closed Bug 86191 Opened 24 years ago Closed 23 years ago

GetDynamicScriptContext: return nsnull as nsresult is wrong

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.1alpha

People

(Reporter: jag+mozilla, Assigned: jst)

References

()

Details

(Whiteboard: [HAVE FIX])

In nsContentUtils, this gem can be found: 134 nsresult 135 nsContentUtils::GetDynamicScriptContext(JSContext *aContext, 136 nsIScriptContext** aScriptContext) 137 { 138 // XXX We rely on the rule that if any JSContext in our JSRuntime has a 139 // private set then that private *must* be a pointer to an nsISupports. 140 nsISupports *supports = (nsIScriptContext*) JS_GetContextPrivate(aContext); 141 if (!supports) 142 return nsnull; 143 return supports->QueryInterface(NS_GET_IID(nsIScriptContext), 144 (void**)aScriptContext); 145 } Line 142 :-)
Here's a fix, but since this doesn't break anything I'll push it out for mozilla1.1 Index: content/base/src/nsContentUtils.cpp =================================================================== RCS file: /cvsroot/mozilla/content/base/src/nsContentUtils.cpp,v retrieving revision 1.3 diff -u -r1.3 nsContentUtils.cpp --- nsContentUtils.cpp 2001/05/14 09:16:25 1.3 +++ nsContentUtils.cpp 2001/06/17 06:57:47 @@ -135,11 +135,14 @@ nsContentUtils::GetDynamicScriptContext(JSContext *aContext, nsIScriptContext** aScriptContext) { + *aScriptContext = nsnull; + // XXX We rely on the rule that if any JSContext in our JSRuntime has a // private set then that private *must* be a pointer to an nsISupports. nsISupports *supports = (nsIScriptContext*) JS_GetContextPrivate(aContext); if (!supports) - return nsnull; + return NS_OK; + return supports->QueryInterface(NS_GET_IID(nsIScriptContext), (void**)aScriptContext); }
Status: NEW → ASSIGNED
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla1.1
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
verified fixed
Status: RESOLVED → VERIFIED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.