Change browsers to use separate execution contexts for each <script> tag, and specify permissions about what they can and can't do to the containing context.
<script> tags are not part of the js language.
Change browsers to use separate execution contexts for each <script> tag, and specify permissions about what they can and can't do to the containing context.
<script> tags are not part of the js language.
It's outside of the scope of javascript. It's the Browser security model that needs toughening up.
<script>
var a = "hello, world";
</script>
<script>
doSomething(a);
</script>
My program is either syntactically invalid (because 'a' is undefined) or functionally incorrect (because it doesn't do anything) if you treat these blocks separately. This is Javascript code that relies upon script tags using the same execution context.Once again, I (recursively) refer you to this comment:
You're well aware we're talking about <script> tags when used to load external source from other domains, so your example above is pretty irrelevant.
Good luck on your quest to rid the world of javascript!
Really, I don't understand the hostility here. Surely this is a worthwhile discussion to have? Either we can establish that it's not a problem that needs fixing, or we can establish that something needs fixing, and identify where it is.
Implying that I'm on some kind of vendetta just because I disagree with you about the source and nature of the flaws in javascript seems a little bit juvenile. These are genuinely-held opinions, and I'd appreciate it if you would not assume that I'm being disingenuous just because I disagree with you.
I, for one, remain totally unimpressed by these accusations of insecurity. They don't seem like a big deal at all.
Lazy and/or incompetent programmers will always find a way to write insecure code.
Why? Just have them in a separate execution context, and give them specific permissions... eg you can mess with the DOM, but only within this specific element, you can pass me messages, you can't access my execution context etc etc.
Such fine grained permissions would allow everything that goes on already, and disallow things you don't want to happen.
I agree though, the 'brokenness' is being vastly overplayed here. js isn't "broken", browsers aren't "broken", they just need improving, which is happening.