Return-Path: X-Original-To: apmail-shindig-commits-archive@www.apache.org Delivered-To: apmail-shindig-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6138F9343 for ; Tue, 5 Jun 2012 20:20:41 +0000 (UTC) Received: (qmail 92663 invoked by uid 500); 5 Jun 2012 20:20:41 -0000 Delivered-To: apmail-shindig-commits-archive@shindig.apache.org Received: (qmail 92644 invoked by uid 500); 5 Jun 2012 20:20:41 -0000 Mailing-List: contact commits-help@shindig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@shindig.apache.org Delivered-To: mailing list commits@shindig.apache.org Received: (qmail 92635 invoked by uid 99); 5 Jun 2012 20:20:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2012 20:20:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2012 20:20:39 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 77B152388860; Tue, 5 Jun 2012 20:20:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1346571 - in /shindig/trunk/features/src/main/javascript/features: container.site.gadget/gadget_site.js container.site/site_holder.js Date: Tue, 05 Jun 2012 20:20:19 -0000 To: commits@shindig.apache.org From: hsaputra@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120605202019.77B152388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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.=} 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 /**