mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 19:55:39 +00:00
Bug 1365346 - Make Debugger.Source.prototype.sourceMapURL setter check its argc. r=shu
This commit is contained in:
parent
c250372b99
commit
297b58dc95
52
js/src/jit-test/tests/debug/setter-argc.js
Normal file
52
js/src/jit-test/tests/debug/setter-argc.js
Normal file
@ -0,0 +1,52 @@
|
||||
// Check that setters throw TypeError when passed no arguments, instead of crashing.
|
||||
|
||||
function check(obj) {
|
||||
let proto = Object.getPrototypeOf(obj);
|
||||
let props = Object.getOwnPropertyNames(proto);
|
||||
for (let prop of props) {
|
||||
let desc = Object.getOwnPropertyDescriptor(proto, prop);
|
||||
if (desc.set) {
|
||||
print("bleah: " + uneval(prop));
|
||||
assertEq(typeof desc.set, 'function');
|
||||
try {
|
||||
desc.set.call(obj);
|
||||
assertEq("should have thrown TypeError", false);
|
||||
} catch (e) {
|
||||
assertEq(e instanceof TypeError, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var dbg = new Debugger;
|
||||
var g = newGlobal();
|
||||
var gw = dbg.addDebuggee(g);
|
||||
|
||||
// Debugger
|
||||
check(dbg);
|
||||
|
||||
// Debugger.Memory
|
||||
check(dbg.memory);
|
||||
|
||||
// Debugger.Object
|
||||
g.eval('function f() { debugger; }');
|
||||
var fw = gw.getOwnPropertyDescriptor('f').value;
|
||||
check(fw);
|
||||
|
||||
// Debugger.Script
|
||||
check(fw.script);
|
||||
|
||||
// Debugger.Source
|
||||
check(fw.script.source);
|
||||
|
||||
// Debugger.Environment
|
||||
check(fw.environment);
|
||||
|
||||
// Debugger.Frame
|
||||
var log = '';
|
||||
dbg.onDebuggerStatement = function(frame) {
|
||||
log += 'd';
|
||||
check(frame);
|
||||
}
|
||||
g.eval('f()');
|
||||
assertEq(log, 'd');
|
@ -7641,9 +7641,11 @@ DebuggerSource_getIntroductionType(JSContext* cx, unsigned argc, Value* vp)
|
||||
static bool
|
||||
DebuggerSource_setSourceMapURL(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
THIS_DEBUGSOURCE_SOURCE(cx, argc, vp, "sourceMapURL", args, obj, sourceObject);
|
||||
THIS_DEBUGSOURCE_SOURCE(cx, argc, vp, "set sourceMapURL", args, obj, sourceObject);
|
||||
ScriptSource* ss = sourceObject->source();
|
||||
MOZ_ASSERT(ss);
|
||||
if (!args.requireAtLeast(cx, "set sourceMapURL", 1))
|
||||
return false;
|
||||
|
||||
JSString* str = ToString<CanGC>(cx, args[0]);
|
||||
if (!str)
|
||||
|
Loading…
Reference in New Issue
Block a user