Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
error when not calling unsafeWindow
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Anthony Lieuallen  
View profile  
 More options Feb 7 2008, 3:53 pm
From: Anthony Lieuallen <arant...@gmail.com>
Date: Thu, 07 Feb 2008 15:53:03 -0500
Local: Thurs, Feb 7 2008 3:53 pm
Subject: error when not calling unsafeWindow
On 2/7/2008 2:03 PM, Mike Champion wrote:

> Here is a script that reproduces the problem for me when loading up
> digg.com.

Migrated this from -users to -dev.

Ok, so, blank profile.  Install GM 0.7.20080121.0.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11)
Gecko/20071127 Firefox/2.0.0.11

This script:

==================================================
// ==UserScript==
// @include        http://www.digg.com/
// @include        http://www.google.com/
// @include        file://*
// ==/UserScript==

window.addEventListener('load', handle_load, true);

function handle_load() {
        GM_setValue("foo", "bar");

}

==================================================

Throws this error to console at digg, but not at google.

"Error: Greasemonkey access violation: unsafeWindow cannot call
GM_setValue."

Including a debug dump of "stack.filename" in GM_apiLeakCheck(), I see
at digg:

check file: file:///C:/Documents%20and%20Settings/.../greasemonkey.js
check file: chrome://greasemonkey/content/miscapis.js
check file: chrome://greasemonkey/content/utils.js
check file: file:///C:/Documents%20and%20Settings/.../greasemonkey.js
check file: http://ads1.msn.com/library/dap.js

At google:

check file: string file:///C:/Documents%20and%20Settings/.../greasemonkey.js
check file: string chrome://greasemonkey/content/miscapis.js
check file: string chrome://greasemonkey/content/utils.js
check file: string file:///C:/Documents%20and%20Settings/.../greasemonkey.js

So it's probably something with that MSN ad JS.  If I copy the source of
the digg.com homepage into a local file, and load the file, I get the
same error.

If I trim that file down to this:

==================================================
<html>
<head>
<script type="text/javascript"
src="http://Ads1.msn.com/library/dap.js"></script>
</head>
<body>

<div id="block_ad_msft" class="item_ad_image">
  <script type="text/javascript">
   dapMgr.enableACB("block_ad_msft", false);
   dapMgr.renderAd("block_ad_msft", "&PG=DIGHPG&AP=1089&PN=Digg", 300, 250);
  </script>
</div>

</body>
</html>
==================================================

It still happens.  That's as far as I've been able to debug this, yet.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jesper Kristensen  
View profile  
 More options Feb 15 2008, 4:05 pm
From: Jesper Kristensen <m...@jesperkristensen.dk>
Date: Fri, 15 Feb 2008 13:05:07 -0800 (PST)
Local: Fri, Feb 15 2008 4:05 pm
Subject: Re: error when not calling unsafeWindow

On 7 Feb., 21:53, Anthony Lieuallen <arant...@gmail.com> wrote:

Normally handle_load would not get called since the GM script runs
after the load event has happened. Maybe the MSN script triggers a
second load event, and since the event is triggered by the website, it
is not allowed to access GM_* functions. Just guessing.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anthony Lieuallen  
View profile  
 More options Feb 15 2008, 4:28 pm
From: Anthony Lieuallen <arant...@gmail.com>
Date: Fri, 15 Feb 2008 16:28:12 -0500
Local: Fri, Feb 15 2008 4:28 pm
Subject: Re: [greasemonkey-dev] Re: error when not calling unsafeWindow
On 2/15/2008 4:05 PM, Jesper Kristensen wrote:

> Normally handle_load would not get called since the GM script runs
> after the load event has happened.

Nope, sorry.  GM scripts run at DOMContentLoaded which is always before
plain "load" (which is after images, iframes, etc.).

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jesper Kristensen  
View profile  
 More options Feb 17 2008, 10:25 am
