michael@0: // Bug 689101 - if the binary layout of jsval does not match between C and C++ michael@0: // code, then calls to functions returning jsval may get compiled differently michael@0: // than the callee, resulting in parameters being shifted over by one. michael@0: // michael@0: // An example is where on Windows, calling jsdValue.getWrappedValue() will michael@0: // return a random floating point number instead of an object. michael@0: // michael@0: // This test must be run with debugging already enabled michael@0: michael@0: function run_test() { michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: const DebuggerService = Cc["@mozilla.org/js/jsd/debugger-service;1"]; michael@0: const jsdIDebuggerService = Ci.jsdIDebuggerService; michael@0: var jsd = DebuggerService.getService(jsdIDebuggerService); michael@0: michael@0: do_check_true(jsd.isOn); michael@0: michael@0: var n = 0; michael@0: function f() { michael@0: n++; michael@0: } michael@0: michael@0: jsd.enumerateScripts({ enumerateScript: function(script) { michael@0: script.setBreakpoint(0); michael@0: } }); michael@0: michael@0: jsd.breakpointHook = function(frame, type, dummy) { michael@0: var scope = frame.scope; michael@0: var parent = scope.jsParent; // Probably does not need to be called michael@0: var wrapped = scope.getWrappedValue(); michael@0: // Do not try to print 'wrapped'; it may be an internal Call object michael@0: // that will crash when you toString it. Different bug. michael@0: do_check_eq(typeof(wrapped), "object"); michael@0: return Ci.jsdIExecutionHook.RETURN_CONTINUE; michael@0: }; michael@0: michael@0: f(); michael@0: michael@0: jsd.breakpointHook = null; michael@0: jsd = null; michael@0: }