You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by fe...@apache.org on 2011/07/11 12:43:13 UTC
svn commit: r1145116 -
/shindig/trunk/features/src/main/javascript/features/caja/taming.js
Author: felix8a
Date: Mon Jul 11 10:43:12 2011
New Revision: 1145116
URL: http://svn.apache.org/viewvc?rev=1145116&view=rev
Log:
Caja URI policy for relative URIs in sample gadgets
https://reviews.apache.org/r/854/
Modified:
shindig/trunk/features/src/main/javascript/features/caja/taming.js
Modified: shindig/trunk/features/src/main/javascript/features/caja/taming.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/caja/taming.js?rev=1145116&r1=1145115&r2=1145116&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/caja/taming.js (original)
+++ shindig/trunk/features/src/main/javascript/features/caja/taming.js Mon Jul 11 10:43:12 2011
@@ -32,9 +32,15 @@ caja___ = (function() {
var uriCallback = {
rewrite: function rewrite(uri, mimeTypes) {
uri = String(uri);
- // Allow references to anchors within the gadget
if (/^#/.test(uri)) {
+ // Allow references to anchors within the gadget
return '#' + encodeURIComponent(decodeURIComponent(uri.substring(1)));
+ } else if (/^\/[^\/]/.test(uri)) {
+ // Unqualified uris aren't resolved in a useful way in gadgets, so
+ // this isn't a real case, but some of the samples use relative
+ // uris for images, and it looks odd if they don't work cajoled.
+ return gadgets.io.getProxyUrl(
+ location.protocol + '//' + location.host + uri);
} else {
// Proxy all other dynamically constructed urls
return gadgets.io.getProxyUrl(uri);