[webkit-dev] safari extension script loading within injected file
Lou Zell
lzell11 at gmail.com
Wed Feb 2 23:37:07 PST 2011
On Wed, Feb 2, 2011 at 10:59 PM, Lou Zell <lzell11 at gmail.com> wrote:
> I made a simple test where I load a single javascript file from within the
> injected js. This single file creates a variable, window.MyGlobal. What is
> very interesting to me is that this object is accessible from the loaded
> page! Meaning if I create an html file that tries to access
> window.MyGlobal, it can. I don't think web page authors are supposed to be
> able to access variables created by extensions.
>
>
After giving this more thought. This behavior does seem perfectly
reasonable. The javascript I'm using (in the first email) loads the second
script by appending a <script> tag to <head>. So obviously whatever is in
that script is going to be accessible by the page's author.
> I'm going to pose the question in the Apple list Adam suggested. I'll post
> the solution here for completeness when I get one.
>
So, it appears the answer to my question is: you're doing it wrong! Any
javascript that my extension needs must be injected in. I can specify
multiple files to inject, but I was trying to only load files as I needed
them--instead of injecting them all on each page load. In the future I can
imagine Apple adding some form of conditional injection to extensions.
Best,
Lou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110202/f01dd74b/attachment.html>
More information about the webkit-dev
mailing list