Author: hsaputra
Date: Tue Jun 5 20:20:18 2012
New Revision: 1346571
URL: http://svn.apache.org/viewvc?rev=1346571&view=rev
Log:
SHINDIG-1787 Calling navigateGadget again after the initial one destroys the
content iframe and fails to navigate to the view. CR
http://codereview.appspot.com/6305045
Modified:
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
shindig/trunk/features/src/main/javascript/features/container.site/site_holder.js
Modified:
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js?rev=1346571&r1=1346570&r2=1346571&view=diff
==============================================================================
---
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
(original)
+++
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
Tue Jun 5 20:20:18 2012
@@ -36,9 +36,7 @@
osapi.container.GadgetSite = function(container, service, args) {
var undef;
- osapi.container.Site.call(this, container, service,
- args['gadgetEl']
- ); // call super
+ osapi.container.Site.call(this, container, service, args['gadgetEl']); //
call super
/**
* @type {string}
@@ -283,10 +281,20 @@ osapi.container.GadgetSite.prototype.ren
return;
}
- // Load into the double-buffer if there is one.
- var el = this.loadingGadgetEl_ || this.el_;
- this.loadingGadgetHolder_ = new osapi.container.GadgetHolder(this, el,
- this.gadgetOnLoad_);
+ // Set the loading gadget holder:
+ // 1. If the gadget site already has currentGadgetHolder_ set and no loading
element passed,
+ // simply set the current gadget holder as the loading gadget holder.
+ // 2. Else, check if caller pass the loading gadget element. If it does then
use it to create new
+ // instance of osapi.container.GadgetHolder as the loading gadget holder.
+ if (this.currentGadgetHolder_ && !this.loadingGadgetEl_) {
+ this.loadingGadgetHolder_ = this.currentGadgetHolder_;
+ this.currentGadgetHolder_ = null;
+ }
+ else {
+ // Check if we are passed the loading gadget element
+ var el = this.loadingGadgetEl_ || this.el_;
+ this.loadingGadgetHolder_ = new osapi.container.GadgetHolder(this, el,
this.gadgetOnLoad_);
+ }
var localRenderParams = {};
for (var key in renderParams) {
Modified:
shindig/trunk/features/src/main/javascript/features/container.site/site_holder.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.site/site_holder.js?rev=1346571&r1=1346570&r2=1346571&view=diff
==============================================================================
---
shindig/trunk/features/src/main/javascript/features/container.site/site_holder.js
(original)
+++
shindig/trunk/features/src/main/javascript/features/container.site/site_holder.js
Tue Jun 5 20:20:18 2012
@@ -93,6 +93,15 @@ osapi.container.SiteHolder.prototype.get
};
/**
+ * Disposes the gadget holder and performs cleanup of any holder state.
+ */
+osapi.container.SiteHolder.prototype.dispose = function() {
+ if (this.el_ && this.el_.firstChild) {
+ this.el_.removeChild(this.el_.firstChild);
+ }
+};
+
+/**
* Creates the iframe element source for this holder's iframe element.
* @param {string} url The src url for the iframe.
* @param {Object.<string, string>=} overrides A bag of iframe attribute
overrides.
@@ -139,16 +148,6 @@ osapi.container.SiteHolder.prototype.cre
return params;
};
-/**
- * Disposes the gadget holder and performs cleanup of any holder state.
- * @abstract
- */
-osapi.container.SiteHolder.prototype.dispose = function() {
- if (this.el_ && this.el_.firstChild) {
- this.el_.removeChild(this.el_.firstChild);
- }
-};
-
//Abstract methods
/**