Hi Felix & all,
On Thu, Jul 9, 2009 at 4:06 PM, felix<[email protected]> wrote:
> before r3525, if incoming html has
> <a href="#foo">
> then the cajoler calls the PluginEnvironment's rewriteUri()
> with the uri "#foo".
>
> after r3525, the cajoler calls rewriteUri()
> with a uri like "file://Users/felix8a/tmp/test.html#foo".
We discussed this at length. Here is our conclusion.
The new behavior is on the way towards being more correct than the old
behavior. In particular, in a case where we have *multiple* levels of
references, like
a/b/c.js refers to
../../d/e/js refers to
e/f.js
we need the cajoler to resolve the reference each time. This is actually not
a theoretical issue (any longer): The current Caja summer intern, Ziqing
Mao, is building in Caja an implementation of a JavaScript module system
that deals with precisely that case.
That said, you are correct, and we have decided that the PluginEnvironment's
methods need to change such that instead of:
interface PluginEnvironment {
CharProducer loadExternalResource(
ExternalReference ref,
String mimeType);
String rewriteUri(
ExternalReference ref,
String mimeType);
}
we do:
interface PluginEnvironment {
CharProducer loadExternalResource(
ExternalReference base,
ExternalReference relative,
String mimeType);
String rewriteUri(
ExternalReference base,
ExternalReference relative,
String mimeType);
}
The PluginEnvironment would do the resolution and return the newly combined
URL either as a String (for rewriteUri) or in the FilePosition of the
CharProducer (for loadExternalResource). This URI would be the base for
future resolutions, if any, in the content returned by the CharProducer.
Is this clear, and does this sound like it would fit your use case?
Ihab
--
Ihab A.B. Awad, Palo Alto, CA