Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Second testPropagatedFunArgs test -- this is a crash-test. |
michael@0 | 2 | (function () { |
michael@0 | 3 | var escapee; |
michael@0 | 4 | |
michael@0 | 5 | function testPropagatedFunArgs() |
michael@0 | 6 | { |
michael@0 | 7 | const magic = 42; |
michael@0 | 8 | |
michael@0 | 9 | var win = this; |
michael@0 | 10 | var res = [], q = []; |
michael@0 | 11 | function addEventListener(name, func, flag) { |
michael@0 | 12 | q.push(func); |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | var pageInfo = "pageInfo", obs; |
michael@0 | 16 | addEventListener("load", handleLoad, true); |
michael@0 | 17 | |
michael@0 | 18 | var observer = { |
michael@0 | 19 | observe: function(win, topic, data) { |
michael@0 | 20 | // obs.removeObserver(observer, "page-info-dialog-loaded"); |
michael@0 | 21 | handlePageInfo(); |
michael@0 | 22 | } |
michael@0 | 23 | }; |
michael@0 | 24 | |
michael@0 | 25 | function handleLoad() { |
michael@0 | 26 | //pageInfo = { toString: function() { return "pageInfo"; } }; |
michael@0 | 27 | obs = { addObserver: function (obs, topic, data) { obs.observe(win, topic, data); } }; |
michael@0 | 28 | obs.addObserver(observer, "page-info-dialog-loaded", false); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | function handlePageInfo() { |
michael@0 | 32 | res.push(pageInfo); |
michael@0 | 33 | function $(aId) { |
michael@0 | 34 | function notSafe() { |
michael@0 | 35 | return magic; |
michael@0 | 36 | } |
michael@0 | 37 | notSafe(); |
michael@0 | 38 | res.push(pageInfo); |
michael@0 | 39 | }; |
michael@0 | 40 | var feedTab = $("feedTab"); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | escapee = q[0]; |
michael@0 | 44 | return res.join(','); |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | testPropagatedFunArgs(); |
michael@0 | 48 | |
michael@0 | 49 | escapee(); |
michael@0 | 50 | })(); |
michael@0 | 51 | |
michael@0 | 52 | function testStringLengthNoTinyId() |
michael@0 | 53 | { |
michael@0 | 54 | var x = "unset"; |
michael@0 | 55 | var t = new String(""); |
michael@0 | 56 | for (var i = 0; i < 5; i++) |
michael@0 | 57 | x = t["-1"]; |
michael@0 | 58 | |
michael@0 | 59 | var r = "t['-1'] is " + x; |
michael@0 | 60 | t["-1"] = "foo"; |
michael@0 | 61 | r += " when unset, '" + t["-1"] + "' when set"; |
michael@0 | 62 | return r; |
michael@0 | 63 | } |
michael@0 | 64 | assertEq(testStringLengthNoTinyId(), "t['-1'] is undefined when unset, 'foo' when set"); |