You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2007/03/04 17:18:37 UTC
svn commit: r514441 - in /incubator/xap/trunk/codebase/src/xap: ./
bridges/basic/ bridges/dojo/ bridges/xap/ data/bridge/ data/controller/
data/datasource/
Author: mturyn
Date: Sun Mar 4 09:18:35 2007
New Revision: 514441
URL: http://svn.apache.org/viewvc?view=rev&rev=514441
Log:
Changes to avoid infinite recursion when attempting to access superclass methods; see http://issues.apache.org/jira/browse/XAP-80.
1.) Xap.setupClassAsSubclassOf altered such that:
a.) The superclass member is place on the constructor.
b.) The prototype now has a superclass() method that gives us
the old behaviour when we really want it (viz sub)
c.) Most calls on (e.g.) ClassX.prototype formerly using "this.superclass..."
now switched to "ClassX.superclass".
d.) xap.bridges.basic.AbstractWidgetBridge.prototype.getAllowedAttributes
now uses superclass(); this is o.k. and in fact necessary, for which
see below.
Where the old way works:
There will be no problem calling, in effect,
this.superclass().foo()
which is the same as
this.superclass().foo.call(this.superclass())
but
this.superclass().foo.call(this)
can produce the problem if a method with the same name is implemented
over three levels of inheritance in the same tree. Any function which can
usefully be called using
this.superclass().foo.call( this.superclass() )
should be fine.
Modified:
incubator/xap/trunk/codebase/src/xap/Xap.js
incubator/xap/trunk/codebase/src/xap/bridges/basic/AbstractWidgetBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/basic/DomNodeBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/dojo/DesktopPaneBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoColorPaletteBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoDatePickerBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoFloatingPaneBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/dojo/HorizontalSeparatorBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabPaneBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/xap/EditableComboBoxBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js
incubator/xap/trunk/codebase/src/xap/data/bridge/BindingBridge.js
incubator/xap/trunk/codebase/src/xap/data/bridge/FormatterChainBridge.js
incubator/xap/trunk/codebase/src/xap/data/bridge/IteratorBridge.js
incubator/xap/trunk/codebase/src/xap/data/controller/ElementLocation.js
incubator/xap/trunk/codebase/src/xap/data/datasource/SimpleDocumentDataSource.js
Modified: incubator/xap/trunk/codebase/src/xap/Xap.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/Xap.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/Xap.js (original)
+++ incubator/xap/trunk/codebase/src/xap/Xap.js Sun Mar 4 09:18:35 2007
@@ -228,7 +228,17 @@
var superclassConstructor = Xap.resolveConstructor( superclassName ) ;
subclassConstructor.prototype = new superclassConstructor();
- subclassConstructor.prototype.superclass = superclassConstructor.prototype ;
+
+ /**
+ * Potentially hazardous, can create infinitely recursing
+ * calls---safe for bridges' <code>getAllowedAttributes</code>
+ * because they don't use <code>apply(this,...)</code>
+ * or <code>apply(this,...)</code>.
+ **/
+ subclassConstructor.prototype.superclass = function(){
+ return superclassConstructor.prototype ;
+ }
+ subclassConstructor.superclass = superclassConstructor.prototype ;
subclassConstructor.prototype.constructor = subclassConstructor;
@@ -247,5 +257,7 @@
return xap.util.Debug ;
}
}
+
+
Modified: incubator/xap/trunk/codebase/src/xap/bridges/basic/AbstractWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/basic/AbstractWidgetBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/basic/AbstractWidgetBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/basic/AbstractWidgetBridge.js Sun Mar 4 09:18:35 2007
@@ -471,8 +471,10 @@
else{
var allowedAttributes = [];
allowedAttributes = allowedAttributes.concat(this.getNewAllowedAttributes());
- if (this.superclass && this.superclass.getAllowedAttributes){
- allowedAttributes = allowedAttributes.concat(this.superclass.getAllowedAttributes());
+ if (this.superclass && this.superclass()
+ && this.superclass().getAllowedAttributes
+ ){
+ allowedAttributes = allowedAttributes.concat(this.superclass().getAllowedAttributes());
}
this.constructor._allowedAttributes = allowedAttributes;
return allowedAttributes;
Modified: incubator/xap/trunk/codebase/src/xap/bridges/basic/DomNodeBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/basic/DomNodeBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/basic/DomNodeBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/basic/DomNodeBridge.js Sun Mar 4 09:18:35 2007
@@ -251,7 +251,7 @@
peer.style[name] = value ;
} else {
// Default behaviour:
- this.superclass.attributeSet.call(this,event) ;
+ xap.bridges.basic.DomNodeBridge.superclass.attributeSet.call(this,event) ;
}
}
@@ -304,7 +304,7 @@
* then gives the peer a member pointing back here.
**/
xap.bridges.basic.DomNodeBridge.prototype.setPeer = function(aPeer){
- this.superclass.setPeer.call(this,aPeer) ;
+ xap.bridges.basic.DomNodeBridge.superclass.setPeer.call(this,aPeer) ;
// We'll want to be able to easily go from
// the dom node to the bridge:
aPeer.handler = this ;
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/DesktopPaneBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/DesktopPaneBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/DesktopPaneBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/DesktopPaneBridge.js Sun Mar 4 09:18:35 2007
@@ -83,5 +83,5 @@
if (childPeer instanceof dojo.widget.html.FloatingPane){
childPeer._isWindow = true;
}
- this.superclass.addChild.call(this,childHandler,index);
+ xap.bridges.dojo.DesktopPaneBridge.superclass.addChild.call(this,childHandler,index);
}
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoColorPaletteBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoColorPaletteBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoColorPaletteBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoColorPaletteBridge.js Sun Mar 4 09:18:35 2007
@@ -78,7 +78,7 @@
* @param aWidget{DojoWidget} a dojo color palette widget.
**/
xap.bridges.dojo.DojoColorPaletteBridge.prototype.setPeer = function(aWidget){
- this.superclass.setPeer.call(this,aWidget) ;
+ xap.bridges.dojo.DojoColorPaletteBridge.superclass.setPeer.call(this,aWidget) ;
}
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoDatePickerBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoDatePickerBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoDatePickerBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoDatePickerBridge.js Sun Mar 4 09:18:35 2007
@@ -48,7 +48,7 @@
xap.bridges.dojo.DojoDatePickerBridge.prototype.init = function() {
- this.superclass.init.call(this);
+ xap.bridges.dojo.DojoDatePickerBridge.superclass.init.call(this);
// attach peer methods:
this.autoAttachBridgeEventsToPeerEvents() ;
@@ -81,7 +81,7 @@
* Sets the widget as our peer, upgrades it with new methods to adapt it to our use:
**/
xap.bridges.dojo.DojoDatePickerBridge.prototype.setPeer = function(aDatePicker){
- this.superclass.setPeer.call(this,aDatePicker) ;
+ xap.bridges.dojo.DojoDatePickerBridge.superclass.setPeer.call(this,aDatePicker) ;
}
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoFloatingPaneBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoFloatingPaneBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoFloatingPaneBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/DojoFloatingPaneBridge.js Sun Mar 4 09:18:35 2007
@@ -57,7 +57,7 @@
* Is this allowed as an initial property?
**/
xap.bridges.dojo.DojoFloatingPaneBridge.prototype.getAllowedInitialProperties = function(){
- var arry = this.superclass.getAllowedInitialProperties(this) ;
+ var arry = xap.bridges.dojo.DojoFloatingPaneBridge.superclass.getAllowedInitialProperties(this) ;
arry.push("title");
arry.push("resizable");
arry.push("layoutAlign") ;
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/HorizontalSeparatorBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/HorizontalSeparatorBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/HorizontalSeparatorBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/HorizontalSeparatorBridge.js Sun Mar 4 09:18:35 2007
@@ -48,7 +48,7 @@
xap.bridges.dojo.HorizontalSeparatorBridge.prototype.init = function() {
- this.superclass.init.call(this);
+ xap.bridges.dojo.HorizontalSeparatorBridge.superclass.init.call(this);
this.getPeer().layoutItem();
}
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js Sun Mar 4 09:18:35 2007
@@ -53,7 +53,7 @@
xap.bridges.dojo.TabBridge.prototype.init = function() {
- this.superclass.init.call(this);
+ xap.bridges.dojo.TabBridge.superclass.init.call(this);
var parentElement = this.getElement().parentNode;
var parentHandler = this.getUiContentHandler().getHandlerForElement( parentElement );
this._tabContainer = parentHandler.getPeer();
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabPaneBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabPaneBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabPaneBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabPaneBridge.js Sun Mar 4 09:18:35 2007
@@ -67,7 +67,7 @@
}
var oldSelectedTab = this.getPeer().selectedTabWidget;
- this.superclass.addChild.call(this,childHandler, index );
+ xap.bridges.dojo.TabPaneBridge.superclass.addChild.call(this,childHandler, index );
var newSelectedTab = this.getPeer().selectedTabWidget;
//after a child is added if some new tab is selected
Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/WindowBridge.js Sun Mar 4 09:18:35 2007
@@ -52,7 +52,7 @@
xap.bridges.dojo.WindowBridge.prototype.init = function() {
- this.superclass.init.call(this);
+ xap.bridges.dojo.WindowBridge.superclass.init.call(this);
var peer = this.getPeer() ;
@@ -165,7 +165,7 @@
* XAL properties to their Dojo equivalents
*/
xap.bridges.dojo.WindowBridge.prototype.getXalToToolkitMapper = function(){
- var mapper = this.superclass.getXalToToolkitMapper.call(this);
+ var mapper = xap.bridges.dojo.WindowBridge.superclass.getXalToToolkitMapper.call(this);
mapper.title = "title";
mapper.closable = "displayCloseAction";
mapper.minimizable = "displayMinimizeAction";
@@ -187,7 +187,7 @@
propertyMap.constrainToContainer= true;
- this.superclass.mapAllowedInitialPropertiesFromXalToDojo.call(this, propertyMap, attrHolder);
+ xap.bridges.dojo.WindowBridge.superclass.mapAllowedInitialPropertiesFromXalToDojo.call(this, propertyMap, attrHolder);
}
xap.bridges.dojo.WindowBridge.prototype.addChild = function(childHandler, index){
Modified: incubator/xap/trunk/codebase/src/xap/bridges/xap/EditableComboBoxBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/xap/EditableComboBoxBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/xap/EditableComboBoxBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/xap/EditableComboBoxBridge.js Sun Mar 4 09:18:35 2007
@@ -47,7 +47,7 @@
dojo.event.disconnect(this.getPeer(),"onclick",this,"toggleList") ;
}
- this.superclass.setPeer.call(this,aComboBoxTop) ;
+ xap.bridges.xap.EditableComboBoxBridge.superclass.setPeer.call(this,aComboBoxTop) ;
dojo.event.connect(this.getPeer(),"onclick",this,"toggleList") ;
Modified: incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js Sun Mar 4 09:18:35 2007
@@ -176,7 +176,7 @@
// Adjust world to changes from adding a new option list item:
xap.bridges.xap.ListBoxBridge.prototype.childAdded = function(anEvent){
- this.superclass.childAdded.call(this,anEvent) ;
+ xap.bridges.xap.ListBoxBridge.superclass.childAdded.call(this,anEvent) ;
this.revalue() ;
}
Modified: incubator/xap/trunk/codebase/src/xap/data/bridge/BindingBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/bridge/BindingBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/data/bridge/BindingBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/data/bridge/BindingBridge.js Sun Mar 4 09:18:35 2007
@@ -41,7 +41,7 @@
* @return {void}
**/
xap.data.bridge.BindingBridge.prototype.init = function(){
- this.superclass.init(this);
+ xap.data.bridge.BindingBridge.superclass.init(this);
/*XapElement*/
var me = this.getElement();
Modified: incubator/xap/trunk/codebase/src/xap/data/bridge/FormatterChainBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/bridge/FormatterChainBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/data/bridge/FormatterChainBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/data/bridge/FormatterChainBridge.js Sun Mar 4 09:18:35 2007
@@ -60,7 +60,7 @@
* to set up the formatter chain.
*/
xap.data.bridge.FormatterChainBridge.prototype.initializeFormatter = function () {
- this.superclass.initializeFormatter.call(this);
+ xap.data.bridge.FormatterChainBridge.superclass.initializeFormatter.call(this);
//FormatterChain
var chain = this.getFormatter();
Modified: incubator/xap/trunk/codebase/src/xap/data/bridge/IteratorBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/bridge/IteratorBridge.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/data/bridge/IteratorBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/data/bridge/IteratorBridge.js Sun Mar 4 09:18:35 2007
@@ -64,7 +64,7 @@
xap.data.bridge.IteratorBridge.prototype.init = function () {
// for brevity's sake:
var xmlDataTokens = xap.data.bridge.XmlDataTokens;
- this.superclass.init.call(this);
+ xap.data.bridge.IteratorBridge.superclass.init.call(this);
/*Element*/
var element = this.getElement();
/*String*/
Modified: incubator/xap/trunk/codebase/src/xap/data/controller/ElementLocation.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/controller/ElementLocation.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/data/controller/ElementLocation.js (original)
+++ incubator/xap/trunk/codebase/src/xap/data/controller/ElementLocation.js Sun Mar 4 09:18:35 2007
@@ -56,6 +56,6 @@
**/
xap.data.controller.ElementLocation.prototype.remove = function () {
this._element.getParent().removeChild(this._element);
- this.superclass.remove.call(this);
+ xap.data.controller.ElementLocation.superclass.remove.call(this);
};
Modified: incubator/xap/trunk/codebase/src/xap/data/datasource/SimpleDocumentDataSource.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/datasource/SimpleDocumentDataSource.js?view=diff&rev=514441&r1=514440&r2=514441
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/data/datasource/SimpleDocumentDataSource.js (original)
+++ incubator/xap/trunk/codebase/src/xap/data/datasource/SimpleDocumentDataSource.js Sun Mar 4 09:18:35 2007
@@ -67,7 +67,7 @@
//TODO handle better.
throw new xap.util.Exception("Source for a document source must be a document");
}
- this.superclass.setSource.call(this, document );
+ xap.data.datasource.SimpleDocumentDataSource.superclass.setSource.call(this, document );
};