Bug 689101 - Test for firebug incompatibility due to jsval ABI mismatch (r=test)

--HG--
extra : rebase_source : b58acb6b58415e8f1954e46d094b9d6ad985efb1
This commit is contained in:
Steve Fink 2011-10-10 15:06:28 -07:00
parent 06c7b7e215
commit 92987fb614
4 changed files with 48 additions and 0 deletions

View File

@ -42,6 +42,7 @@ DEPTH = ../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
relativesrcdir = js/jsd
include $(DEPTH)/config/autoconf.mk
@ -55,6 +56,7 @@ LIBXUL_LIBRARY = 1
MODULE_NAME = JavaScript_Debugger
EXPORT_LIBRARY = 1
XPCSHELL_TESTS = test
# REQUIRES = java js

View File

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

6
js/jsd/test/xpcshell.ini Normal file
View File

@ -0,0 +1,6 @@
[DEFAULT]
head =
tail =
[test_jsval_retval.js]
debug = 1

View File

@ -47,6 +47,7 @@ skip-if = os == "android"
[include:netwerk/test/unit/xpcshell.ini]
[include:netwerk/test/httpserver/test/xpcshell.ini]
[include:js/ductwork/debugger/tests/xpcshell.ini]
[include:js/jsd/test/xpcshell.ini]
[include:js/jetpack/tests/unit/xpcshell.ini]
[include:js/src/xpconnect/tests/unit/xpcshell.ini]
[include:modules/libjar/test/unit/xpcshell.ini]