Author: felix8a
Date: Thu Jun 21 22:28:33 2012
New Revision: 1352717
URL: http://svn.apache.org/viewvc?rev=1352717&view=rev
Log:
SHINDIG-1783 Update Caja integration
Added:
shindig/trunk/features/src/main/javascript/features/caja/caja-debug.xml
shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.opt.xml
shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.xml
shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.opt.xml
shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.xml
Removed:
shindig/trunk/features/src/main/javascript/features/caja-debug/
shindig/trunk/features/src/main/javascript/features/caja-guest-frame/
shindig/trunk/features/src/main/javascript/features/caja-taming-frame/
Modified:
shindig/trunk/features/src/main/javascript/features/caja/feature.xml
shindig/trunk/features/src/main/javascript/features/caja/taming.js
shindig/trunk/features/src/main/javascript/features/core.json/taming.js
shindig/trunk/features/src/main/javascript/features/features.txt
shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/taming.js
shindig/trunk/features/src/main/javascript/features/osapi.base/osapi.js
shindig/trunk/features/src/main/javascript/features/osapi.base/taming.js
shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/CajaContentRewriterTest.java
shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/AllJsFilter.java
shindig/trunk/pom.xml
Added: shindig/trunk/features/src/main/javascript/features/caja/caja-debug.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/caja/caja-debug.xml?rev=1352717&view=auto
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/caja/caja-debug.xml
(added)
+++ shindig/trunk/features/src/main/javascript/features/caja/caja-debug.xml Thu
Jun 21 22:28:33 2012
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+The javascript referenced here should be found in the caja jar.
+-->
+<feature>
+ <name>caja-debug</name>
+ <dependency>caja</dependency>
+ <gadget>
+ <!-- placeholder for backward compatibility -->
+ </gadget>
+</feature>
Added:
shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.opt.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.opt.xml?rev=1352717&view=auto
==============================================================================
---
shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.opt.xml
(added)
+++
shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.opt.xml
Thu Jun 21 22:28:33 2012
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+The javascript referenced here should be found in the caja jar.
+-->
+<feature>
+ <name>es53-guest-frame.opt</name>
+ <gadget>
+ <script src="res://com/google/caja/plugin/es53-guest-frame.opt.js"/>
+ </gadget>
+</feature>
Added:
shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.xml?rev=1352717&view=auto
==============================================================================
---
shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.xml
(added)
+++
shindig/trunk/features/src/main/javascript/features/caja/es53-guest-frame.xml
Thu Jun 21 22:28:33 2012
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+The javascript referenced here should be found in the caja jar.
+-->
+<feature>
+ <name>es53-guest-frame</name>
+ <gadget>
+ <script src="res://com/google/caja/plugin/es53-guest-frame.js"/>
+ </gadget>
+</feature>
Added:
shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.opt.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.opt.xml?rev=1352717&view=auto
==============================================================================
---
shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.opt.xml
(added)
+++
shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.opt.xml
Thu Jun 21 22:28:33 2012
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+The javascript referenced here should be found in the caja jar.
+-->
+<feature>
+ <name>es53-taming-frame.opt</name>
+ <gadget>
+ <script src="res://com/google/caja/plugin/es53-taming-frame.opt.js"/>
+ </gadget>
+</feature>
Added:
shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.xml?rev=1352717&view=auto
==============================================================================
---
shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.xml
(added)
+++
shindig/trunk/features/src/main/javascript/features/caja/es53-taming-frame.xml
Thu Jun 21 22:28:33 2012
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+The javascript referenced here should be found in the caja jar.
+-->
+<feature>
+ <name>es53-taming-frame</name>
+ <gadget>
+ <script src="res://com/google/caja/plugin/es53-taming-frame.js"/>
+ </gadget>
+</feature>
Modified: shindig/trunk/features/src/main/javascript/features/caja/feature.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/caja/feature.xml?rev=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/caja/feature.xml
(original)
+++ shindig/trunk/features/src/main/javascript/features/caja/feature.xml Thu
Jun 21 22:28:33 2012
@@ -22,14 +22,13 @@ specific language governing permissions
<dependency>core.util.onload</dependency>
<dependency>taming</dependency>
<gadget>
+ <script src="res://com/google/caja/plugin/caja.js"/>
<script src="taming.js"/>
<api>
- <exports type="js">caja___.getPendingScript</exports>
+ <exports type="js">caja___.getJSON</exports>
<exports type="js">caja___.getTameGlobal</exports>
<exports type="js">caja___.getUseless</exports>
- <exports type="js">caja___.loadedGuestFrame</exports>
- <exports type="js">caja___.loadedTamingFrame</exports>
- <exports type="js">caja___.markTameAsFunction</exports>
+ <exports type="js">caja___.markFunction</exports>
<exports type="js">caja___.start</exports>
<exports type="js">caja___.tame</exports>
<exports type="js">caja___.tamesTo</exports>
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=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/caja/taming.js
(original)
+++ shindig/trunk/features/src/main/javascript/features/caja/taming.js Thu Jun
21 22:28:33 2012
@@ -19,18 +19,12 @@
/**
* @fileoverview Caja is a whitelisting javascript sanitizing rewriter.
* This file tames the APIs that are exposed to a gadget.
+ * Currently limited to one cajoled gadget per ifr.
*/
caja___ = (function() {
- // currently limited to one cajoled gadget per ifr
- var guestFrame;
- var tamingFrame;
- var tame___; // tame___ === tamingFrame.contentWindow.___
- var pendingScript;
- var guestFrameReady = false;
- var tamingFrameReady = false;
- // URI policy: Rewrites all uris in a cajoled gadget
+ // Rewrites all uris in a cajoled gadget
var uriCallback = {
rewrite: function rewrite(uri, mimeTypes) {
uri = String(uri);
@@ -50,36 +44,32 @@ caja___ = (function() {
}
};
- function fire(globalScope) {
- for (var tamer in tamings___) {
- if (tamings___.hasOwnProperty(tamer)) {
- tamings___[tamer].call(tame___.USELESS, globalScope);
- }
- }
+ function getTameGlobal() {
+ return caja.iframe.contentWindow;
}
- function getTameGlobal() {
- return tamingFrame.contentWindow;
+ function getJSON() {
+ return caja.iframe.contentWindow.JSON;
}
function getUseless() {
- return tame___ && tame___.USELESS;
+ return caja.USELESS;
}
- function markTameAsFunction(func, name) {
- return tame___.markTameAsFunction(func, name);
+ function markFunction(func, name) {
+ return caja.markFunction(func, name);
}
function tame(obj) {
- return tame___.tame(obj);
+ return caja.tame(obj);
}
function tamesTo(feral, tame) {
- tame___.tamesTo(feral, tame);
+ return caja.tamesTo(feral, tame);
}
function untame(obj) {
- return tame___.untame(obj);
+ return caja.untame(obj);
}
function whitelistCtors(schemas) {
@@ -87,7 +77,7 @@ caja___ = (function() {
for (var i = 0; i < length; i++) {
var schema = schemas[i];
if (typeof schema[0][schema[1]] === 'function') {
- tame___.markTameAsCtor(
+ caja.markCtor(
schema[0][schema[1]] /* func */,
schema[2] /* parent */,
schema[1] /* name */);
@@ -103,7 +93,7 @@ caja___ = (function() {
for (var i = 0; i < length; i++) {
var schema = schemas[i];
if (typeof schema[0][schema[1]] === 'function') {
- tame___.markTameAsFunction(schema[0][schema[1]], schema[1]);
+ caja.markFunction(schema[0][schema[1]], schema[1]);
} else {
gadgets.warn('Error taming function: ' + schema[0] + '.' + schema[1]);
}
@@ -115,7 +105,7 @@ caja___ = (function() {
for (var i = 0; i < length; i++) {
var schema = schemas[i];
if (typeof schema[0].prototype[schema[1]] == 'function') {
- tame___.grantTameAsMethod(schema[0], schema[1]);
+ caja.grantMethod(schema[0].prototype, schema[1]);
} else {
gadgets.warn('Error taming method: ' + schema[0] + '.' + schema[1]);
}
@@ -126,112 +116,49 @@ caja___ = (function() {
var length = schemas.length;
for (var i = 0; i < length; i++) {
var schema = schemas[i];
- tame___.grantTameAsRead(schemas[0], schemas[1]);
+ caja.grantRead(schemas[0], schemas[1]);
}
}
- function makeFrame(id) {
- var frame = document.createElement('iframe');
- frame.style.display = 'none';
- frame.id = id;
- frame.height = 0;
- frame.width = 0;
- document.body.appendChild(frame);
- return frame;
- }
-
function start(script, debug) {
- // feral object marker for directConstructor
- window.Object.FERAL_FRAME_OBJECT___ = window.Object;
-
- pendingScript = script;
- debug = debug ? '?debug=1' : '';
-
- guestFrame = makeFrame('caja-guest-frame');
- var gdoc = guestFrame.contentWindow.document;
- gdoc.write('<!doctype html>\n');
- gdoc.write('<html><head>\n');
- gdoc.write('<script>var cajaIframeDone___ = function(){};<\/script>\n');
- gdoc.write('<script src="js/caja-guest-frame' + debug + '"><\/script>\n');
- gdoc.write('<script>\n');
- gdoc.write(' function cajaRun(script) {\n');
- gdoc.write(' eval(script);\n');
- gdoc.write(' parent.gadgets.util.runOnLoadHandlers();\n');
- gdoc.write(' }\n');
- gdoc.write(' parent.caja___.loadedGuestFrame();\n');
- gdoc.write('<\/script>\n');
- gdoc.write('</head></html>');
- gdoc.close();
-
- tamingFrame = makeFrame('caja-taming-frame');
- var tdoc = tamingFrame.contentWindow.document;
- tdoc.write('<!doctype html>\n');
- tdoc.write('<html><head>\n');
- tdoc.write('<script>var cajaIframeDone___ = function(){};<\/script>\n');
- tdoc.write('<script src="js/caja-taming-frame' + debug + '"><\/script>\n');
- tdoc.write('<script>parent.caja___.loadedTamingFrame();<\/script>\n');
- tdoc.write('</head></html>');
- tdoc.close();
- }
-
- function loadedTamingFrame() {
- tamingFrameReady = true;
- readyTrigger();
- }
-
- function loadedGuestFrame() {
- guestFrameReady = true;
- readyTrigger();
- }
-
- function readyTrigger() {
- if (guestFrameReady && tamingFrameReady) {
- window.setTimeout(ready, 0);
- }
- }
-
- function ready() {
- var guestWin = guestFrame.contentWindow;
- var imports = guestWin.___.getNewModuleHandler().getImports();
-
+ caja.initialize({
+ server: '/gadgets',
+ resources: '/gadgets/js',
+ // TODO(felix8a): make debug==false work
+ debug: true
+ });
var gadgetBody = document.getElementById('caja_innerContainer___');
+ caja.load(gadgetBody, uriCallback, function (frame) {
+ var api = makeApi();
+ frame.api(api).cajoled(void 0, script)
+ .run(function (result) {
+ gadgets.util.runOnLoadHandlers();
+ });
+ });
+ }
- var tameWin = tamingFrame.contentWindow;
- tame___ = tameWin.___;
-
- // TODO(felix8a): pass pseudo-window location
- tameWin.attachDocumentStub('-g___', uriCallback, imports, gadgetBody);
- imports.htmlEmitter___ =
- new tameWin.HtmlEmitter(gadgetBody, imports.document);
-
- imports.onerror = tame___.tame(
- tame___.markTameAsFunction(function(msg, source, line) {
- gadgets.log([msg, source, line]);
+ function makeApi() {
+ var api = {};
+ for (var tamer in tamings___) {
+ if (tamings___.hasOwnProperty(tamer)) {
+ tamings___[tamer].call(void 0, api);
+ }
+ }
+ api.gadgets = caja.tame(window.gadgets);
+ api.opensocial = caja.tame(window.opensocial);
+ api.osapi = caja.tame(window.osapi);
+ api.onerror = caja.tame(caja.markFunction(
+ function (msg, source, line) {
+ gadgets.log([msg, source, line]);
}));
-
- fire(imports);
-
- // these are in globals.js
- imports.gadgets = tame___.tame(window.gadgets);
- imports.opensocial = tame___.tame(window.opensocial);
- imports.osapi = tame___.tame(window.osapi);
-
- tame___.whitelistAll(imports);
-
- guestWin.plugin_dispatchEvent___ = tameWin.plugin_dispatchEvent___;
- guestWin.plugin_dispatchToHandler___ = tameWin.plugin_dispatchToHandler___;
- guestWin.___.getNewModuleHandler().setImports(imports);
- guestWin.___.useDebugSymbols = function() {};
-
- guestWin.cajaRun(pendingScript);
+ return api;
}
return {
+ getJSON: getJSON,
getTameGlobal: getTameGlobal,
getUseless: getUseless,
- loadedGuestFrame: loadedGuestFrame,
- loadedTamingFrame: loadedTamingFrame,
- markTameAsFunction: markTameAsFunction,
+ markFunction: markFunction,
start: start,
tame: tame,
tamesTo: tamesTo,
Modified:
shindig/trunk/features/src/main/javascript/features/core.json/taming.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/core.json/taming.js?rev=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/core.json/taming.js
(original)
+++ shindig/trunk/features/src/main/javascript/features/core.json/taming.js Thu
Jun 21 22:28:33 2012
@@ -22,8 +22,6 @@
* Tame and expose core gadgets.* API to cajoled gadgets
*/
tamings___.push(function(imports) {
- caja___.tamesTo(gadgets.json.stringify,
- caja___.getTameGlobal().safeJSON.stringify);
- caja___.tamesTo(gadgets.json.parse,
- caja___.getTameGlobal().safeJSON.parse);
+ caja___.tamesTo(gadgets.json.stringify, caja___.getJSON().stringify);
+ caja___.tamesTo(gadgets.json.parse, caja___.getJSON().parse);
});
Modified: shindig/trunk/features/src/main/javascript/features/features.txt
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/features.txt?rev=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/features.txt (original)
+++ shindig/trunk/features/src/main/javascript/features/features.txt Thu Jun 21
22:28:33 2012
@@ -22,9 +22,11 @@ features/globals/feature.xml
features/actions/feature.xml
features/auth-refresh/feature.xml
features/caja/feature.xml
-features/caja-debug/feature.xml
-features/caja-guest-frame/feature.xml
-features/caja-taming-frame/feature.xml
+features/caja/caja-debug.xml
+features/caja/es53-guest-frame.xml
+features/caja/es53-guest-frame.opt.xml
+features/caja/es53-taming-frame.xml
+features/caja/es53-taming-frame.opt.xml
features/container/feature.xml
features/container.site/feature.xml
features/container.site.gadget/feature.xml
Modified:
shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/taming.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/taming.js?rev=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
---
shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/taming.js
(original)
+++
shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/taming.js
Thu Jun 21 22:28:33 2012
@@ -22,6 +22,8 @@
* Tame and expose core gadgets.* API to cajoled gadgets
*/
tamings___.push(function(imports) {
- caja___.tamesTo(gadgets.json.xml.convertXmlToJson,
- caja___.getTameGlobal().safeJSON.convertXmlToJson);
+ caja___.whitelistFuncs([
+ // TODO(felix8a): is this safe?
+ // [gadgets.json.xml, 'convertXmlToJson']
+ ]);
});
Modified:
shindig/trunk/features/src/main/javascript/features/osapi.base/osapi.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/osapi.base/osapi.js?rev=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/osapi.base/osapi.js
(original)
+++ shindig/trunk/features/src/main/javascript/features/osapi.base/osapi.js Thu
Jun 21 22:28:33 2012
@@ -54,11 +54,11 @@ osapi._registerMethod = function(method,
if (typeof tamings___ !== 'undefined') {
var newTaming = function() {
- caja___.markTameAsFunction(last[basename], method);
+ caja___.markFunction(last[basename], method);
};
- // Remove the old taming if we are replacing it, no sense in growing the
array
- // needlessly. This function (_registerMethod) gets called a lot.
+ // Remove the old taming if we are replacing it, no sense in growing the
+ // array needlessly. This function (_registerMethod) gets called a lot.
if (old && old.__taming_index) {
last[basename].__taming_index = old.__taming_index;
tamings___[old.__taming_index] = newTaming;
Modified:
shindig/trunk/features/src/main/javascript/features/osapi.base/taming.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/osapi.base/taming.js?rev=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/osapi.base/taming.js
(original)
+++ shindig/trunk/features/src/main/javascript/features/osapi.base/taming.js
Thu Jun 21 22:28:33 2012
@@ -30,7 +30,7 @@ tamings___.push(function(imports) {
]);
return caja___.tame(batch);
}
- caja___.markTameAsFunction(newBatch, 'newBatch');
+ caja___.markFunction(newBatch, 'newBatch');
caja___.tamesTo(osapi.newBatch, newBatch);
caja___.whitelistCtors([
[osapi, '_BoundCall', Object]
Modified:
shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/CajaContentRewriterTest.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/CajaContentRewriterTest.java?rev=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
---
shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/CajaContentRewriterTest.java
(original)
+++
shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/CajaContentRewriterTest.java
Thu Jun 21 22:28:33 2012
@@ -104,7 +104,7 @@ public class CajaContentRewriterTest ext
public void testCssExpression() throws Exception {
String markup = "<div style='top:expression(alert(0), 0)'>test</div>";
String expected =
- "<div style=\"\">test</div>";
+ "<div>test</div>";
List<String> messages = ImmutableList.of(
"folding element html into parent",
Modified:
shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/AllJsFilter.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/AllJsFilter.java?rev=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
---
shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/AllJsFilter.java
(original)
+++
shindig/trunk/java/server/src/test/java/org/apache/shindig/server/endtoend/AllJsFilter.java
Thu Jun 21 22:28:33 2012
@@ -1,76 +1,85 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.shindig.server.endtoend;
-
-import java.io.IOException;
-import java.util.Set;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.shindig.common.servlet.InjectedFilter;
-import org.apache.shindig.gadgets.GadgetException;
-import org.apache.shindig.gadgets.features.FeatureRegistry;
-import org.apache.shindig.gadgets.features.FeatureRegistryProvider;
-
-import com.google.common.base.Joiner;
-import com.google.inject.Inject;
-
-public class AllJsFilter extends InjectedFilter {
-
- private String allFeatures;
-
- @Inject
- public void setFeatureRegistryProvider(FeatureRegistryProvider provider) {
- try {
- FeatureRegistry registry = provider.get(null);
- Set<String> allFeatureNames = registry.getAllFeatureNames();
- allFeatures = Joiner.on(':').join(allFeatureNames);
- } catch (GadgetException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
- throws IOException, ServletException {
- if (!(request instanceof HttpServletRequest && response instanceof
HttpServletResponse)) {
- throw new ServletException("Only HTTP!");
- }
-
- HttpServletRequest req = (HttpServletRequest) request;
- HttpServletResponse resp = (HttpServletResponse) response;
-
- String requestURI = req.getRequestURI();
- if (!requestURI.contains("all-features-please.js")) {
- chain.doFilter(request, response);
- } else {
- String newURI = requestURI.replace("all-features-please.js", allFeatures
+ ".js") + "?" + req.getQueryString();
- resp.sendRedirect(newURI);
- }
- }
-
- public void destroy() {
- }
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.shindig.server.endtoend;
+
+import java.io.IOException;
+import java.util.Set;
+import java.util.HashSet;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shindig.common.servlet.InjectedFilter;
+import org.apache.shindig.gadgets.GadgetException;
+import org.apache.shindig.gadgets.features.FeatureRegistry;
+import org.apache.shindig.gadgets.features.FeatureRegistryProvider;
+
+import com.google.common.base.Joiner;
+import com.google.inject.Inject;
+
+public class AllJsFilter extends InjectedFilter {
+
+ private String allFeatures;
+
+ @Inject
+ public void setFeatureRegistryProvider(FeatureRegistryProvider provider) {
+ try {
+ FeatureRegistry registry = provider.get(null);
+ Set<String> allFeatureNames = registry.getAllFeatureNames();
+
+ // TODO(felix8a): Temporary hack for caja
+ HashSet<String> someFeatureNames = new HashSet<String>(allFeatureNames);
+ someFeatureNames.remove("es53-guest-frame");
+ someFeatureNames.remove("es53-guest-frame.opt");
+ someFeatureNames.remove("es53-taming-frame");
+ someFeatureNames.remove("es53-taming-frame.opt");
+
+ allFeatures = Joiner.on(':').join(someFeatureNames);
+ } catch (GadgetException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
+ throws IOException, ServletException {
+ if (!(request instanceof HttpServletRequest && response instanceof
HttpServletResponse)) {
+ throw new ServletException("Only HTTP!");
+ }
+
+ HttpServletRequest req = (HttpServletRequest) request;
+ HttpServletResponse resp = (HttpServletResponse) response;
+
+ String requestURI = req.getRequestURI();
+ if (!requestURI.contains("all-features-please.js")) {
+ chain.doFilter(request, response);
+ } else {
+ String newURI = requestURI.replace("all-features-please.js", allFeatures
+ ".js") + "?" + req.getQueryString();
+ resp.sendRedirect(newURI);
+ }
+ }
+
+ public void destroy() {
+ }
+}
+
Modified: shindig/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/shindig/trunk/pom.xml?rev=1352717&r1=1352716&r2=1352717&view=diff
==============================================================================
--- shindig/trunk/pom.xml (original)
+++ shindig/trunk/pom.xml Thu Jun 21 22:28:33 2012
@@ -1627,7 +1627,7 @@
<dependency>
<groupId>caja</groupId>
<artifactId>caja</artifactId>
- <version>r4527</version>
+ <version>r4884</version>
<scope>compile</scope>
<exclusions>
<!-- force use of xml-apis until caja fixes their pom -->