Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(57)

Issue 2004042: CSS rewriter doesnt take container into account when rewriting embedded URL's (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 5 months ago by jcian
Modified:
15 years, 4 months ago
Reviewers:
jcian
CC:
dev-remailer_shindig.apache.org
Base URL:
http://svn.apache.org/repos/asf/shindig/trunk/
Visibility:
Public.

Description

I ran into a container configuration related issue while testing out RC2, which is that the CSS rewriter doesn't seem to be taking the container into account when rewriting embedded URL's -- it always uses the default container configuration which ends up giving me invalid proxy URL's in my rewritten CSS. This appears to be due to the fact that the CssResponseRewriter uses the DomWalker.makeGadget method to create a Gadget instance to pass to the ProxyUriManager.ProxyUri constructor, but the GadgetContext inside that Gadget instance doesnt have the container set, which makes code that runs later in the ProxyUriManager to generate the proxy URL use the default container configuration instead of my custom container configuration. I was able to come up with a patch to work around this issue, but I'm not sure if its the best way to go about it... There is a lot of code around the whole gadget rewriting process and I definitely don't have my head wrapped around all of it -- but I thought I'd take a crack at it anyway, if for nothing else to at least highlight where the issue is occurring. The two major changes I made were to add another parameter to the DomWalker.makeGadget method for the container, and passing the container down through the call stack in the CssResponseRewriter. For any other usages of the affected classes which broke -- if there was an obvious place to pull the container from (like a Gadget instance) I used it -- otherwise I just passed in null to trigger the default behavior (which is to return the default container). The JIRA ticket for this patch is: https://issues.apache.org/jira/browse/SHINDIG-1411

Patch Set 1 #

Patch Set 2 : The first patch set wasnt based right - this patch set should be properly based on the current trunk #

Total comments: 4

Patch Set 3 : Updates per comments #

Total comments: 18

Patch Set 4 : Updates per comments #

Total comments: 12

Patch Set 5 : Updates per comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+196 lines, -91 lines) Patch
java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssSanitizer.java View 1 2 3 4 3 chunks +9 lines, -2 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/render/CajaResponseRewriter.java View 1 2 3 2 chunks +4 lines, -3 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/CssResponseRewriter.java View 1 2 3 4 9 chunks +17 lines, -13 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java View 1 2 3 1 chunk +16 lines, -23 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/StyleTagExtractorVisitor.java View 1 2 3 2 chunks +2 lines, -3 lines 0 comments Download
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/StyleTagProxyEmbeddedUrlsVisitor.java View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/CssResponseRewriterTest.java View 1 2 3 9 chunks +56 lines, -8 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/StyleTagExtractorVisitorTest.java View 1 2 3 3 chunks +6 lines, -6 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/StyleTagProxyEmbeddedUrlsVisitorTest.java View 1 2 3 4 5 chunks +82 lines, -29 lines 0 comments Download
java/gadgets/src/test/resources/org/apache/shindig/gadgets/rewrite/rewritebasic-expected.css View 1 chunk +3 lines, -3 lines 0 comments Download

Messages

Total messages: 18
jcian
15 years, 5 months ago (2010-08-18 17:10:41 UTC) #1
zhoresh
http://codereview.appspot.com/2004042/diff/13001/14004 File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java (right): http://codereview.appspot.com/2004042/diff/13001/14004#newcode218 java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/DomWalker.java:218: public static Gadget makeGadget(final Uri context, final String container) ...
15 years, 5 months ago (2010-08-18 22:12:40 UTC) #2
gagan.goku
Thanks for making this change Jesse. Just some small comments / nit picks. Its okay ...
15 years, 5 months ago (2010-08-19 06:06:20 UTC) #3
gagan.goku
Btw, the other similar codereview trying to fix this problem is http://codereview.appspot.com/1888046/. Also see Henry's ...
15 years, 5 months ago (2010-08-19 06:07:59 UTC) #4
jcian
Thanks for all the comments so far from everyone. I think Gagan’s suggestion of passing ...
15 years, 5 months ago (2010-08-19 20:46:15 UTC) #5
jcian
Updates per comments
15 years, 5 months ago (2010-08-19 20:49:17 UTC) #6
johnfargo
Hi Jesse: Thanks for taking this on. The code involved here is representative of some ...
15 years, 4 months ago (2010-08-21 17:21:21 UTC) #7
gagan.goku
General thought: Would it be better to pass on the GadgetContext object rather than String ...
15 years, 4 months ago (2010-08-22 16:19:11 UTC) #8
jcian
I've uploaded a new patch set that should address all comments -- please let me ...
15 years, 4 months ago (2010-08-24 12:34:20 UTC) #9
gagan.goku
Hi Jesse I have not gone through the tests thoroughly (at first glance they look ...
15 years, 4 months ago (2010-08-24 13:01:13 UTC) #10
jcian
On 2010/08/24 13:01:13, gagan.goku wrote: > Hi Jesse > > I have not gone through ...
15 years, 4 months ago (2010-08-24 13:30:02 UTC) #11
gagan.goku
I'm fine with TODO's in appropriate places. @Ziv, John: What are your thoughts ? On ...
15 years, 4 months ago (2010-08-24 15:01:13 UTC) #12
johnfargo
TODOs are fine by me. On Tue, Aug 24, 2010 at 8:00 AM, Gagandeep singh ...
15 years, 4 months ago (2010-08-24 15:10:43 UTC) #13
gagan.goku
lgtm. Small nitpicks inline (mostly files to be reverted because they have been committed as ...
15 years, 4 months ago (2010-08-25 17:52:14 UTC) #14
jcian
http://codereview.appspot.com/2004042/diff/27003/3015 File java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssSanitizer.java (right): http://codereview.appspot.com/2004042/diff/27003/3015#newcode192 java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssSanitizer.java:192: //TODO: Refactor this method to take an additional parameter ...
15 years, 4 months ago (2010-08-25 20:01:27 UTC) #15
zhoresh
lgtm, committed at r989422
15 years, 4 months ago (2010-08-26 02:06:38 UTC) #16
gagan.goku
Thanks Ziv. This should fix container related bugs. On Thu, Aug 26, 2010 at 7:36 ...
15 years, 4 months ago (2010-08-26 02:10:34 UTC) #17
gagan.goku
15 years, 4 months ago (2010-08-27 15:42:13 UTC) #18
You should close this issue now that it has been submitted.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b