mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Bug 768750 - Make FieldSetter always set a return value. r=bz
This commit is contained in:
parent
82f96dea7d
commit
b1b1b4e899
@ -35,3 +35,4 @@ asserts-if(Android,2) load 493123-1.xhtml
|
|||||||
load 495354-1.xhtml
|
load 495354-1.xhtml
|
||||||
load 507628-1.xhtml
|
load 507628-1.xhtml
|
||||||
load 507991-1.xhtml
|
load 507991-1.xhtml
|
||||||
|
load set-field-bad-this.xhtml
|
||||||
|
31
content/xbl/crashtests/set-field-bad-this.xhtml
Normal file
31
content/xbl/crashtests/set-field-bad-this.xhtml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Gracefully handle setting a field on a bad |this|</title>
|
||||||
|
|
||||||
|
<bindings xmlns="http://www.mozilla.org/xbl">
|
||||||
|
<binding id="a">
|
||||||
|
<implementation>
|
||||||
|
<field name="f">17</field>
|
||||||
|
</implementation>
|
||||||
|
</binding>
|
||||||
|
</bindings>
|
||||||
|
|
||||||
|
<script type="application/javascript">
|
||||||
|
window.onload = function()
|
||||||
|
{
|
||||||
|
var bound = document.getElementById("bound");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Object.getPrototypeOf(bound).f = 42;
|
||||||
|
}
|
||||||
|
catch (e) { /* Throwing's fine, crashing isn't. */ }
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="bound" style="-moz-binding: url(#a)"></div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -262,9 +262,15 @@ FieldSetterImpl(JSContext *cx, JS::CallArgs args)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (installed) {
|
||||||
js::Rooted<JS::Value> v(cx,
|
js::Rooted<JS::Value> v(cx,
|
||||||
args.length() > 0 ? args[0] : JS::UndefinedValue());
|
args.length() > 0 ? args[0] : JS::UndefinedValue());
|
||||||
return JS_SetPropertyById(cx, thisObj, id, v.address());
|
if (!::JS_SetPropertyById(cx, thisObj, id, v.address())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args.rval().setUndefined();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user