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 | // Bug 689101 - if the binary layout of jsval does not match between C and C++ |
michael@0 | 2 | // code, then calls to functions returning jsval may get compiled differently |
michael@0 | 3 | // than the callee, resulting in parameters being shifted over by one. |
michael@0 | 4 | // |
michael@0 | 5 | // An example is where on Windows, calling jsdValue.getWrappedValue() will |
michael@0 | 6 | // return a random floating point number instead of an object. |
michael@0 | 7 | // |
michael@0 | 8 | // This test must be run with debugging already enabled |
michael@0 | 9 | |
michael@0 | 10 | function run_test() { |
michael@0 | 11 | const Cc = Components.classes; |
michael@0 | 12 | const Ci = Components.interfaces; |
michael@0 | 13 | const DebuggerService = Cc["@mozilla.org/js/jsd/debugger-service;1"]; |
michael@0 | 14 | const jsdIDebuggerService = Ci.jsdIDebuggerService; |
michael@0 | 15 | var jsd = DebuggerService.getService(jsdIDebuggerService); |
michael@0 | 16 | |
michael@0 | 17 | do_check_true(jsd.isOn); |
michael@0 | 18 | |
michael@0 | 19 | var n = 0; |
michael@0 | 20 | function f() { |
michael@0 | 21 | n++; |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | jsd.enumerateScripts({ enumerateScript: function(script) { |
michael@0 | 25 | script.setBreakpoint(0); |
michael@0 | 26 | } }); |
michael@0 | 27 | |
michael@0 | 28 | jsd.breakpointHook = function(frame, type, dummy) { |
michael@0 | 29 | var scope = frame.scope; |
michael@0 | 30 | var parent = scope.jsParent; // Probably does not need to be called |
michael@0 | 31 | var wrapped = scope.getWrappedValue(); |
michael@0 | 32 | // Do not try to print 'wrapped'; it may be an internal Call object |
michael@0 | 33 | // that will crash when you toString it. Different bug. |
michael@0 | 34 | do_check_eq(typeof(wrapped), "object"); |
michael@0 | 35 | return Ci.jsdIExecutionHook.RETURN_CONTINUE; |
michael@0 | 36 | }; |
michael@0 | 37 | |
michael@0 | 38 | f(); |
michael@0 | 39 | |
michael@0 | 40 | jsd.breakpointHook = null; |
michael@0 | 41 | jsd = null; |
michael@0 | 42 | } |