From: Jesper Kristensen <m...@jesperkristensen.dk>
Date: Sun, 17 Feb 2008 07:25:52 -0800 (PST)
Local: Sun, Feb 17 2008 10:25 am
Subject: Re: error when not calling unsafeWindow
On 15 Feb., 22:28, Anthony Lieuallen <arant...@gmail.com> wrote:

> On 2/15/2008 4:05 PM, Jesper Kristensen wrote:

> > Normally handle_load would not get called since the GM script runs
> > after the load event has happened.

> Nope, sorry.  GM scripts run at DOMContentLoaded which is always before
> plain "load" (which is after images, iframes, etc.).

Reduced test page:

<body>
<script>
var ifrm=document.createElement("IFRAME");
ifrm.scrolling="no";
document.documentElement.appendChild(ifrm);
ifrm.contentDocument.write('');
setTimeout(function() { ifrm.contentDocument.close(); }, 0);
</script>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johan Sundström  
View profile  
 More options Feb 17 2008, 10:59 am
From: "Johan Sundström" <oyas...@gmail.com>
Date: Sun, 17 Feb 2008 16:59:40 +0100
Local: Sun, Feb 17 2008 10:59 am
Subject: Re: [greasemonkey-dev] Re: error when not calling unsafeWindow
On Feb 17, 2008 4:25 PM, Jesper Kristensen <m...@jesperkristensen.dk> wrote:

An @include which matches the url having this code on it will not
automatically match the url of the document in that iframe. Up until
ifrm.contentDocument.write, the location of that iframe
(ifrm.contentWindow.location.href) is "about:blank".

After that, it seems to pick up the url of the window that wrote to
it, though. If a DOMContentLoaded event would fire after that write
(which I would assume it does not), Greasemonkey should invoke
whatever scripts are run for that url.

I would personally register a "load" event listener on that generated
iframe, though, from a GM script that triggered on the page with the
dynamics, rather than trying to figure out how to have a script be
auto-invoked on a magically rendered web page using @include rules not
really fit for that purpose.

--
 / Johan Sundström, http://ecmanaut.blogspot.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anthony Lieuallen  
View profile  
 More options Feb 17 2008, 11:39 am
From: Anthony Lieuallen <arant...@gmail.com>
Date: Sun, 17 Feb 2008 11:39:04 -0500
Local: Sun, Feb 17 2008 11:39 am
Subject: Re: [greasemonkey-dev] Re: error when not calling unsafeWindow
On 2/17/2008 10:59 AM, Johan Sundström wrote:

> I would personally register a "load" event listener on that generated
> iframe, though, from a GM script that triggered on the page with the
> dynamics, rather than trying to figure out how to have a script be
> auto-invoked on a magically rendered web page using @include rules not
> really fit for that purpose.

The original user script author who reported this bug was targeting (and
@includ-ing) digg.  It was an MSN ad script which was included, doing
crazy stuff with iframes, that triggered the bug.  The author is not
attempting to target this crazy frame, but the page it is being put into.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johan Sundström  
View profile  
 More options Feb 17 2008, 12:14 pm
From: "Johan Sundström" <oyas...@gmail.com>
Date: Sun, 17 Feb 2008 18:14:28 +0100
Local: Sun, Feb 17 2008 12:14 pm
Subject: Re: [greasemonkey-dev] Re: error when not calling unsafeWindow
On Feb 17, 2008 5:39 PM, Anthony Lieuallen <arant...@gmail.com> wrote:

> On 2/17/2008 10:59 AM, Johan Sundström wrote:
> > I would personally register a "load" event listener on that generated
> > iframe, though, from a GM script that triggered on the page with the
> > dynamics, rather than trying to figure out how to have a script be
> > auto-invoked on a magically rendered web page using @include rules not
> > really fit for that purpose.

> The original user script author who reported this bug was targeting (and
> @includ-ing) digg.  It was an MSN ad script which was included, doing
> crazy stuff with iframes, that triggered the bug.  The author is not
> attempting to target this crazy frame, but the page it is being put into.

Ah, I must have been mixing up threads.

--
 / Johan Sundström, http://ecmanaut.blogspot.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google