Thanks so much the snippet now works! Now I am trying to integrate this 
with my project, which uses a framework called "A-Frame" for games and I 
have run into another problem.

When I include the framework script, (I believe) it tries to add a function 
to the Math prototype that the library needs, and I get an error in the 
console like this:

Uncaught script error: Uncaught TypeError: can't define property "sign": 
Math is not extensible in source: 
"https://cdnjs.cloudflare.com/ajax/libs/aframe/0.6.0/aframe-master.js"; at 
line: -1

 Here is the code snippet of the guest page:

<html>
    <head>
        <script src=
"https://cdnjs.cloudflare.com/ajax/libs/aframe/0.6.0/aframe-master.js";
></script>
    </head>
</html>

Is there any way around this?

PS. When reproducing this there is a delay before the error shows, and the 
page first goes unresponsive

On Thursday, February 8, 2018 at 9:17:35 PM UTC, Kevin Reid wrote:
>
> Got it. I gave you misspelled code, sorry. Try:
>
> var uriPolicy = {
>   fetch: caja.policy.net.fetcher.USE_XHR, 
>   rewrite: caja.policy.net.rewriter.ALL
> };
>
>
> Note 'fetch' and 'rewrite' instead of 'fetcher' and 'rewriter' in the 
> property names.
>
> (Your script will also not work because it tries to access the #main 
> element before that part of the HTML has been parsed, but that is the same 
> as a normal browser environment and the error message will be actually 
> useful for that.)
>
> On Thu, Feb 8, 2018 at 11:09 AM, Marc H <zappy...@gmail.com <javascript:>> 
> wrote:
>
>> Great thanks kevin, if it helps I can upload my files so it would be 
>> easier to reproduce?
>>
>> On Wednesday, February 7, 2018 at 6:51:59 PM UTC, Kevin Reid wrote:
>>>
>>> For what it's worth, I don't see anything obviously wrong with your 
>>> code. I will have to see if I can reproduce the problem, but I do not 
>>> expect to have time to investigate today.
>>>
>>> On Wed, Feb 7, 2018 at 10:05 AM, Marc H <zappy...@gmail.com> wrote:
>>>
>>>> This is a continuation of over here 
>>>> <https://github.com/google/caja/issues/2030>.
>>>>
>>>> I am trying to include a script in a guest page, however the script 
>>>> does not run and I get an error:
>>>>
>>>> Uncaught script error: Uncaught Error: not loaded in source: "
>>>> http://localhost:8000/test.js"; at line: -1
>>>>  ses-single-frame.js:34340:5
>>>>
>>>> I am using a CORS-enabled server on localhost as shown here:
>>>> ~$ curl -I localhost:8000/test.js
>>>> HTTP/1.0 200 OK
>>>> ...
>>>> Access-Control-Allow-Origin: *
>>>>
>>>> Finally here are the code snippets:
>>>>
>>>>
>>>> *Host*
>>>> <html>
>>>>     <head>
>>>>         <title>Caja host page</title>
>>>>         <script type="text/javascript" src="//caja.appspot.com/caja.js"
>>>> ></script>
>>>>     </head>
>>>>
>>>>     <body>
>>>>         <div id="guest"></div>
>>>>         <script type="text/javascript">
>>>>             var uriPolicy = {fetcher: caja.policy.net.fetcher.USE_XHR, 
>>>> rewriter: caja.policy.net.rewriter.ALL};
>>>>
>>>>             caja.initialize({
>>>>                 cajaServer: 'https://caja.appspot.com/',
>>>>                 debug: true
>>>>             });
>>>>
>>>>             caja.load(document.getElementById("guest"), uriPolicy, 
>>>> function(frame) {
>>>>                 frame.code("http://localhost:8000/caja-full-guest.html";
>>>> , "text/html")
>>>>                     .run();
>>>>             });
>>>>         </script>
>>>>     </body>
>>>> </html>
>>>>
>>>>
>>>> *Guest*
>>>> <html>
>>>>     <head>
>>>>         <script src="/test.js"></script>
>>>>     </head>
>>>>
>>>>     <body>
>>>>         <h1 id="main">Doh!</h1>
>>>>     </body>
>>>> </html>
>>>>
>>>>
>>>> *Test.js*
>>>> document.getElementById("main").innerHTML = "Excellent!";
>>>>
>>>> -- 
>>>>
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Google Caja Discuss" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to google-caja-discuss+unsubscr...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google Caja Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to google-caja-discuss+unsubscr...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-caja-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to