Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | load(libdir + "asserts.js"); |
michael@0 | 2 | var ieval = eval; |
michael@0 | 3 | |
michael@0 | 4 | // Now for a tour of the various ways you can access arguments. |
michael@0 | 5 | assertThrowsInstanceOf(function () { |
michael@0 | 6 | ieval("function x(...rest) { arguments; }"); |
michael@0 | 7 | }, SyntaxError) |
michael@0 | 8 | assertThrowsInstanceOf(function () { |
michael@0 | 9 | Function("...rest", "arguments;"); |
michael@0 | 10 | }, SyntaxError); |
michael@0 | 11 | assertThrowsInstanceOf(function (...rest) { |
michael@0 | 12 | eval("arguments;"); |
michael@0 | 13 | }, SyntaxError); |
michael@0 | 14 | assertThrowsInstanceOf(function (...rest) { |
michael@0 | 15 | eval("arguments = 42;"); |
michael@0 | 16 | }, SyntaxError); |
michael@0 | 17 | |
michael@0 | 18 | function g(...rest) { |
michael@0 | 19 | assertThrowsInstanceOf(h, Error); |
michael@0 | 20 | } |
michael@0 | 21 | function h() { |
michael@0 | 22 | g.arguments; |
michael@0 | 23 | } |
michael@0 | 24 | g(); |
michael@0 | 25 | |
michael@0 | 26 | // eval() is evil, but you can still use it with rest parameters! |
michael@0 | 27 | function still_use_eval(...rest) { |
michael@0 | 28 | eval("x = 4"); |
michael@0 | 29 | } |
michael@0 | 30 | still_use_eval(); |