[whatwg] AppCache and javascript url question?

Michael Nordman michaeln at google.com
Wed Jul 22 18:03:23 PDT 2009


On Sun, Jul 19, 2009 at 3:10 AM, Ian Hickson <ian at hixie.ch> wrote:

> On Wed, 1 Jul 2009, Michael Nordman wrote:
> > On Tue, Jun 30, 2009 at 9:29 PM, Ian Hickson <ian at hixie.ch> wrote:
> > > On Thu, 4 Jun 2009, Michael Nordman 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?
> > > >
> > > > <html manifest='myManifestFile'>
> > > > <body>
> > > > <script language="JavaScript">
> > > >   function frameContents1()
> > > >   {
> > > >     var doc = frame1.document;
> > > >     doc.open();
> > > >     doc.write('<img src=image.png>');
> > > >     doc.close();
> > > >     return;
> > > >   }
> > > >
> > > >   function frameContents2()
> > > >   {
> > > >     return "hello";
> > > >   }
> > > > </script>
> > > >
> > > > <iframe name="frame1" src="javascript:parent.frameContents1()">
> > > > <iframe name="frame2" src="javascript:parent.frameContents2()">
> > > > </body>
> > > > </html>
> > >
> > > If there's no manifest="", there's no application cache selected, as
> far
> > > as I can tell.
> >
> > Thats what it looks like to me too in the current draft. Wondering if
> > thats the right behavior though?
> >
> > Generally when loading a frame, the appcache from which the doc resource
> > was loaded gets selected (augmented by an explicit manifest attribute
> > that can make something 'foreign').
> >
> > 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.


>
>
> > 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?


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


Very much agreed.


>
>
> Also, consider this case:
>
>  <iframe
> src="javascript:parent.frameContents3()+frames['otherWin'].frameContents4()">
>
> ...where frames['otherWin'] is from a different manifest. Now what?


Good question.

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).


>
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090722/a55d5e8c/attachment-0002.htm>


More information about the whatwg mailing list