userscripts - warn if unsafeWindow in script

Last update on Dec 1, 2007

Add a visual warning when scripts use unsafeWindow

Warns when a script incorporates the usage of unsafeWindow, allowing the potential user a better chance to evaluate whether to install it.

2.2 - warns for unsafeDocument as well.


(screenshot includes style from here)

From O'ReillyIt's called unsafeWindow for a reason: its properties and methods could be redefined by the page to do virtually anything. You should never call methods on unsafeWindow unless you completely trust the remote page not to mess with you. You should only ever use it as a parameter to call functions defined by the original page, or to watch window properties, as shown in the next section.

Note: No, this script does not use unsafeWindow but the warning will show since it contains the text string.



Want to show your appreciation? Don't donate to me, rather donate to Ron Paul: a President that will keep the internet free so that scripts like these can lawfully exist.




You could comment on this script if you were logged in.

3 comments Feed-icon

1 point
login to vote
Dan Bailey user
Posted Mar 18, 2007

Cheers!

1 point
login to vote
jk- script's author
Posted Mar 18, 2007

Fixed, added "?source" to the request. As for the *.userscripts.org well it's just a habbit.

1 point
login to vote
Henrik N admin
Posted Mar 18, 2007

No need for *.userscripts… – this site doesn't use www..

I think this script will increase the install count of any script you visit. Perhaps you could get the source code from the "View script source" page instead, or tack "?source" onto the install URL? That would keep the install counter from turning.

You could comment on this script if you were logged in.