Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): marc esher / Marc Esher (marcesher)
Created: 01/12/2009
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 / 228496
Priority/Frequency: Normal / Unknown
Locale/System: English / Win All
Vote Count: 0
Problem:
cfajaxproxy does not honor inheritance
Method:
1) Create a cfc named Parent.cfc:
<cfcomponent>
<cffunction name="hiFromParent" access="remote" returntype="string" hint="">
<cfreturn "hi from parent">
</cffunction>
<cffunction name="notRemote" output="false" access="public">
<cfreturn "notRemote">
</cffunction>
</cfcomponent>
2) Create a CFC named "Child.cfc"
<cfcomponent extends="Parent">
<cffunction name="hiFromChild" output="false" access="remote" returntype="string" hint="">
<cfreturn "hi from child">
</cffunction>
<cffunction name="notRemoteInChild" output="false" access="public">
<cfreturn "notRemote">
</cffunction>
</cfcomponent>
3) Create a calling page:
<html>
<cfajaxproxy cfc="Parent" jsclassname="Parent">
<cfajaxproxy cfc="Child" jsclassname="Child">
<head>
<script>
function dumpProxies(){
var parent = new Parent();
var child = new Child();
console.log(parent.hiFromParent());
console.log(child.hiFromChild());
console.log(child.hiFromParent());
}
</script>
</head>
<body onload="dumpProxies();">
</body>
</html>
You'll then get a javascript error that "child.hiFromParent()" is not defined.
the reason is that cfajaxproxy only provides remote proxies for functions in the immediate CFC and not in its parent tree. I'd expect that function visibility in an ajax proxy would be the same as in normal CFC execution. The workaround -- adding a new function into the Child cfc and calling the parent's version via super -- is ugly and should not be required.
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3037239
External Customer Info:
External Company:
External Customer Name: Marc Esher
External Customer Email: 70390EBF47F01CAF992015B9
External Test Config: 01/12/2009
Attachments:
Comments: