[whatwg] AppCache and javascript url question?

On Wed, 22 Jul 2009, Michael Nordman wrote:
> On Sun, Jul 19, 2009 at 3:10 AM, Ian Hickson <ian at hixie.ch> wrote:
> > > > >
> > > > > What appcache (if any) should the resulting iframes be 
> > > > > associated with? I think per the spec, the answer is none. Is 
> > > > > that the correct answer?
> > > > >
> > > > > <iframe name="frame1" src="javascript:parent.frameContents1()">
> > > >
> > > > If there's no manifest="", there's no application cache selected, 
> > > > as far as I can tell.
> > >
> > > In this case, the src is a script embedded in a page that is 
> > > appcached, so in a transitory sense the doc resource was loaded from 
> > > an appcache, but that cache does not get selected.
> >
> > The doc resource was not loaded from the cache, it was loaded from 
> > evaluating JavaScript.
> 
> The key phrase was "in a transitory sense". The script that was 
> evaluated was loaded from an appcache.

Not necessarily. For example, the iframe could navigate itself to a 
javascript: URL without the parent knowing about it, or some other frame 
could do it. We do have the _origin_ of the javascript: URL, but that 
doesn't include the path, so it doesn't really help us determine which 
appcache to use.


> > > Feels like maybe image.png should load from myManifestFile in the 
> > > sample?
> >
> > It's trivial for the script to manually include a manifest, if that's 
> > what the script really wants to do.
> 
> Not sure that would produce the desired result?
>
> The appcache would attempt to add this javascript url as a 'master' 
> entry. But it would be rejected since its not an http url and the cache 
> would not be selected and its image.png would not be loaded. Right?

We could say that for javascript: URLs, the origin of the URL is the 
origin of the script of that URL. Then it would work.


> > I don't think we really want to be encouraging javascript: <iframe>s, 
> > anyway.
> 
> Very much agreed.

I haven't added the complexity described above (setting the origin of 
javascript: URLs as opposed to the scripts in them) because of this. If 
people feel strongly that we should make appcache work with subframe 
javascript: and data: URLs, though, let me know.


> Regardless of how complex the script is, there is only one document 
> containing the javascript url. So in that transitory sense, the appcache 
> associated with that document (in this case the one containing the 
> <iframe> tag).

It's not necessarily that simple. We don't currently special-case iframe 
navigation from src=""-setting vs iframe navigation normally.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Saturday, 1 August 2009 14:14:06 UTC