Author: woonsan
Date: Thu Sep 10 13:49:39 2009
New Revision: 813438

URL: http://svn.apache.org/viewvc?rev=813438&view=rev
Log:
JS2-1063: Relative urls should be regarded as same domain based urls. Also 
adding a log for cross domain src url.

Modified:
    
portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/widget/PortletWindow.src.js

Modified: 
portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/widget/PortletWindow.src.js
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/widget/PortletWindow.src.js?rev=813438&r1=813437&r2=813438&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/widget/PortletWindow.src.js
 (original)
+++ 
portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/widget/PortletWindow.src.js
 Thu Sep 10 13:49:39 2009
@@ -2899,25 +2899,20 @@
     
     _isUrlFromSameDomain: function( url )
     {
-        var reUrl = /^https?\:\/\/([\w\.]+)[:/]?/i;
+        var reUrl = /^https?\:\/\/([\w\.-]+)[:/]?/i;
         if (reUrl.test(url))
         {
             var targetDomain = RegExp.$1;
             var hostName = window.location.hostname;
-            
-            if (hostName == targetDomain)
-            {
-                return true;
-            }
-            else
+            if (hostName != targetDomain)
             {
                 var baseDomain = hostName.replace(/^www\w*\./i, "");
-                if (targetDomain.lastIndexOf(baseDomain) == 
targetDomain.length - baseDomain.length) {
-                    return true;
+                if (targetDomain.lastIndexOf(baseDomain) != 
targetDomain.length - baseDomain.length) {
+                    return false;
                 }
             }
         }
-        return false;
+        return true;
     },
     
     _executeScripts: function( scripts, djObj )
@@ -2949,6 +2944,10 @@
                 {
                     contents = djHostEnv.getText( uri, null, false );
                 }
+                else
+                {
+                    djObj.debug( "Cannot retrieve script from the different 
domain for portlet [" + this.widgetId + "] url=" + uri );
+                }
                 
                if ( contents )
                 {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to