You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by he...@gmail.com on 2012/06/05 17:05:10 UTC

SHINDIG-1787 Calling navigateGadget again after the initial one destroys the content iframe and fail (issue 6305045)

Reviewers: rbaxter85, ddumont, dev_shindig.apache.org,

Description:
CR for SHINDIG-1787 Calling navigateGadget again after the initial one
destroys the content iframe and fails to navigate to the view

See https://issues.apache.org/jira/browse/SHINDIG-1787 for details

Please review this at http://codereview.appspot.com/6305045/

Affected files:
   features/src/main/javascript/features/container.site.gadget/gadget_site.js
   features/src/main/javascript/features/container.site/site_holder.js


Index: features/src/main/javascript/features/container.site/site_holder.js
===================================================================
--- features/src/main/javascript/features/container.site/site_holder.js	 
(revision 1345303)
+++ features/src/main/javascript/features/container.site/site_holder.js	 
(working copy)
@@ -93,6 +93,15 @@
  };

  /**
+ * 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 @@
     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

  /**
Index:  
features/src/main/javascript/features/container.site.gadget/gadget_site.js
===================================================================
---  
features/src/main/javascript/features/container.site.gadget/gadget_site.js	 
(revision 1345303)
+++  
features/src/main/javascript/features/container.site.gadget/gadget_site.js	 
(working copy)
@@ -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,23 @@
      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 {
+    var el = this.el_;
+    // Check if we are passed the loading gadget element
+    if(this.loadingGadgetEl_) {
+      el = this.loadingGadgetEl_;
+    }
+    this.loadingGadgetHolder_ = new osapi.container.GadgetHolder(this, el,  
this.gadgetOnLoad_);
+  }

    var localRenderParams = {};
    for (var key in renderParams) {